From f85b6ddaae06e3a67e92264c438fb2c634863148 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Wed, 30 Sep 2026 13:27:55 +0900 Subject: [PATCH] test: show name of failed test case (cherry picked from commit 4ef7744c2e275bf6dd4199623aa7959f9f6551c8) --- test/units/test-control.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/test/units/test-control.sh b/test/units/test-control.sh index a1f9de0f87..92cd0c31ed 100644 --- a/test/units/test-control.sh +++ b/test/units/test-control.sh @@ -201,7 +201,7 @@ run_subtests_with_signals_and_exit() { # Run all test cases (i.e. functions prefixed with testcase_ in the current namespace) run_testcases() { - local testcase testcases + local testcase testcases rc # Create a list of all functions prefixed with testcase_ mapfile -t testcases < <(declare -F | awk '$3 ~ /^testcase_/ {print $3;}') @@ -229,7 +229,14 @@ run_testcases() { # unexpectedly inherit a RETURN trap handler from the called # function and call it for the second time once we return, # causing a "double-free" - ("$testcase") + set +e + (set -e; "$testcase") + rc=$? + set -e + if [[ "$rc" -ne 0 ]]; then + echo "+++ $testcase FAILED +++" + exit 1 + fi : "+++ $testcase END +++" done }