From dc80a3df205924903649209dd1e2050477559568 Mon Sep 17 00:00:00 2001 From: Alessio Marinelli Date: Fri, 17 Jul 2026 10:52:09 +0200 Subject: [PATCH] fix: use PIPESTATUS to capture correct exit code in collect() The collect() function used 'if "$@" 2>&1 | tee _log', which captures the exit status of 'tee' (always 0) instead of the tested script, due to how bash pipelines report $?. This caused every failing test to be recorded as SUCCESS in the final summary, regardless of its actual exit code. Confirmed with 11-sys-spark.sh: the script exits 1 explicitly after 'FAIL: Spark master not ready', but was still reported as 'SUCCESS ./11-sys-spark.sh' in the summary before this fix. Fixed by checking ${PIPESTATUS[0]} instead of the pipeline's own exit code. --- tests/all.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/all.sh b/tests/all.sh index b1457e7..dcd87a9 100755 --- a/tests/all.sh +++ b/tests/all.sh @@ -49,7 +49,8 @@ cd "$SCRIPT_DIR" rm -f _results _log FAILED=0 collect() { - if "$@" 2>&1 | tee _log + "$@" 2>&1 | tee _log + if [ ${PIPESTATUS[0]} -eq 0 ] then echo SUCCESS "$1" >> _results else