test: show name of failed test case

(cherry picked from commit 4ef7744c2e275bf6dd4199623aa7959f9f6551c8)
This commit is contained in:
Yu Watanabe
2026-10-16 11:36:33 +01:00
committed by Luca Boccassi
parent 6f2b2f4df0
commit f85b6ddaae
+9 -2
View File
@@ -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
}