]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
swapon: (tests) abort test on failing commands
authorThomas Weißschuh <thomas@t-8ch.de>
Mon, 2 Oct 2023 16:17:01 +0000 (18:17 +0200)
committerThomas Weißschuh <thomas@t-8ch.de>
Mon, 2 Oct 2023 21:34:00 +0000 (23:34 +0200)
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
tests/ts/swapon/devname

index d62b9d9d808f92653066ad645c43be193528da5d..f4f9c16ca54684599c062b1084b7255b90fbd56e 100755 (executable)
@@ -36,11 +36,11 @@ $TS_CMD_MKSWAP $DEVICE > /dev/null 2>> $TS_OUTPUT \
 
 ts_device_has "TYPE" "swap" $DEVICE || ts_die "Cannot find swap on $DEVICE"
 
-$TS_CMD_SWAPON $DEVICE >> $TS_OUTPUT 2>> $TS_ERRLOG
+$TS_CMD_SWAPON $DEVICE >> $TS_OUTPUT 2>> $TS_ERRLOG || ts_die "Swapon failed"
 
 grep -q "^$DEVICE\b" /proc/swaps || ts_die "Cannot find $DEVICE in /proc/swaps"
 
-$TS_CMD_SWAPOFF $DEVICE
+$TS_CMD_SWAPOFF $DEVICE || ts_die "Swapoff failed"
 
 # swapon/mkswap warns if system sets different permissions for loop devices
 sed --in-place '/insecure permissions .*, 0660 suggested/d' $TS_OUTPUT