This series adds a small beachhead of tests we run in CI that we assert to be memory-leak free with the SANITIZE=leak test mode. Once it lands the intent is to expand the parts of the test suite we whitelist as memory-leak free. For the v7 see: https://lore.kernel.org/git/cover-v7-0.2-00000000000-20210919T075619Z-avarab@xxxxxxxxx/ This v8 fixes a test failure that happened in combination with the sg/test-split-index-fix topic, which just unearthed an old GIT_TEST_SPLIT_INDEX=true memory leak. Carlo Marcelo Arenas Belón had a fixup for it (that's currently applied to the v7) here: https://lore.kernel.org/git/20210922111741.82142-1-carenas@xxxxxxxxx/ I acked it in https://lore.kernel.org/git/87h7ec59m7.fsf@xxxxxxxxxxxxxxxxxxx/; but on second thought I think this is a better solution for the reasons noted in the updated commit message. Ævar Arnfjörð Bjarmason (2): Makefile: add SANITIZE=leak flag to GIT-BUILD-OPTIONS tests: add a test mode for SANITIZE=leak, run it in CI .github/workflows/main.yml | 3 +++ Makefile | 5 +++++ ci/install-dependencies.sh | 2 +- ci/lib.sh | 9 ++++++++- t/README | 7 +++++++ t/t0004-unwritable.sh | 3 ++- t/t0011-hashmap.sh | 2 ++ t/t0016-oidmap.sh | 2 ++ t/t0017-env-helper.sh | 1 + t/t0018-advice.sh | 1 + t/t0030-stripspace.sh | 1 + t/t0063-string-list.sh | 1 + t/t0091-bugreport.sh | 1 + t/test-lib.sh | 21 +++++++++++++++++++++ 14 files changed, 56 insertions(+), 3 deletions(-) Range-diff against v7: 1: fc7ba4cb1c3 = 1: c68a7108dc4 Makefile: add SANITIZE=leak flag to GIT-BUILD-OPTIONS 2: 56592952db5 ! 2: 90ecd49c910 tests: add a test mode for SANITIZE=leak, run it in CI @@ Commit message The intent is to add more TEST_PASSES_SANITIZE_LEAK=true annotations as follow-up change, but let's start small to begin with. + In ci/run-build-and-tests.sh we make use of the default "*" case to + run "make test" without any GIT_TEST_* modes. SANITIZE=leak is known + to fail in combination with GIT_TEST_SPLIT_INDEX=true in + t0016-oidmap.sh, and we're likely to have other such failures in + various GIT_TEST_* modes. Let's focus on getting the base tests + passing, we can expand coverage to GIT_TEST_* modes later. + It would also be possible to implement a more lightweight version of this by only relying on setting "LSAN_OPTIONS". See <YS9OT/pn5rRK9cGB@xxxxxxxxxxxxxxxxxxxxxxx>[1] and @@ ci/lib.sh: linux-musl) + MAKEFLAGS="$MAKEFLAGS CC=${CC:-cc}" - ## ci/run-build-and-tests.sh ## -@@ ci/run-build-and-tests.sh: fi - - make - case "$jobname" in --linux-gcc) -+linux-gcc|linux-leaks) - export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main - make test - export GIT_TEST_SPLIT_INDEX=yes - ## t/README ## @@ t/README: excluded as so much relies on it, but this might change in the future. GIT_TEST_SPLIT_INDEX=<boolean> forces split-index mode on the whole -- 2.33.0.1228.gdc65525c655