aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorнаб <[email protected]>2022-03-17 21:27:11 +0100
committerBrian Behlendorf <[email protected]>2022-04-01 18:02:19 -0700
commit34abca3e2c51f34f94ec4b4b91974792951e863a (patch)
treea9712f63e6e256ffc352ae816e929aa137217476 /tests
parent61f1502246f3c0ff8737e519807cbc8f9ffa053b (diff)
tests: zfs_003_neg: handle failures correctly
Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: John Kennedy <[email protected]> Reviewed-by: Ryan Moeller <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes #13259
Diffstat (limited to 'tests')
-rwxr-xr-xtests/zfs-tests/tests/functional/cli_root/zfs/zfs_003_neg.ksh14
1 files changed, 10 insertions, 4 deletions
diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs/zfs_003_neg.ksh b/tests/zfs-tests/tests/functional/cli_root/zfs/zfs_003_neg.ksh
index 0438bae8f..6c85e0c13 100755
--- a/tests/zfs-tests/tests/functional/cli_root/zfs/zfs_003_neg.ksh
+++ b/tests/zfs-tests/tests/functional/cli_root/zfs/zfs_003_neg.ksh
@@ -45,7 +45,15 @@
verify_runnable "global"
+function cleanup
+{
+ for file in $ZFS_DEV $MNTTAB; do
+ log_must eval "[ -e ${file} ] || mv ${file}.bak $file"
+ done
+}
+
log_assert "zfs fails with unexpected scenario."
+log_onexit cleanup
#verify zfs failed if ZFS_DEV cannot be opened
ZFS_DEV=/dev/zfs
@@ -56,13 +64,11 @@ if is_linux; then
fi
for file in $ZFS_DEV $MNTTAB; do
- if [[ -e $file ]]; then
- mv $file ${file}.bak
- fi
+ log_must mv $file ${file}.bak
for cmd in "" "list" "get all" "mount"; do
log_mustnot eval "zfs $cmd >/dev/null 2>&1"
done
- mv ${file}.bak $file
+ log_must mv ${file}.bak $file
done
log_pass "zfs fails with unexpected scenario as expected."