aboutsummaryrefslogtreecommitdiffstats
path: root/t/test-lib.sh
diff options
context:
space:
mode:
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>2021-10-14 02:47:28 +0200
committerJunio C Hamano <gitster@pobox.com>2021-10-14 09:54:54 -0700
commit8583bf75591398fff3c0ef44eb59cd23b4565298 (patch)
tree3ee2c7564ccd05bebd79aaf1421f4350f3cfd2f0 /t/test-lib.sh
parent2bd2f258f4195ac54293a3f45b86457c0bd5fc11 (diff)
downloadgit-8583bf75591398fff3c0ef44eb59cd23b4565298.tar.gz
test-lib.sh: de-duplicate error() teardown code
De-duplicate the "finalize_junit_xml; GIT_EXIT_OK=t; exit 1" code shared between the "error()" and "--immediate on failure" code paths, in preparation for adding a third user in a subsequent commit. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/test-lib.sh')
-rw-r--r--t/test-lib.sh10
1 files changed, 7 insertions, 3 deletions
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 8361b5c1c5..c610f09ddb 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -589,13 +589,17 @@ USER_TERM="$TERM"
TERM=dumb
export TERM USER_TERM
-error () {
- say_color error "error: $*"
+_error_exit () {
finalize_junit_xml
GIT_EXIT_OK=t
exit 1
}
+error () {
+ say_color error "error: $*"
+ _error_exit
+}
+
BUG () {
error >&7 "bug in the test script: $*"
}
@@ -720,7 +724,7 @@ test_failure_ () {
say_color error "not ok $test_count - $1"
shift
printf '%s\n' "$*" | sed -e 's/^/# /'
- test "$immediate" = "" || { finalize_junit_xml; GIT_EXIT_OK=t; exit 1; }
+ test "$immediate" = "" || _error_exit
}
test_known_broken_ok_ () {