From a4299f9bc1d3e60a7e628561e8d650c2a241e1c2 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Mon, 14 Nov 2022 10:50:34 -0500 Subject: [WIP] Simplistic conversion from find syntax to fd --- tests/tests.sh | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'tests') diff --git a/tests/tests.sh b/tests/tests.sh index 8d13aca..762687e 100755 --- a/tests/tests.sh +++ b/tests/tests.sh @@ -253,7 +253,7 @@ XTOUCH="$BIN/tests/xtouch" # Try to resolve the path to $BFS before we cd, while also supporting # --bfs="./bin/bfs -S ids" -read -a BFS <<<"${BFS:-$BIN/bfs}" +read -a BFS <<<"${BFS:-$BIN/find2fd}" BFS[0]=$(_realpath "$(command -v "${BFS[0]}")") # The temporary directory that will hold our test data @@ -480,6 +480,7 @@ function bfs_verbose() { } function invoke_bfs() { + skip bfs_verbose "$@" "${BFS[@]}" "$@" } @@ -526,15 +527,19 @@ function diff_output() { fi } -function bfs_diff() ( +function bfs_diff() { bfs_verbose "$@" - # Close the dup()'d stdout to make sure we have enough fd's for the process - # substitution, even with low ulimit -n - exec 3>&- + FD=$("${BFS[@]}" "$@") + if [ "$?" -ne 0 ]; then + skip + fi - "${BFS[@]}" "$@" | sort >"$OUT" + eval "$FD" | sed 's|/$||' | sort >"$OUT" local STATUS="${PIPESTATUS[0]}" + if [ "$STATUS" -ne 0 ]; then + skip + fi diff_output || return $EX_DIFF @@ -543,7 +548,7 @@ function bfs_diff() ( else return $EX_BFS fi -) +} function skip() { exit $EX_SKIP -- cgit v1.2.3