summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2022-12-16 16:43:25 -0500
committerTavian Barnes <tavianator@tavianator.com>2022-12-16 17:26:52 -0500
commite2b540c9e2a52500b17fa1005b26b2dd5a652c09 (patch)
tree148a9308e96f9cb86c30afd5743603cc364c9f99 /tests
parente82a7f51d4b4e90df868e5410a0445b009b54ff2 (diff)
downloadbfs-e2b540c9e2a52500b17fa1005b26b2dd5a652c09.tar.xz
tests: Fail early in bfs_diff if the diff fails
Otherwise, propagate the exit code from bfs
Diffstat (limited to 'tests')
-rw-r--r--tests/bfs/execdir_plus_nonexistent.sh2
-rw-r--r--tests/bsd/X.sh2
-rw-r--r--tests/common/execdir_nonexistent.sh2
-rw-r--r--tests/gnu/L_loops_continue.sh2
-rw-r--r--tests/gnu/printf_Y_error.sh2
-rw-r--r--tests/posix/depth_error.sh2
-rw-r--r--tests/posix/exec_nonexistent.sh2
-rw-r--r--tests/posix/exec_plus_nonexistent.sh2
-rw-r--r--tests/posix/exec_plus_status.sh2
-rwxr-xr-xtests/tests.sh13
10 files changed, 12 insertions, 19 deletions
diff --git a/tests/bfs/execdir_plus_nonexistent.sh b/tests/bfs/execdir_plus_nonexistent.sh
index 88f3e90..e3b4d2d 100644
--- a/tests/bfs/execdir_plus_nonexistent.sh
+++ b/tests/bfs/execdir_plus_nonexistent.sh
@@ -1,4 +1,4 @@
! stderr=$(invoke_bfs basic -execdir "$TESTS/nonexistent" {} + 2>&1 >/dev/null)
[ -n "$stderr" ]
-check_exit $EX_BFS bfs_diff basic -execdir "$TESTS/nonexistent" {} + -print
+! bfs_diff basic -execdir "$TESTS/nonexistent" {} + -print
diff --git a/tests/bsd/X.sh b/tests/bsd/X.sh
index df9a261..54000cf 100644
--- a/tests/bsd/X.sh
+++ b/tests/bsd/X.sh
@@ -1 +1 @@
-check_exit $EX_BFS bfs_diff -X weirdnames
+! bfs_diff -X weirdnames
diff --git a/tests/common/execdir_nonexistent.sh b/tests/common/execdir_nonexistent.sh
index af17fe5..4bb4fdb 100644
--- a/tests/common/execdir_nonexistent.sh
+++ b/tests/common/execdir_nonexistent.sh
@@ -1,4 +1,4 @@
! stderr=$(invoke_bfs basic -execdir "$TESTS/nonexistent" {} \; 2>&1 >/dev/null)
[ -n "$stderr" ]
-check_exit $EX_BFS bfs_diff basic -print -execdir "$TESTS/nonexistent" {} \; -print
+! bfs_diff basic -print -execdir "$TESTS/nonexistent" {} \; -print
diff --git a/tests/gnu/L_loops_continue.sh b/tests/gnu/L_loops_continue.sh
index d4c95f1..55aeb33 100644
--- a/tests/gnu/L_loops_continue.sh
+++ b/tests/gnu/L_loops_continue.sh
@@ -1 +1 @@
-check_exit $EX_BFS bfs_diff -L loops
+! bfs_diff -L loops
diff --git a/tests/gnu/printf_Y_error.sh b/tests/gnu/printf_Y_error.sh
index e9a2083..3aa816e 100644
--- a/tests/gnu/printf_Y_error.sh
+++ b/tests/gnu/printf_Y_error.sh
@@ -5,4 +5,4 @@ ln -s foo/bar scratch/bar
chmod -x scratch/foo
trap "chmod +x scratch/foo" EXIT
-check_exit $EX_BFS bfs_diff scratch -printf '(%p) (%l) %y %Y\n'
+! bfs_diff scratch -printf '(%p) (%l) %y %Y\n'
diff --git a/tests/posix/depth_error.sh b/tests/posix/depth_error.sh
index 15cc82d..e91fbf6 100644
--- a/tests/posix/depth_error.sh
+++ b/tests/posix/depth_error.sh
@@ -4,4 +4,4 @@ clean_scratch
chmod a-r scratch/foo
trap "chmod +r scratch/foo" EXIT
-check_exit $EX_BFS bfs_diff scratch -depth
+! bfs_diff scratch -depth
diff --git a/tests/posix/exec_nonexistent.sh b/tests/posix/exec_nonexistent.sh
index d4ad92a..901be86 100644
--- a/tests/posix/exec_nonexistent.sh
+++ b/tests/posix/exec_nonexistent.sh
@@ -4,4 +4,4 @@
! stderr=$(invoke_bfs basic -exec "$TESTS/nonexistent" {} \; 2>&1 >/dev/null)
[ -n "$stderr" ]
-check_exit $EX_BFS bfs_diff basic -print -exec "$TESTS/nonexistent" {} \; -print
+! bfs_diff basic -print -exec "$TESTS/nonexistent" {} \; -print
diff --git a/tests/posix/exec_plus_nonexistent.sh b/tests/posix/exec_plus_nonexistent.sh
index 6c9cb8c..6bddc67 100644
--- a/tests/posix/exec_plus_nonexistent.sh
+++ b/tests/posix/exec_plus_nonexistent.sh
@@ -1,4 +1,4 @@
! stderr=$(invoke_bfs basic -exec "$TESTS/nonexistent" {} + 2>&1 >/dev/null)
[ -n "$stderr" ]
-check_exit $EX_BFS bfs_diff basic -exec "$TESTS/nonexistent" {} + -print
+! bfs_diff basic -exec "$TESTS/nonexistent" {} + -print
diff --git a/tests/posix/exec_plus_status.sh b/tests/posix/exec_plus_status.sh
index f44062e..a814c4e 100644
--- a/tests/posix/exec_plus_status.sh
+++ b/tests/posix/exec_plus_status.sh
@@ -1,3 +1,3 @@
# -exec ... {} + should always return true, but if the command fails, bfs
# should exit with a non-zero status
-check_exit $EX_BFS bfs_diff basic -exec false {} + -print
+! bfs_diff basic -exec false {} + -print
diff --git a/tests/tests.sh b/tests/tests.sh
index 4a95fca..9bf9b8b 100755
--- a/tests/tests.sh
+++ b/tests/tests.sh
@@ -500,8 +500,6 @@ else
DIFF="diff"
fi
-# Return value when bfs fails
-EX_BFS=10
# Return value when a difference is detected
EX_DIFF=20
# Return value when a test is skipped
@@ -529,15 +527,10 @@ function bfs_diff() (
exec 3>&-
"${BFS[@]}" "$@" | sort >"$OUT"
- local STATUS="${PIPESTATUS[0]}"
+ local status="${PIPESTATUS[0]}"
- diff_output || return $EX_DIFF
-
- if [ "$STATUS" -eq 0 ]; then
- return 0
- else
- return $EX_BFS
- fi
+ diff_output || exit $EX_DIFF
+ return "$status"
)
function skip() {