From dd761f7924747f5bd716699f80bf4c36a1dfed8e Mon Sep 17 00:00:00 2001 From: Ruediger Meier Date: Sun, 11 May 2014 22:48:16 +0200 Subject: 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 --- tests/functions.sh | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'tests/functions.sh') 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" } -- cgit v1.2.3-55-g7522