Skip to content

Commit 2640415

Browse files
committed
fixup! tests: introduce test_atexit
Turns out that there are problems with that approach that are totally not related to Azure Pipelines, so in order to focus on the latter, let's skip the test_atexit patches for now. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 4aea72c commit 2640415

File tree

3 files changed

+0
-51
lines changed

3 files changed

+0
-51
lines changed

t/t0000-basic.sh

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -825,24 +825,6 @@ test_expect_success 'tests clean up even on failures' "
825825
EOF
826826
"
827827

828-
test_expect_success 'test_atexit is run' "
829-
test_must_fail run_sub_test_lib_test \
830-
atexit-cleanup 'Run atexit commands' -i <<-\\EOF &&
831-
test_expect_success 'tests clean up even after a failure' '
832-
> ../../clean-atexit &&
833-
test_atexit rm ../../clean-atexit &&
834-
> ../../also-clean-atexit &&
835-
test_atexit rm ../../also-clean-atexit &&
836-
> ../../dont-clean-atexit &&
837-
(exit 1)
838-
'
839-
test_done
840-
EOF
841-
test_path_exists dont-clean-atexit &&
842-
test_path_is_missing clean-atexit &&
843-
test_path_is_missing also-clean-atexit
844-
"
845-
846828
test_expect_success 'test_oid setup' '
847829
test_oid_init
848830
'

t/test-lib-functions.sh

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -927,35 +927,6 @@ test_when_finished () {
927927
} && (exit \"\$eval_ret\"); eval_ret=\$?; $test_cleanup"
928928
}
929929

930-
# This function can be used to schedule some commands to be run
931-
# unconditionally at the end of the test script, e.g. to stop a daemon:
932-
#
933-
# test_expect_success 'test git daemon' '
934-
# git daemon &
935-
# daemon_pid=$! &&
936-
# test_atexit "kill $daemon_pid" &&
937-
# hello world
938-
# '
939-
940-
test_atexit () {
941-
# We cannot detect when we are in a subshell in general, but by
942-
# doing so on Bash is better than nothing (the test will
943-
# silently pass on other shells).
944-
test "${BASH_SUBSHELL-0}" = 0 ||
945-
error "bug in test script: test_atexit does nothing in a subshell"
946-
test_atexit_cleanup="{ $*
947-
} && (exit \"\$eval_ret\"); eval_ret=\$?; $test_atexit_cleanup"
948-
}
949-
950-
test_atexit_handler () {
951-
test : != "$test_atexit_cleanup" || return 0
952-
953-
setup_malloc_check
954-
test_eval_ "$test_atexit_cleanup"
955-
test_atexit_cleanup=:
956-
teardown_malloc_check
957-
}
958-
959930
# Most tests can use the created repository, but some may need to create more.
960931
# Usage: test_create_repo <directory>
961932
test_create_repo () {

t/test-lib.sh

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,6 @@ test_external_has_tap=0
481481

482482
die () {
483483
code=$?
484-
test_atexit_handler || code=$?
485484
if test -n "$GIT_EXIT_OK"
486485
then
487486
exit $code
@@ -931,12 +930,9 @@ write_junit_xml_testcase () {
931930
junit_have_testcase=t
932931
}
933932

934-
test_atexit_cleanup=:
935933
test_done () {
936934
GIT_EXIT_OK=t
937935

938-
test -n "$immediate" || test_atexit_handler
939-
940936
if test -n "$write_junit_xml" && test -n "$junit_xml_path"
941937
then
942938
test -n "$junit_have_testcase" || {

0 commit comments

Comments
 (0)