From: Ruediger Meier Date: Sun, 11 May 2014 20:48:16 +0000 (+0200) Subject: tests: cleanup ts_scsi_debug_init X-Git-Tag: v2.25-rc1~154^2~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dd761f7924747f5bd716699f80bf4c36a1dfed8e;p=thirdparty%2Futil-linux.git 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 --- diff --git a/tests/functions.sh b/tests/functions.sh index 867cdaa239..db1b921f87 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" }