Skip to content

Commit c246447

Browse files
gitsterdscho
authored andcommitted
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 Signed-off-by: Johannes Schindelin <[email protected]>
2 parents 5e8e988 + 5afd244 commit c246447

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

t/test-lib-functions.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -927,7 +927,7 @@ test_expect_success () {
927927
test -n "$test_skip_test_preamble" ||
928928
say >&3 "expecting success of $TEST_NUMBER.$test_count '$1': $test_body"
929929
if test_run_ "$test_body" &&
930-
check_test_results_san_file_empty_
930+
! check_test_results_san_file_has_entries_
931931
then
932932
test_ok_ "$1"
933933
else

t/test-lib.sh

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1169,20 +1169,20 @@ test_atexit_handler () {
11691169
teardown_malloc_check
11701170
}
11711171

1172-
check_test_results_san_file_empty_ () {
1173-
test -z "$TEST_RESULTS_SAN_FILE" && return 0
1174-
1175-
# stderr piped to /dev/null because the directory may have
1176-
# been "rmdir"'d already.
1177-
! find "$TEST_RESULTS_SAN_DIR" \
1178-
-type f \
1179-
-name "$TEST_RESULTS_SAN_FILE_PFX.*" 2>/dev/null |
1180-
xargs grep ^DEDUP_TOKEN |
1172+
check_test_results_san_file_has_entries_ () {
1173+
test -z "$TEST_RESULTS_SAN_FILE" && return 1
1174+
1175+
# Lines marked with DEDUP_TOKEN show unique leaks. We only care that we
1176+
# found at least one.
1177+
#
1178+
# But also suppress any false positives caused by bugs or races in the
1179+
# sanitizer itself.
1180+
grep -s ^DEDUP_TOKEN "$TEST_RESULTS_SAN_FILE".* |
11811181
grep -qv sanitizer::GetThreadStackTopAndBottom
11821182
}
11831183

11841184
check_test_results_san_file_ () {
1185-
if check_test_results_san_file_empty_
1185+
if ! check_test_results_san_file_has_entries_
11861186
then
11871187
return
11881188
fi &&

0 commit comments

Comments
 (0)