test: show name of failed test case
(cherry picked from commit 4ef7744c2e275bf6dd4199623aa7959f9f6551c8)
This commit is contained in:
committed by
Luca Boccassi
parent
6f2b2f4df0
commit
f85b6ddaae
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user