@@ -322,7 +322,6 @@ TEST_RESULTS_SAN_FILE_PFX=trace
322
322
TEST_RESULTS_SAN_DIR_SFX=leak
323
323
TEST_RESULTS_SAN_FILE=
324
324
TEST_RESULTS_SAN_DIR=" $TEST_RESULTS_DIR /$TEST_NAME .$TEST_RESULTS_SAN_DIR_SFX "
325
- TEST_RESULTS_SAN_DIR_NR_LEAKS_STARTUP=
326
325
TRASH_DIRECTORY=" trash directory.$TEST_NAME$TEST_STRESS_JOB_SFX "
327
326
test -n " $root " && TRASH_DIRECTORY=" $root /$TRASH_DIRECTORY "
328
327
case " $TRASH_DIRECTORY " in
@@ -848,6 +847,7 @@ test_failure_ () {
848
847
GIT_EXIT_OK=t
849
848
exit 0
850
849
fi
850
+ check_test_results_san_file_ " $test_failure "
851
851
_error_exit
852
852
fi
853
853
finalize_test_case_output failure " $failure_label " " $@ "
@@ -1215,42 +1215,16 @@ test_atexit_handler () {
1215
1215
teardown_malloc_check
1216
1216
}
1217
1217
1218
- sanitize_leak_log_message_ () {
1219
- local new=" $1 " &&
1220
- local old=" $2 " &&
1221
- local file=" $3 " &&
1222
-
1223
- printf " With SANITIZE=leak at exit we have %d leak logs, but started with %d
1224
-
1225
- This means that we have a blindspot where git is leaking but we're
1226
- losing the exit code somewhere, or not propagating it appropriately
1227
- upwards!
1228
-
1229
- See the logs at \" %s.*\" ;
1230
- those logs are reproduced below." \
1231
- " $new " " $old " " $file "
1218
+ check_test_results_san_file_empty_ () {
1219
+ test -z " $TEST_RESULTS_SAN_FILE " ||
1220
+ test " $( nr_san_dir_leaks_) " = 0
1232
1221
}
1233
1222
1234
1223
check_test_results_san_file_ () {
1235
- if test -z " $TEST_RESULTS_SAN_FILE "
1224
+ if check_test_results_san_file_empty_
1236
1225
then
1237
1226
return
1238
1227
fi &&
1239
- local old=" $TEST_RESULTS_SAN_DIR_NR_LEAKS_STARTUP " &&
1240
- local new=" $( nr_san_dir_leaks_) " &&
1241
-
1242
- if test $new -le $old
1243
- then
1244
- return
1245
- fi &&
1246
- local out=" $( sanitize_leak_log_message_ " $new " " $old " " $TEST_RESULTS_SAN_FILE " ) " &&
1247
- say_color error " $out " &&
1248
- if test " $old " ! = 0
1249
- then
1250
- echo &&
1251
- say_color error " The logs include output from past runs to avoid" &&
1252
- say_color error " that remove 'test-results' between runs."
1253
- fi &&
1254
1228
say_color error " $( cat " $TEST_RESULTS_SAN_FILE " .* ) " &&
1255
1229
1256
1230
if test -n " $passes_sanitize_leak " && test " $test_failure " = 0
@@ -1586,16 +1560,13 @@ then
1586
1560
test_done
1587
1561
fi
1588
1562
1563
+ rm -rf " $TEST_RESULTS_SAN_DIR "
1589
1564
if ! mkdir -p " $TEST_RESULTS_SAN_DIR "
1590
1565
then
1591
1566
BAIL_OUT " cannot create $TEST_RESULTS_SAN_DIR "
1592
1567
fi &&
1593
1568
TEST_RESULTS_SAN_FILE=" $TEST_RESULTS_SAN_DIR /$TEST_RESULTS_SAN_FILE_PFX "
1594
1569
1595
- # In case "test-results" is left over from a previous
1596
- # run: Only report if new leaks show up.
1597
- TEST_RESULTS_SAN_DIR_NR_LEAKS_STARTUP=$( nr_san_dir_leaks_)
1598
-
1599
1570
# Don't litter *.leak dirs if there was nothing to report
1600
1571
test_atexit " rmdir \" $TEST_RESULTS_SAN_DIR \" 2>/dev/null || :"
1601
1572
0 commit comments