[PATCH v7 0/2] add a test mode for SANITIZE=leak, run it in CI

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

This v7 of the "test with SANITIZE=leak in CI" topic should be ready
for merging down. The v6 got marked as "Will merge to 'next'?", but as
Carlo points out[1] there were concurrent regresisons in
t0000-basic.sh that caused the tests to faile. There's proposed fixes
to those[2] as well as Carlo's own series to fix other issues with
it[3].

All of those are worth doing, but the reason I picked t0000-basic.sh
was that it would hopefully stay leak free through the
seen->next->master cycle.

Let's not pick that one, but instead a few of the very small and basic
tests in t00*.sh.

These all run cleanly on top of master, and also when merged with next
and seen (except for the semantic "seen" failure due to merging with
v6 of this topic, and therefore t0000-basic.sh being run in the test
mode).

For v6 of this topic see:
https://lore.kernel.org/git/cover-v6-0.2-00000000000-20210916T085311Z-avarab@xxxxxxxxx

1. https://lore.kernel.org/git/CAPUEsphMUNYRACmK-nksotP1RrMn09mNGFdEHLLuNEWH4AcU7Q@xxxxxxxxxxxxxx/
2. https://lore.kernel.org/git/pull.1092.git.git.1631972978.gitgitgadget@xxxxxxxxx/
3. https://lore.kernel.org/git/20210916023706.55760-1-carenas@xxxxxxxxx/

Æ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 ++++++++-
 ci/run-build-and-tests.sh  |  2 +-
 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 +++++++++++++++++++++
 15 files changed, 57 insertions(+), 4 deletions(-)

Range-diff against v6:
1:  fc7ba4cb1c3 = 1:  fc7ba4cb1c3 Makefile: add SANITIZE=leak flag to GIT-BUILD-OPTIONS
2:  8dcb1269881 ! 2:  56592952db5 tests: add a test mode for SANITIZE=leak, run it in CI
    @@ Commit message
         regression tests under that mode. Memory leaks have only been fixed as
         one-offs without structured regression testing.
     
    -    This change adds CI testing for it. We'll now build and test
    -    t000[04]*.sh under Linux with a new job called "linux-leaks".
    +    This change adds CI testing for it. We'll now build and small set of
    +    whitelisted t00*.sh tests under Linux with a new job called
    +    "linux-leaks".
     
         The CI target uses a new GIT_TEST_PASSING_SANITIZE_LEAK=true test
         mode. When running in that mode, we'll assert that we were compiled
    @@ t/README: excluded as so much relies on it, but this might change in the future.
      default to n.
      
     
    - ## t/t0000-basic.sh ##
    -@@ t/t0000-basic.sh: swapping compression and hashing order, the person who is making the
    - modification *should* take notice and update the test vectors here.
    - '
    + ## t/t0004-unwritable.sh ##
    +@@
    + 
    + test_description='detect unwritable repository and fail correctly'
      
     +TEST_PASSES_SANITIZE_LEAK=true
      . ./test-lib.sh
      
    - try_local_xy () {
    + test_expect_success setup '
     
    - ## t/t0004-unwritable.sh ##
    + ## t/t0011-hashmap.sh ##
     @@
    + #!/bin/sh
      
    - test_description='detect unwritable repository and fail correctly'
    + test_description='test hashmap and string hash functions'
    ++
    ++TEST_PASSES_SANITIZE_LEAK=true
    + . ./test-lib.sh
    + 
    + test_hashmap() {
    +
    + ## t/t0016-oidmap.sh ##
    +@@
    + #!/bin/sh
      
    + test_description='test oidmap'
    ++
     +TEST_PASSES_SANITIZE_LEAK=true
      . ./test-lib.sh
      
    - test_expect_success setup '
    + # This purposefully is very similar to t0011-hashmap.sh
    +
    + ## t/t0017-env-helper.sh ##
    +@@
    + 
    + test_description='test env--helper'
    + 
    ++TEST_PASSES_SANITIZE_LEAK=true
    + . ./test-lib.sh
    + 
    + 
    +
    + ## t/t0018-advice.sh ##
    +@@
    + 
    + test_description='Test advise_if_enabled functionality'
    + 
    ++TEST_PASSES_SANITIZE_LEAK=true
    + . ./test-lib.sh
    + 
    + test_expect_success 'advice should be printed when config variable is unset' '
    +
    + ## t/t0030-stripspace.sh ##
    +@@
    + 
    + test_description='git stripspace'
    + 
    ++TEST_PASSES_SANITIZE_LEAK=true
    + . ./test-lib.sh
    + 
    + t40='A quick brown fox jumps over the lazy do'
    +
    + ## t/t0063-string-list.sh ##
    +@@
    + 
    + test_description='Test string list functionality'
    + 
    ++TEST_PASSES_SANITIZE_LEAK=true
    + . ./test-lib.sh
    + 
    + test_split () {
    +
    + ## t/t0091-bugreport.sh ##
    +@@
    + 
    + test_description='git bugreport'
    + 
    ++TEST_PASSES_SANITIZE_LEAK=true
    + . ./test-lib.sh
    + 
    + # Headers "[System Info]" will be followed by a non-empty line if we put some
     
      ## t/test-lib.sh ##
     @@ t/test-lib.sh: then
-- 
2.33.0.1092.g44c994ea1be




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux