diff options
author | Ruediger Meier | 2014-05-22 01:37:17 +0200 |
---|---|---|
committer | Ruediger Meier | 2014-05-27 00:06:43 +0200 |
commit | f80c0d38b9e61b33e358d5d539a0f22676ecb077 (patch) | |
tree | 2d120837ed2717446150960b54e112f1eac16d01 /tests/functions.sh | |
parent | Merge branch 'fix-build-sys' of https://github.com/rudimeier/util-linux (diff) | |
download | kernel-qcow2-util-linux-f80c0d38b9e61b33e358d5d539a0f22676ecb077.tar.gz kernel-qcow2-util-linux-f80c0d38b9e61b33e358d5d539a0f22676ecb077.tar.xz kernel-qcow2-util-linux-f80c0d38b9e61b33e358d5d539a0f22676ecb077.zip |
tests: ts_scsi_debug_init skip instead of die
If any of these modprobe commands fails then it's not a broken test.
ALso ts_die often does not work correctly from subtests which should
be fixed someday too.
BTW modprobe dry-run (even the real modprobe) is not reliable.
Moreover now we respect blacklisted modules (-b).
This error handling is not only useful to let the test-suite succeed
on broken systems but also to not fail all "scsi_debug tests" after
just one of them failed to umount something.
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
Diffstat (limited to 'tests/functions.sh')
-rw-r--r-- | tests/functions.sh | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/tests/functions.sh b/tests/functions.sh index 7232adf46..85f0e0fac 100644 --- a/tests/functions.sh +++ b/tests/functions.sh @@ -587,15 +587,23 @@ function ts_scsi_debug_init { local devname TS_DEVICE="none" - modprobe --dry-run --quiet scsi_debug &>/dev/null - [ "$?" == 0 ] || ts_skip "missing scsi_debug module" + # dry run is not realy reliable, real modprobe may still fail + modprobe --dry-run --quiet scsi_debug &>/dev/null \ + || ts_skip "missing scsi_debug module (dry-run)" - rmmod scsi_debug &> /dev/null - modprobe scsi_debug $* - [ "$?" == 0 ] || ts_die "Cannot init device" + # skip if still in use or removal of modules not supported at all + modprobe -r scsi_debug &>/dev/null \ + || ts_skip "cannot remove scsi_debug module (rmmod)" + + modprobe -b scsi_debug $* &>/dev/null \ + || ts_skip "cannot load scsi_debug module (modprobe)" + + # it might be still not loaded, modprobe.conf or whatever + lsmod | grep -q "^scsi_debug " \ + || ts_skip "scsi_debug module not loaded (lsmod)" devname=$(grep --with-filename scsi_debug /sys/block/*/device/model | awk -F '/' '{print $4}') - [ "x${devname}" == "x" ] && ts_die "Cannot find device" + [ "x${devname}" == "x" ] && ts_die "cannot find scsi_debug device" sleep 1 udevadm settle |