summaryrefslogtreecommitdiffstats
path: root/tests/common
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2022-12-16 15:32:04 -0500
committerTavian Barnes <tavianator@tavianator.com>2022-12-16 15:32:04 -0500
commite50c19f284dad6b4b7b79f91cc8576a97626be8a (patch)
tree3fc7b15a412d4123d403bca6fdbf3225389926e1 /tests/common
parent7d87b96b421b76e387cee903b7b7c1bc16c54310 (diff)
downloadbfs-e50c19f284dad6b4b7b79f91cc8576a97626be8a.tar.xz
tests: Turn on set -e
Diffstat (limited to 'tests/common')
-rw-r--r--tests/common/L_mount.sh7
-rw-r--r--tests/common/execdir_nonexistent.sh7
-rw-r--r--tests/common/inum_bind_mount.sh6
-rw-r--r--tests/common/inum_mount.sh6
-rw-r--r--tests/common/mount.sh7
5 files changed, 13 insertions, 20 deletions
diff --git a/tests/common/L_mount.sh b/tests/common/L_mount.sh
index 5b56762..9ab785e 100644
--- a/tests/common/L_mount.sh
+++ b/tests/common/L_mount.sh
@@ -3,13 +3,12 @@ test "$UNAME" = "Darwin" && skip
clean_scratch
mkdir scratch/{foo,mnt}
+
sudo mount -t tmpfs tmpfs scratch/mnt
+trap "sudo umount scratch/mnt" EXIT
+
ln -s ../mnt scratch/foo/bar
"$XTOUCH" scratch/mnt/baz
ln -s ../mnt/baz scratch/foo/qux
bfs_diff -L scratch -mount
-ret=$?
-
-sudo umount scratch/mnt
-return $ret
diff --git a/tests/common/execdir_nonexistent.sh b/tests/common/execdir_nonexistent.sh
index 5d116e5..af17fe5 100644
--- a/tests/common/execdir_nonexistent.sh
+++ b/tests/common/execdir_nonexistent.sh
@@ -1,5 +1,4 @@
-stderr=$(invoke_bfs basic -execdir "$TESTS/nonexistent" {} \; 2>&1 >/dev/null)
-[ -n "$stderr" ] || return 1
+! stderr=$(invoke_bfs basic -execdir "$TESTS/nonexistent" {} \; 2>&1 >/dev/null)
+[ -n "$stderr" ]
-bfs_diff basic -print -execdir "$TESTS/nonexistent" {} \; -print
-(($? == EX_BFS))
+check_exit $EX_BFS bfs_diff basic -print -execdir "$TESTS/nonexistent" {} \; -print
diff --git a/tests/common/inum_bind_mount.sh b/tests/common/inum_bind_mount.sh
index a9e01bf..625ee3d 100644
--- a/tests/common/inum_bind_mount.sh
+++ b/tests/common/inum_bind_mount.sh
@@ -3,10 +3,8 @@ test "$UNAME" = "Linux" || skip
clean_scratch
"$XTOUCH" scratch/{foo,bar}
+
sudo mount --bind scratch/{foo,bar}
+trap "sudo umount scratch/bar" EXIT
bfs_diff scratch -inum "$(inum scratch/bar)"
-ret=$?
-
-sudo umount scratch/bar
-return $ret
diff --git a/tests/common/inum_mount.sh b/tests/common/inum_mount.sh
index 7cc5e40..91d06e2 100644
--- a/tests/common/inum_mount.sh
+++ b/tests/common/inum_mount.sh
@@ -3,10 +3,8 @@ test "$UNAME" = "Darwin" && skip
clean_scratch
mkdir scratch/{foo,mnt}
+
sudo mount -t tmpfs tmpfs scratch/mnt
+trap "sudo umount scratch/mnt" EXIT
bfs_diff scratch -inum "$(inum scratch/mnt)"
-ret=$?
-
-sudo umount scratch/mnt
-return $ret
diff --git a/tests/common/mount.sh b/tests/common/mount.sh
index f077ea2..3f3ed38 100644
--- a/tests/common/mount.sh
+++ b/tests/common/mount.sh
@@ -3,11 +3,10 @@ test "$UNAME" = "Darwin" && skip
clean_scratch
mkdir scratch/{foo,mnt}
+
sudo mount -t tmpfs tmpfs scratch/mnt
+trap "sudo umount scratch/mnt" EXIT
+
"$XTOUCH" scratch/foo/bar scratch/mnt/baz
bfs_diff scratch -mount
-ret=$?
-
-sudo umount scratch/mnt
-return $ret