Merge branch 'jk/lsan-race-ignore-false-positive'

The code to check LSan results has been simplified and made more
robust.

* jk/lsan-race-ignore-false-positive:
  test-lib: add a few comments to LSan log checking
  test-lib: simplify lsan results check
  test-lib: invert return value of check_test_results_san_file_empty
This commit is contained in:
Junio C Hamano
2025-01-21 08:44:52 -08:00
2 changed files with 10 additions and 10 deletions

View File

@@ -927,7 +927,7 @@ test_expect_success () {
test -n "$test_skip_test_preamble" || test -n "$test_skip_test_preamble" ||
say >&3 "expecting success of $TEST_NUMBER.$test_count '$1': $test_body" say >&3 "expecting success of $TEST_NUMBER.$test_count '$1': $test_body"
if test_run_ "$test_body" && if test_run_ "$test_body" &&
check_test_results_san_file_empty_ ! check_test_results_san_file_has_entries_
then then
test_ok_ "$1" test_ok_ "$1"
else else

View File

@@ -1169,20 +1169,20 @@ test_atexit_handler () {
teardown_malloc_check teardown_malloc_check
} }
check_test_results_san_file_empty_ () { check_test_results_san_file_has_entries_ () {
test -z "$TEST_RESULTS_SAN_FILE" && return 0 test -z "$TEST_RESULTS_SAN_FILE" && return 1
# stderr piped to /dev/null because the directory may have # Lines marked with DEDUP_TOKEN show unique leaks. We only care that we
# been "rmdir"'d already. # found at least one.
! find "$TEST_RESULTS_SAN_DIR" \ #
-type f \ # But also suppress any false positives caused by bugs or races in the
-name "$TEST_RESULTS_SAN_FILE_PFX.*" 2>/dev/null | # sanitizer itself.
xargs grep ^DEDUP_TOKEN | grep -s ^DEDUP_TOKEN "$TEST_RESULTS_SAN_FILE".* |
grep -qv sanitizer::GetThreadStackTopAndBottom grep -qv sanitizer::GetThreadStackTopAndBottom
} }
check_test_results_san_file_ () { check_test_results_san_file_ () {
if check_test_results_san_file_empty_ if ! check_test_results_san_file_has_entries_
then then
return return
fi && fi &&