[PATCH v2 0/4] add a test mode for SANITIZE=leak, run it in CI
- From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
- Date
- Jul 14, 2021, 17:23 UTC
- Message-ID
- <cover-0.4-0000000000-20210714T172251Z-avarab@gmail.com>
- In-Reply-To
- <cover-0.4-0000000000-20210714T001007Z-avarab@gmail.com>
As a follow-up to my recent thread asking if we had some test mode or CI to test for memory leak regression (we don't), add such a test mode, and run it in CI.
Currently the two new CI targets take ~2-3 minutes to run in GitHub CI, whereas the normal test targets take 20-30 minutes. The tests run slower, but we have a small whitelist of test scripts that are OK.
v2:
* Fixes issues spotted by Đoàn Trần Công Danh and Eric Sunshine, thanks both!
* I got rid of the change to t0500, I saw it being flaky in GitHub CI, and looks like there'll be other concurrent edits to that file, so leaving it be.
v1: http://lore.kernel.org/git/cover-0.4-0000000000-20210714T001007Z-avarab@gmail.com
Ævar Arnfjörð Bjarmason (4): tests: add a test mode for SANITIZE=leak, run it in CI SANITIZE tests: fix memory leaks in t13*config*, add to whitelist SANITIZE tests: fix memory leaks in t5701*, add to whitelist SANITIZE tests: fix leak in mailmap.c
.github/workflows/main.yml | 6 ++++ Makefile | 5 ++++ ci/install-dependencies.sh | 4 +-- ci/lib.sh | 18 +++++++---- ci/run-build-and-tests.sh | 4 +-- config.c | 17 +++++++---- mailmap.c | 2 ++ protocol-caps.c | 5 ++-- t/README | 16 ++++++++++ t/t1300-config.sh | 16 ++++++---- t/t4203-mailmap.sh | 6 ++++ t/t5701-git-serve.sh | 3 +- t/test-lib.sh | 61 ++++++++++++++++++++++++++++++++++++++ 13 files changed, 140 insertions(+), 23 deletions(-)
Range-diff against v1:
1: b7948c408d ! 1: 0795436a24 tests: add a test mode for SANITIZE=leak, run it in CI
@@ .github/workflows/main.yml: jobs:
+ cc: clang
+ pool: ubuntu-latest
+ - jobname: linux-gcc-sanitize-leak
-+ cc: clang
++ cc: gcc
+ pool: ubuntu-latest
env:
CC: ${{matrix.vector.cc}}
@@ ci/install-dependencies.sh: UBUNTU_COMMON_PKGS="make libssl-dev libcurl4-openssl
case "$jobname" in
-linux-clang|linux-gcc)
-+linux-clang*|linux-gcc*)
++linux-clang|linux-gcc|linux-clang-sanitize-leak|linux-gcc-sanitize-leak)
sudo apt-add-repository -y "ppa:ubuntu-toolchain-r/test"
sudo apt-get -q update
sudo apt-get -q -y install language-pack-is libsvn-perl apache2 \
$UBUNTU_COMMON_PKGS
case "$jobname" in
- linux-gcc)
-+ linux-gcc*)
++ linux-gcc|linux-gcc-sanitize-leak)
sudo apt-get -q -y install gcc-8
;;
esac
@@ ci/lib.sh: export GIT_TEST_CLONE_2GB=true
-linux-clang|linux-gcc)
- if [ "$jobname" = linux-gcc ]
- then
-+linux-clang*|linux-gcc*)
++linux-clang|linux-gcc|linux-clang-sanitize-leak|linux-gcc-sanitize-leak)
+ case "$jobname" in
-+ linux-gcc*)
++ linux-gcc|linux-gcc-sanitize-leak)
export CC=gcc-8
MAKEFLAGS="$MAKEFLAGS PYTHON_PATH=/usr/bin/python3"
- else
@@ ci/lib.sh: linux-musl)
esac
+case "$jobname" in
-+linux-*-sanitize-leak)
++linux-clang-sanitize-leak|linux-gcc-sanitize-leak)
+ export SANITIZE=leak
+ ;;
+esac
@@ ci/run-build-and-tests.sh: esac
make
case "$jobname" in
-linux-gcc)
-+linux-gcc*)
++linux-gcc|linux-gcc-sanitize-leak)
export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
make test
export GIT_TEST_SPLIT_INDEX=yes
@@ ci/run-build-and-tests.sh: linux-gcc)
make test
;;
-linux-clang)
-+linux-clang*)
++linux-clang|linux-clang-sanitize-leak)
export GIT_TEST_DEFAULT_HASH=sha1
make test
export GIT_TEST_DEFAULT_HASH=sha256
@@ t/README: GIT_TEST_CHECKOUT_WORKERS=<n> overrides the 'checkout.workers' setting
------------
- ## t/t0500-progress-display.sh ##
-@@
-
- test_description='progress display'
-
-+GIT_TEST_SANITIZE_LEAK=true
- . ./test-lib.sh
-
- show_cr () {
-@@ t/t0500-progress-display.sh: test_expect_success 'cover up after throughput shortens a lot' '
- test_cmp expect out
- '
-
--test_expect_success 'progress generates traces' '
-+test_expect_success !SANITIZE_LEAK 'progress generates traces' '
- cat >in <<-\EOF &&
- throughput 102400 1000
- update
-
## t/t5701-git-serve.sh ##
@@ t/t5701-git-serve.sh: test_expect_success 'unexpected lines are not allowed in fetch request' '
2: babcb1c289 = 2: 867e8e9a6c SANITIZE tests: fix memory leaks in t13*config*, add to whitelist
3: 11aa2f3bb5 = 3: b7fb5d5a56 SANITIZE tests: fix memory leaks in t5701*, add to whitelist
4: 7f4e433559 ! 4: ad8680f529 SANITIZE tests: fix leak in mailmap.c
@@ Commit message
mailmap_entry structure, we didn't free the structure itself. The same
goes for the "mailmap_info" structure.
+ Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
+
## mailmap.c ##
@@ mailmap.c: static void free_mailmap_info(void *p, const char *s)
s, debug_str(mi->name), debug_str(mi->email));-- 2.32.0.853.g5a570c9bf9