Skip to content

Commit

Permalink
test-lib: check leak logs for presence of DEDUP_TOKEN
Browse files Browse the repository at this point in the history
When we check the leak logs, our original strategy was to check for any
non-empty log file produced by LSan. We later amended that to ignore
noisy lines in 370ef7e (test-lib: ignore uninteresting LSan output,
2023-08-28).

This makes it hard to ignore noise which is more than a single line;
we'd have to actually parse the file to determine the meaning of each
line.

But there's an easy line-oriented solution. Because we always pass the
dedup_token_length option, the output will contain a DEDUP_TOKEN line
for each leak that has been found. So if we invert our strategy to stop
ignoring useless lines and only look for useful ones, we can just count
the number of DEDUP_TOKEN lines. If it's non-zero, then we found at
least one leak (it would even give us a count of unique leaks, but we
really only care if it is non-zero).

This should yield the same outcome, but will help us build more false
positive detection on top.

Signed-off-by: Jeff King <[email protected]>
Signed-off-by: Junio C Hamano <[email protected]>
  • Loading branch information
peff authored and gitster committed Jan 1, 2025
1 parent 373a432 commit 6fb8cb3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion t/test-lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1177,7 +1177,7 @@ check_test_results_san_file_empty_ () {
! find "$TEST_RESULTS_SAN_DIR" \
-type f \
-name "$TEST_RESULTS_SAN_FILE_PFX.*" 2>/dev/null |
xargs grep -qv "Unable to get registers from thread"
xargs grep -q ^DEDUP_TOKEN
}

check_test_results_san_file_ () {
Expand Down

0 comments on commit 6fb8cb3

Please sign in to comment.