]> git.ipfire.org Git - thirdparty/git.git/commit
test-lib: check for leak logs after every test
authorJeff King <peff@peff.net>
Tue, 24 Sep 2024 21:38:36 +0000 (17:38 -0400)
committerJunio C Hamano <gitster@pobox.com>
Wed, 25 Sep 2024 17:23:01 +0000 (10:23 -0700)
commitcf1464331b10bb6783243a31ab80a86ac6b2a485
treece2b025b6989e258bc5423e01eb25190844e507c
parent5fabf6e5ad28dab9c2c5944a9d4d4c5ab7720885
test-lib: check for leak logs after every test

If you are trying to find and fix leaks in a large test script, it can
be overwhelming to see the leak logs for every test at once. The
previous commit let you use "--immediate" to see the logs after the
first failing test, but this isn't always the first leak. As discussed
there, we may see leaks from previous tests that didn't happen to fail.

To catch those, let's check for any logs that appeared after each test
snippet is run, meaning that in a SANITIZE=leak build, any leak is an
immediate failure of the test snippet.

This check is mostly free in non-leak builds (just a "test -z"), and
only a few extra processes in a leak build, so I don't think the
overhead should matter (if it does, we could probably optimize for the
common "no logs" case without even spending a process).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/test-lib-functions.sh
t/test-lib.sh