aboutsummaryrefslogtreecommitdiffstats
path: root/t/test-lib.sh
diff options
context:
space:
mode:
Diffstat (limited to 't/test-lib.sh')
-rw-r--r--t/test-lib.sh54
1 files changed, 17 insertions, 37 deletions
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 54247604cb..b1a8ee5c00 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -322,7 +322,6 @@ TEST_RESULTS_SAN_FILE_PFX=trace
TEST_RESULTS_SAN_DIR_SFX=leak
TEST_RESULTS_SAN_FILE=
TEST_RESULTS_SAN_DIR="$TEST_RESULTS_DIR/$TEST_NAME.$TEST_RESULTS_SAN_DIR_SFX"
-TEST_RESULTS_SAN_DIR_NR_LEAKS_STARTUP=
TRASH_DIRECTORY="trash directory.$TEST_NAME$TEST_STRESS_JOB_SFX"
test -n "$root" && TRASH_DIRECTORY="$root/$TRASH_DIRECTORY"
case "$TRASH_DIRECTORY" in
@@ -848,6 +847,7 @@ test_failure_ () {
GIT_EXIT_OK=t
exit 0
fi
+ check_test_results_san_file_ "$test_failure"
_error_exit
fi
finalize_test_case_output failure "$failure_label" "$@"
@@ -1215,42 +1215,16 @@ test_atexit_handler () {
teardown_malloc_check
}
-sanitize_leak_log_message_ () {
- local new="$1" &&
- local old="$2" &&
- local file="$3" &&
-
- printf "With SANITIZE=leak at exit we have %d leak logs, but started with %d
-
-This means that we have a blindspot where git is leaking but we're
-losing the exit code somewhere, or not propagating it appropriately
-upwards!
-
-See the logs at \"%s.*\";
-those logs are reproduced below." \
- "$new" "$old" "$file"
+check_test_results_san_file_empty_ () {
+ test -z "$TEST_RESULTS_SAN_FILE" ||
+ test "$(nr_san_dir_leaks_)" = 0
}
check_test_results_san_file_ () {
- if test -z "$TEST_RESULTS_SAN_FILE"
- then
- return
- fi &&
- local old="$TEST_RESULTS_SAN_DIR_NR_LEAKS_STARTUP" &&
- local new="$(nr_san_dir_leaks_)" &&
-
- if test $new -le $old
+ if check_test_results_san_file_empty_
then
return
fi &&
- local out="$(sanitize_leak_log_message_ "$new" "$old" "$TEST_RESULTS_SAN_FILE")" &&
- say_color error "$out" &&
- if test "$old" != 0
- then
- echo &&
- say_color error "The logs include output from past runs to avoid" &&
- say_color error "that remove 'test-results' between runs."
- fi &&
say_color error "$(cat "$TEST_RESULTS_SAN_FILE".*)" &&
if test -n "$passes_sanitize_leak" && test "$test_failure" = 0
@@ -1558,8 +1532,16 @@ then
passes_sanitize_leak=t
fi
- if test "$GIT_TEST_PASSING_SANITIZE_LEAK" = "check"
+ if test "$GIT_TEST_PASSING_SANITIZE_LEAK" = "check" ||
+ test "$GIT_TEST_PASSING_SANITIZE_LEAK" = "check-failing"
then
+ if test "$GIT_TEST_PASSING_SANITIZE_LEAK" = "check-failing" &&
+ test -n "$passes_sanitize_leak"
+ then
+ skip_all="skipping leak-free $this_test under GIT_TEST_PASSING_SANITIZE_LEAK=check-failing"
+ test_done
+ fi
+
sanitize_leak_check=t
if test -n "$invert_exit_code"
then
@@ -1578,16 +1560,13 @@ then
test_done
fi
+ rm -rf "$TEST_RESULTS_SAN_DIR"
if ! mkdir -p "$TEST_RESULTS_SAN_DIR"
then
BAIL_OUT "cannot create $TEST_RESULTS_SAN_DIR"
fi &&
TEST_RESULTS_SAN_FILE="$TEST_RESULTS_SAN_DIR/$TEST_RESULTS_SAN_FILE_PFX"
- # In case "test-results" is left over from a previous
- # run: Only report if new leaks show up.
- TEST_RESULTS_SAN_DIR_NR_LEAKS_STARTUP=$(nr_san_dir_leaks_)
-
# Don't litter *.leak dirs if there was nothing to report
test_atexit "rmdir \"$TEST_RESULTS_SAN_DIR\" 2>/dev/null || :"
@@ -1597,6 +1576,7 @@ then
export LSAN_OPTIONS
elif test "$GIT_TEST_PASSING_SANITIZE_LEAK" = "check" ||
+ test "$GIT_TEST_PASSING_SANITIZE_LEAK" = "check-failing" ||
test_bool_env GIT_TEST_PASSING_SANITIZE_LEAK false
then
BAIL_OUT_ENV_NEEDS_SANITIZE_LEAK "GIT_TEST_PASSING_SANITIZE_LEAK=true"
@@ -1606,7 +1586,7 @@ if test "${GIT_TEST_CHAIN_LINT:-1}" != 0 &&
test "${GIT_TEST_EXT_CHAIN_LINT:-1}" != 0
then
"$PERL_PATH" "$TEST_DIRECTORY/chainlint.pl" "$0" ||
- BUG "lint error (see '?!...!? annotations above)"
+ BUG "lint error (see 'LINT' annotations above)"
fi
# Last-minute variable setup