]> git.ipfire.org Git - thirdparty/git.git/commit
test-lib: check for TEST_PASSES_SANITIZE_LEAK
authorRubén Justo <rjusto@gmail.com>
Mon, 29 Jan 2024 21:08:38 +0000 (22:08 +0100)
committerJunio C Hamano <gitster@pobox.com>
Mon, 29 Jan 2024 22:21:53 +0000 (14:21 -0800)
commit92e209be78a18e1b36bd0f07d9b99e1790df407c
tree2ac0c6c6d7d9604b1c722736efbde3683a4d262b
parent90a694a27e8e32ec1e6f61cb8e556f92cadbb35c
test-lib: check for TEST_PASSES_SANITIZE_LEAK

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 <rjusto@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/test-lib.sh