summaryrefslogtreecommitdiffstats
path: root/tests/functions.sh
diff options
context:
space:
mode:
authorRuediger Meier2014-05-11 22:48:16 +0200
committerRuediger Meier2014-05-13 17:37:28 +0200
commitdd761f7924747f5bd716699f80bf4c36a1dfed8e (patch)
tree319ebb435327a09c056625c64bac61407fb3e9f2 /tests/functions.sh
parenttests: some more tests need loop support (diff)
downloadkernel-qcow2-util-linux-dd761f7924747f5bd716699f80bf4c36a1dfed8e.tar.gz
kernel-qcow2-util-linux-dd761f7924747f5bd716699f80bf4c36a1dfed8e.tar.xz
kernel-qcow2-util-linux-dd761f7924747f5bd716699f80bf4c36a1dfed8e.zip
tests: cleanup ts_scsi_debug_init
Sort out global and local vars. Now we set TS_DEVICE globally to be use later. Skip really quiet if modprobe fails. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
Diffstat (limited to 'tests/functions.sh')
-rw-r--r--tests/functions.sh13
1 files changed, 7 insertions, 6 deletions
diff --git a/tests/functions.sh b/tests/functions.sh
index 867cdaa23..db1b921f8 100644
--- a/tests/functions.sh
+++ b/tests/functions.sh
@@ -558,21 +558,22 @@ function ts_fdisk_clean {
}
function ts_scsi_debug_init {
+ local devname
+ TS_DEVICE="none"
- modprobe --dry-run --quiet scsi_debug
+ modprobe --dry-run --quiet scsi_debug &>/dev/null
[ "$?" == 0 ] || ts_skip "missing scsi_debug module"
rmmod scsi_debug &> /dev/null
modprobe scsi_debug $*
[ "$?" == 0 ] || ts_die "Cannot init device"
- DEVNAME=$(grep --with-filename scsi_debug /sys/block/*/device/model | awk -F '/' '{print $4}')
- [ "x${DEVNAME}" == "x" ] && ts_die "Cannot find device"
-
- DEVICE="/dev/${DEVNAME}"
+ devname=$(grep --with-filename scsi_debug /sys/block/*/device/model | awk -F '/' '{print $4}')
+ [ "x${devname}" == "x" ] && ts_die "Cannot find device"
sleep 1
udevadm settle
- echo $DEVICE
+ TS_DEVICE="/dev/${devname}"
+ echo "$TS_DEVICE"
}