]> git.ipfire.org Git - thirdparty/git.git/commitdiff
test-lib: check leak logs for presence of DEDUP_TOKEN
authorJeff King <peff@peff.net>
Wed, 1 Jan 2025 20:18:28 +0000 (15:18 -0500)
committerJunio C Hamano <gitster@pobox.com>
Wed, 1 Jan 2025 22:17:05 +0000 (14:17 -0800)
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 370ef7e40d (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 <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/test-lib.sh

index 23eb26bfbe9c1b2bf14e3e66e042bace5b189163..c9487d080518f5583357459c3829a11e3c034c1b 100644 (file)
@@ -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_ () {