From 86b8254144d48c992cf7e33882cfdc56aaeddbe7 Mon Sep 17 00:00:00 2001 From: Rubén Justo Date: Mon, 29 Jan 2024 22:08:27 +0100 Subject: t5332: mark as leak-free MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This test is leak-free since it was added in af626ac0e0 (pack-bitmap: enable reuse from all bitmapped packs, 2023-12-14). Let's mark it as leak-free to make sure it stays that way (and to reduce noise when looking for other leak-free scripts after we fix some leaks). Signed-off-by: Rubén Justo Signed-off-by: Junio C Hamano --- t/t5332-multi-pack-reuse.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/t/t5332-multi-pack-reuse.sh b/t/t5332-multi-pack-reuse.sh index 2ba788b042..99145327a6 100755 --- a/t/t5332-multi-pack-reuse.sh +++ b/t/t5332-multi-pack-reuse.sh @@ -2,6 +2,7 @@ test_description='pack-objects multi-pack reuse' +TEST_PASSES_SANITIZE_LEAK=true . ./test-lib.sh . "$TEST_DIRECTORY"/lib-bitmap.sh -- cgit 1.2.3-korg From 90a694a27e8e32ec1e6f61cb8e556f92cadbb35c Mon Sep 17 00:00:00 2001 From: Rubén Justo Date: Mon, 29 Jan 2024 22:08:34 +0100 Subject: t6113: mark as leak-free MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This test does not leak since a96015a517 (pack-bitmap: plug leak in find_objects(), 2023-12-14) when the annotation TEST_PASSES_SANITIZE_LEAK=true was also added. Unfortunately it was added after test-lib.sh is sourced, which makes GIT_TEST_PASSING_SANITIZE_LEAK=check error: $ make SANITIZE=leak GIT_TEST_PASSING_SANITIZE_LEAK=check test T=t6113-rev-list-bitmap-filters.sh ... make[2]: Entering directory '/tmp/git/git/t' *** t6113-rev-list-bitmap-filters.sh *** in GIT_TEST_PASSING_SANITIZE_LEAK=check mode, setting --invert-exit-code for TEST_PASSES_SANITIZE_LEAK != true ok 1 - set up bitmapped repo ok 2 - filters fallback to non-bitmap traversal ok 3 - blob:none filter ok 4 - blob:none filter with specified blob ok 5 - blob:limit filter ok 6 - blob:limit filter with specified blob ok 7 - tree:0 filter ok 8 - tree:0 filter with specified blob, tree ok 9 - tree:1 filter ok 10 - object:type filter ok 11 - object:type filter with --filter-provided-objects ok 12 - combine filter ok 13 - combine filter with --filter-provided-objects ok 14 - bitmap traversal with --unpacked # passed all 14 test(s) 1..14 # faking up non-zero exit with --invert-exit-code make[2]: *** [Makefile:68: t6113-rev-list-bitmap-filters.sh] Error 1 make[2]: Leaving directory '/tmp/git/git/t' make[1]: *** [Makefile:55: test] Error 2 make[1]: Leaving directory '/tmp/git/git/t' make: *** [Makefile:3212: test] Error 2 Let's move the annotation before sourcing test-lib.sh, to make GIT_TEST_PASSING_SANITIZE_LEAK=check happy. Signed-off-by: Rubén Justo Signed-off-by: Junio C Hamano --- t/t6113-rev-list-bitmap-filters.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/t/t6113-rev-list-bitmap-filters.sh b/t/t6113-rev-list-bitmap-filters.sh index 459f0d7412..a9656a1ec8 100755 --- a/t/t6113-rev-list-bitmap-filters.sh +++ b/t/t6113-rev-list-bitmap-filters.sh @@ -1,10 +1,11 @@ #!/bin/sh test_description='rev-list combining bitmaps and filters' + +TEST_PASSES_SANITIZE_LEAK=true . ./test-lib.sh . "$TEST_DIRECTORY"/lib-bitmap.sh -TEST_PASSES_SANITIZE_LEAK=true test_expect_success 'set up bitmapped repo' ' # one commit will have bitmaps, the other will not -- cgit 1.2.3-korg From 92e209be78a18e1b36bd0f07d9b99e1790df407c Mon Sep 17 00:00:00 2001 From: Rubén Justo Date: Mon, 29 Jan 2024 22:08:38 +0100 Subject: test-lib: check for TEST_PASSES_SANITIZE_LEAK MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit TEST_PASSES_SANITIZE_LEAK must be set before sourcing test-lib.sh, as we say in t/README: GIT_TEST_PASSING_SANITIZE_LEAK=true skips those tests that haven't declared themselves as leak-free by setting "TEST_PASSES_SANITIZE_LEAK=true" before sourcing "test-lib.sh". This test mode is used by the "linux-leaks" CI target. GIT_TEST_PASSING_SANITIZE_LEAK=check checks that our "TEST_PASSES_SANITIZE_LEAK=true" markings are current. Rather than skipping those tests that haven't set "TEST_PASSES_SANITIZE_LEAK=true" before sourcing "test-lib.sh" this mode runs them with "--invert-exit-code". This is used to check that there's a one-to-one mapping between "TEST_PASSES_SANITIZE_LEAK=true" and those tests that pass under "SANITIZE=leak". This is especially useful when testing a series that fixes various memory leaks with "git rebase -x". In a recent commit we fixed a test where it was set after sourcing test-lib.sh, leading to confusing results. To prevent future oversights, let's add a simple check to ensure the value for TEST_PASSES_SANITIZE_LEAK remains unchanged at test_done(). Signed-off-by: Rubén Justo Signed-off-by: Junio C Hamano --- t/test-lib.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/t/test-lib.sh b/t/test-lib.sh index fc93aa57e6..042f557a6f 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -1297,6 +1297,11 @@ test_done () { EOF fi + if test -z "$passes_sanitize_leak" && test_bool_env TEST_PASSES_SANITIZE_LEAK false + then + BAIL_OUT "Please, set TEST_PASSES_SANITIZE_LEAK before sourcing test-lib.sh" + fi + if test "$test_fixed" != 0 then say_color error "# $test_fixed known breakage(s) vanished; please update test(s)" -- cgit 1.2.3-korg From 03f72a4ed8b0d9f379db80749150a13b3ad1f2cd Mon Sep 17 00:00:00 2001 From: Rubén Justo Date: Mon, 29 Jan 2024 22:08:23 +0100 Subject: t0080: mark as leak-free MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This test is leak-free since it was added in e137fe3b29 (unit tests: add TAP unit test framework, 2023-11-09) Let's mark it as leak-free to make sure it stays that way (and to reduce noise when looking for other leak-free scripts after we fix some leaks). Signed-off-by: Rubén Justo Signed-off-by: Junio C Hamano --- t/t0080-unit-test-output.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/t/t0080-unit-test-output.sh b/t/t0080-unit-test-output.sh index 961b54b06c..6657c114a3 100755 --- a/t/t0080-unit-test-output.sh +++ b/t/t0080-unit-test-output.sh @@ -2,6 +2,7 @@ test_description='Test the output of the unit test framework' +TEST_PASSES_SANITIZE_LEAK=true . ./test-lib.sh test_expect_success 'TAP output from unit tests' ' -- cgit 1.2.3-korg