summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2018-03-18 11:30:05 -0400
committerTavian Barnes <tavianator@tavianator.com>2018-03-18 12:34:08 -0400
commitf1216d4f9448225e145438477b9b1c2556744d64 (patch)
treeb96d40c774223f7096b107d1650853bdeadb1448
parenta69b05c4d791892743db67bce91496fd6be39b50 (diff)
downloadbfs-f1216d4f9448225e145438477b9b1c2556744d64.tar.xz
tests: Don't use process substitution for diff
This frees up an extra FD for some diff implementations like openbox that need it when ulimit -n is low.
-rwxr-xr-xtests.sh25
1 files changed, 18 insertions, 7 deletions
diff --git a/tests.sh b/tests.sh
index f59ac84..31135ab 100755
--- a/tests.sh
+++ b/tests.sh
@@ -528,11 +528,17 @@ function bfs_diff() (
# substitution, even with low ulimit -n
exec 3>&-
- local OUT="$TESTS/${FUNCNAME[1]}.out"
+ local EXPECTED="$TESTS/${FUNCNAME[1]}.out"
if [ "$UPDATE" ]; then
- $BFS "$@" | bfs_sort >"$OUT"
+ local ACTUAL="$EXPECTED"
else
- diff -u "$OUT" <($BFS "$@" | bfs_sort)
+ local ACTUAL="$TMP/${FUNCNAME[1]}.out"
+ fi
+
+ $BFS "$@" | bfs_sort >"$ACTUAL"
+
+ if [ ! "$UPDATE" ]; then
+ diff -u "$EXPECTED" "$ACTUAL"
fi
)
@@ -1294,12 +1300,17 @@ function test_printf_leak() {
function test_printf_nul() {
# NUL byte regression test
- local OUT="$TESTS/${FUNCNAME[0]}.out"
- local ARGS=(basic -maxdepth 0 -printf '%h\0%f\n')
+ local EXPECTED="$TESTS/${FUNCNAME[0]}.out"
if [ "$UPDATE" ]; then
- invoke_bfs "${ARGS[@]}" >"$OUT"
+ local ACTUAL="$EXPECTED"
else
- diff -u "$OUT" <(invoke_bfs "${ARGS[@]}")
+ local ACTUAL="$TMP/${FUNCNAME[0]}.out"
+ fi
+
+ invoke_bfs basic -maxdepth 0 -printf '%h\0%f\n' >"$ACTUAL"
+
+ if [ ! "$UPDATE" ]; then
+ diff -u "$EXPECTED" "$ACTUAL"
fi
}