diff options
author | Ruediger Meier | 2014-05-11 08:50:28 +0200 |
---|---|---|
committer | Ruediger Meier | 2014-05-13 17:38:12 +0200 |
commit | f45df374ffc311220bd395da985b121eccfb4045 (patch) | |
tree | 6f9daba1ecfcd2523a6d70085d0e2997270a61e2 /tests/ts/wipefs | |
parent | tests: cleanup ts_scsi_debug_init (diff) | |
download | kernel-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/wipefs')
-rwxr-xr-x | tests/ts/wipefs/wipefs | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/tests/ts/wipefs/wipefs b/tests/ts/wipefs/wipefs index 4bd174800..f921625c5 100755 --- a/tests/ts/wipefs/wipefs +++ b/tests/ts/wipefs/wipefs @@ -9,21 +9,22 @@ ts_init "$*" ts_check_test_command "$TS_CMD_WIPEFS" -DEVICE=$(ts_scsi_debug_init dev_size_mb=50 num_parts=2) +# set global variable TS_DEVICE +ts_scsi_debug_init dev_size_mb=50 num_parts=2 # remove old backups -rm -rf $HOME/wipefs-$(basename ${DEVICE})-*.bak +rm -rf $HOME/wipefs-$(basename ${TS_DEVICE})-*.bak #remove the magic byte, back it up -$TS_CMD_WIPEFS --all --backup ${DEVICE} &>/dev/null || ts_die "wipefs failed" +$TS_CMD_WIPEFS --all --backup ${TS_DEVICE} &>/dev/null || ts_die "wipefs failed" #there should be just one magic string/backup file in this case -INFILE=$(ls $HOME/wipefs-$(basename ${DEVICE})-*.bak) +INFILE=$(ls $HOME/wipefs-$(basename ${TS_DEVICE})-*.bak) OFFT=$(echo $INFILE | sed -E 's/^.*-(.*).bak$/\1/') -dd if=$INFILE of=$DEVICE bs=1 conv=notrunc seek=$(($OFFT)) &>/dev/null +dd if=$INFILE of=$TS_DEVICE bs=1 conv=notrunc seek=$(($OFFT)) &>/dev/null #the bytes should be copied back, check if wipefs can recognize it -$TS_CMD_WIPEFS -a ${DEVICE} > $TS_OUTDIR/out 2>/dev/null +$TS_CMD_WIPEFS -a ${TS_DEVICE} > $TS_OUTDIR/out 2>/dev/null # check for output [ -s $TS_OUTDIR/out ] && echo "OK" &> $TS_OUTPUT || exit 1 |