diff options
author | Karel Zak | 2013-04-12 16:36:33 +0200 |
---|---|---|
committer | Karel Zak | 2013-04-12 16:36:33 +0200 |
commit | 618ec053fe2d1353eb1c15ebf98c1f4ef9b08ed1 (patch) | |
tree | e749c7c352768ed4492c1f6a3a2ed097d91bf9e2 /tests/functions.sh | |
parent | libmount: add debug message to guess FS function (diff) | |
download | kernel-qcow2-util-linux-618ec053fe2d1353eb1c15ebf98c1f4ef9b08ed1.tar.gz kernel-qcow2-util-linux-618ec053fe2d1353eb1c15ebf98c1f4ef9b08ed1.tar.xz kernel-qcow2-util-linux-618ec053fe2d1353eb1c15ebf98c1f4ef9b08ed1.zip |
tests: consolidate scsi_debug usage
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'tests/functions.sh')
-rw-r--r-- | tests/functions.sh | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/tests/functions.sh b/tests/functions.sh index 8293539d2..2ca98f8ca 100644 --- a/tests/functions.sh +++ b/tests/functions.sh @@ -461,10 +461,35 @@ s/# <!-- util-linux.*-->//; } function ts_fdisk_clean { + local DEVNAME=$(basename "$1") + # remove non comparable parts of fdisk output - [ x"${DEVNAME}" != x"" ] && sed -i -e "s/\/dev\/${DEVNAME}/\/dev\/.../g" $TS_OUTPUT + if [ x"${DEVNAME}" != x"" ]; then + sed -i -e "s/\/dev\/${DEVNAME}/\/dev\/.../g" $TS_OUTPUT + fi + sed -i -e 's/Disk identifier:.*//g' \ -e 's/Building a new.*//g' \ -e 's/Welcome to fdisk.*//g' \ $TS_OUTPUT } + +function ts_scsi_debug_init { + + modprobe --dry-run --quiet scsi_debug + [ "$?" == 0 ] || ts_skip "missing scsi_debug module" + + rmmod scsi_debug &> /dev/null + modprobe scsi_debug $* + [ "$?" == 0 ] || ts_die "Cannot init device" + + DEVNAME=$(grep scsi_debug /sys/block/*/device/model | awk -F '/' '{print $4}') + [ "x${DEVNAME}" == "x" ] && ts_die "Cannot find device" + + DEVICE="/dev/${DEVNAME}" + + sleep 1 + udevadm settle + + echo $DEVICE +} |