summaryrefslogtreecommitdiffstats
path: root/tests/ts/eject
diff options
context:
space:
mode:
authorRuediger Meier2014-05-11 08:50:28 +0200
committerRuediger Meier2014-05-13 17:38:12 +0200
commitf45df374ffc311220bd395da985b121eccfb4045 (patch)
tree6f9daba1ecfcd2523a6d70085d0e2997270a61e2 /tests/ts/eject
parenttests: cleanup ts_scsi_debug_init (diff)
downloadkernel-qcow2-util-linux-f45df374ffc311220bd395da985b121eccfb4045.tar.gz
kernel-qcow2-util-linux-f45df374ffc311220bd395da985b121eccfb4045.tar.xz
kernel-qcow2-util-linux-f45df374ffc311220bd395da985b121eccfb4045.zip
tests: ts_scsi_debug_init must not run in a subshell
ts_skip and ts_die won't work from subshell. Now we simply use TS_DEVICE which is globally set in that function. I've made sure that we never change TS_DEVICE variable after we've got it. So we could use it again for cleanup on exit in ts_{finalize,die,skip} functions. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
Diffstat (limited to 'tests/ts/eject')
-rwxr-xr-xtests/ts/eject/umount39
1 files changed, 20 insertions, 19 deletions
diff --git a/tests/ts/eject/umount b/tests/ts/eject/umount
index e781a7ba6..2a684669a 100755
--- a/tests/ts/eject/umount
+++ b/tests/ts/eject/umount
@@ -16,6 +16,7 @@ ts_skip_nonroot
# not removable device.
#
+# set global variable TS_DEVICE
function init_device {
ts_scsi_debug_init dev_size_mb=100
}
@@ -51,50 +52,50 @@ function deinit_device {
ts_init_subtest "by-disk"
-DEVICE=$(init_device)
-$TS_CMD_EJECT --force $DEVICE && ts_log "Success"
+init_device
+$TS_CMD_EJECT --force $TS_DEVICE && ts_log "Success"
deinit_device
ts_finalize_subtest
ts_init_subtest "by-disk-mounted"
-DEVICE=$(init_device)
-mkfs.ext2 -q -F $DEVICE
+init_device
+mkfs.ext2 -q -F $TS_DEVICE
udevadm settle
mkdir -p $TS_MOUNTPOINT
-mount $DEVICE $TS_MOUNTPOINT
-$TS_CMD_EJECT --force $DEVICE && ts_log "Success"
+mount $TS_DEVICE $TS_MOUNTPOINT
+$TS_CMD_EJECT --force $TS_DEVICE && ts_log "Success"
deinit_device
ts_finalize_subtest
ts_init_subtest "by-disk-mounted-partition"
-DEVICE=$(init_device)
-init_partitions $DEVICE
+init_device
+init_partitions $TS_DEVICE
mkdir -p ${TS_MOUNTPOINT}1
mkdir -p ${TS_MOUNTPOINT}2
-mount ${DEVICE}1 ${TS_MOUNTPOINT}1
-mount ${DEVICE}2 ${TS_MOUNTPOINT}2
-$TS_CMD_EJECT --force $DEVICE && ts_log "Success"
+mount ${TS_DEVICE}1 ${TS_MOUNTPOINT}1
+mount ${TS_DEVICE}2 ${TS_MOUNTPOINT}2
+$TS_CMD_EJECT --force $TS_DEVICE && ts_log "Success"
deinit_device
ts_finalize_subtest
ts_init_subtest "by-partition"
-DEVICE=$(init_device)
-init_partitions $DEVICE
-$TS_CMD_EJECT --force ${DEVICE}1 && ts_log "Success"
+init_device
+init_partitions $TS_DEVICE
+$TS_CMD_EJECT --force ${TS_DEVICE}1 && ts_log "Success"
deinit_device
ts_finalize_subtest
ts_init_subtest "by-partition-mounted"
-DEVICE=$(init_device)
-init_partitions $DEVICE
+init_device
+init_partitions $TS_DEVICE
mkdir -p ${TS_MOUNTPOINT}1
mkdir -p ${TS_MOUNTPOINT}2
-mount ${DEVICE}1 ${TS_MOUNTPOINT}1
-mount ${DEVICE}2 ${TS_MOUNTPOINT}2
-$TS_CMD_EJECT --force ${DEVICE}1 && ts_log "Success"
+mount ${TS_DEVICE}1 ${TS_MOUNTPOINT}1
+mount ${TS_DEVICE}2 ${TS_MOUNTPOINT}2
+$TS_CMD_EJECT --force ${TS_DEVICE}1 && ts_log "Success"
deinit_device
ts_finalize_subtest