From f1216d4f9448225e145438477b9b1c2556744d64 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Sun, 18 Mar 2018 11:30:05 -0400 Subject: 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. --- tests.sh | 25 ++++++++++++++++++------- 1 file 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 } -- cgit v1.2.3