diff mbox series

[01/20] t: mark a bunch of tests as leak-free

Message ID 0e9fa9ca7386f527903887242008b5b0443ada69.1716465556.git.ps@pks.im (mailing list archive)
State Superseded
Headers show
Series Various memory leak fixes | expand

Commit Message

Patrick Steinhardt May 23, 2024, 12:25 p.m. UTC
There are a bunch of tests which do not have any leaks:

  - t0411: Introduced via 5c5a4a1c05 (t0411: add tests for cloning from
    partial repo, 2024-01-28), passes since its inception.

  - t0610: Introduced via 57db2a094d (refs: introduce reftable backend,
    2024-02-07), passes since its inception.

  - t2405: Passes since 6741e917de (repository: avoid leaking
    `fsmonitor` data, 2024-04-12).

  - t4153: Passes since 71c7916053 (apply: plug a leak in apply_data,
    2024-04-23).

  - t7006: Passes since at least Git v2.40. I did not care to go back
    any further than that.

  - t7423: Introduced via b20c10fd9b (t7423: add tests for symlinked
    submodule directories, 2024-01-28), passes since e8d0608944
    (submodule: require the submodule path to contain directories only,
    2024-03-26). The fix is not ovbiously related, but probably works
    because we now die early in many code paths.

  - t9xxx: All of these are exercising CVS-related tooling and pass
    since at least Git v2.40. It's likely that these pass for a long
    time already, but nobody ever noticed because noone has CVS on their
    machine.

Mark all of these tests as passing.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 t/t0411-clone-from-partial.sh      | 1 +
 t/t0610-reftable-basics.sh         | 1 +
 t/t2405-worktree-submodule.sh      | 1 +
 t/t4153-am-resume-override-opts.sh | 1 +
 t/t7006-pager.sh                   | 1 +
 t/t7423-submodule-symlinks.sh      | 1 +
 t/t9200-git-cvsexportcommit.sh     | 1 +
 t/t9401-git-cvsserver-crlf.sh      | 1 +
 t/t9600-cvsimport.sh               | 1 +
 t/t9601-cvsimport-vendor-branch.sh | 1 +
 t/t9602-cvsimport-branches-tags.sh | 1 +
 t/t9603-cvsimport-patchsets.sh     | 2 ++
 t/t9604-cvsimport-timestamps.sh    | 2 ++
 13 files changed, 15 insertions(+)

Comments

Junio C Hamano May 23, 2024, 5:44 p.m. UTC | #1
Patrick Steinhardt <ps@pks.im> writes:

>   - t4153: Passes since 71c7916053 (apply: plug a leak in apply_data,
>     2024-04-23).
>
>   - t7006: Passes since at least Git v2.40. I did not care to go back
>     any further than that.

Since the base commit you chose to apply this step to (which is
unknown to me) and the tip of 'master' today 4365c6fc (The sixth
batch, 2024-05-20), we must have reintroduced more leaks.

$ SANITIZE=leak GIT_TEST_PASSING_SANITIZE_LEAK=true \
  Meta/Make -j16 --test=4153,7006 test

dies with

    Test Summary Report
    -------------------
    t4153-am-resume-override-opts.sh (Wstat: 256 (exited 1) Tests: 5 Failed: 1)
      Failed test:  2
      Non-zero exit status: 1
    t7006-pager.sh                  (Wstat: 256 (exited 1) Tests: 109 Failed: 6)
      Failed tests:  14, 70-74
      Non-zero exit status: 1

Here, Meta/Make is a thin wrapper around "make", I primarily use it
for its --test=only,these,tests feature, which is an opposite of
GIT_SKIP_TESTS. (Meta/ is a separate checkout of the 'todo' branch
of this project, that keeps things like whats-cooking.txt and
miscellaneous tools I use to manage the project).
Patrick Steinhardt May 24, 2024, 6:56 a.m. UTC | #2
On Thu, May 23, 2024 at 10:44:22AM -0700, Junio C Hamano wrote:
> Patrick Steinhardt <ps@pks.im> writes:
> 
> >   - t4153: Passes since 71c7916053 (apply: plug a leak in apply_data,
> >     2024-04-23).
> >
> >   - t7006: Passes since at least Git v2.40. I did not care to go back
> >     any further than that.
> 
> Since the base commit you chose to apply this step to (which is
> unknown to me) and the tip of 'master' today 4365c6fc (The sixth
> batch, 2024-05-20), we must have reintroduced more leaks.
> 
> $ SANITIZE=leak GIT_TEST_PASSING_SANITIZE_LEAK=true \
>   Meta/Make -j16 --test=4153,7006 test
> 
> dies with
> 
>     Test Summary Report
>     -------------------
>     t4153-am-resume-override-opts.sh (Wstat: 256 (exited 1) Tests: 5 Failed: 1)
>       Failed test:  2
>       Non-zero exit status: 1
>     t7006-pager.sh                  (Wstat: 256 (exited 1) Tests: 109 Failed: 6)
>       Failed tests:  14, 70-74
>       Non-zero exit status: 1
> 
> Here, Meta/Make is a thin wrapper around "make", I primarily use it
> for its --test=only,these,tests feature, which is an opposite of
> GIT_SKIP_TESTS. (Meta/ is a separate checkout of the 'todo' branch
> of this project, that keeps things like whats-cooking.txt and
> miscellaneous tools I use to manage the project).

Hum. Both of these skip a bunch of tests due to a missing TTY prereq on
my system. So I guess it's not a regression, just me missing test
coverage. And seemingly, the same applies to our CI systems because the
pipeline is green there.

And indeed, the TTY prerequisite fails due a totally unrelated error:

    Can't locate IO/Pty.pm in @INC

I'll fix this locally and in our CI setup. Ideally, we'd also make this
thing more robust going forward, but I'll leave that for a future
iteraiton.

Patrick
Junio C Hamano May 24, 2024, 4:05 p.m. UTC | #3
Patrick Steinhardt <ps@pks.im> writes:

> Hum. Both of these skip a bunch of tests due to a missing TTY prereq on
> my system. So I guess it's not a regression, just me missing test
> coverage. And seemingly, the same applies to our CI systems because the
> pipeline is green there.
>
> And indeed, the TTY prerequisite fails due a totally unrelated error:
>
>     Can't locate IO/Pty.pm in @INC
>
> I'll fix this locally and in our CI setup.

Do you mean that you'll make IO::Pty available locally and in the CI
setup, which will start revealing the existing leaks in these tests?

So do we expect this step to be adjusted, not to mark these two
tests as leak-free (yet)?

> Ideally, we'd also make this thing more robust going forward, but
> I'll leave that for a future iteraiton.

--- >8 ---
Subject: ci: make IO::Pty available

When t/test-terminal.perl, which requires IO::Pty (and File::Copy,
but that comes standard with perl-modules?), does not work, the
tests with TTY prerequisite are skipped.

Make sure it is available in the CI environment.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 ci/install-dependencies.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git c/ci/install-dependencies.sh w/ci/install-dependencies.sh
index 2e7688ae8b..b24c91a30f 100755
--- c/ci/install-dependencies.sh
+++ w/ci/install-dependencies.sh
@@ -42,7 +42,7 @@ ubuntu-*)
 		language-pack-is libsvn-perl apache2 cvs cvsps git gnupg subversion \
 		make libssl-dev libcurl4-openssl-dev libexpat-dev wget sudo default-jre \
 		tcl tk gettext zlib1g-dev perl-modules liberror-perl libauthen-sasl-perl \
-		libemail-valid-perl libio-socket-ssl-perl libnet-smtp-ssl-perl libdbd-sqlite3-perl libcgi-pm-perl \
+		libemail-valid-perl libio-socket-ssl-perl libnet-smtp-ssl-perl libdbd-sqlite3-perl libcgi-pm-perl libio-pty-perl \
 		${CC_PACKAGE:-${CC:-gcc}} $PYTHON_PACKAGE
 
 	mkdir --parents "$CUSTOM_PATH"
Junio C Hamano May 24, 2024, 5:53 p.m. UTC | #4
Junio C Hamano <gitster@pobox.com> writes:

> --- >8 ---
> Subject: ci: make IO::Pty available
>
> When t/test-terminal.perl, which requires IO::Pty (and File::Copy,
> but that comes standard with perl-modules?), does not work, the
> tests with TTY prerequisite are skipped.

... please ignore this, of course ;-) Your latest iteration does the
right thing on this one, and unmarks the two that are not yet ready.

Thanks.
karthik nayak May 24, 2024, 8:34 p.m. UTC | #5
Patrick Steinhardt <ps@pks.im> writes:

> There are a bunch of tests which do not have any leaks:
>
>   - t0411: Introduced via 5c5a4a1c05 (t0411: add tests for cloning from
>     partial repo, 2024-01-28), passes since its inception.
>
>   - t0610: Introduced via 57db2a094d (refs: introduce reftable backend,
>     2024-02-07), passes since its inception.
>
>   - t2405: Passes since 6741e917de (repository: avoid leaking
>     `fsmonitor` data, 2024-04-12).
>
>   - t4153: Passes since 71c7916053 (apply: plug a leak in apply_data,
>     2024-04-23).
>
>   - t7006: Passes since at least Git v2.40. I did not care to go back
>     any further than that.
>
>   - t7423: Introduced via b20c10fd9b (t7423: add tests for symlinked
>     submodule directories, 2024-01-28), passes since e8d0608944
>     (submodule: require the submodule path to contain directories only,
>     2024-03-26). The fix is not ovbiously related, but probably works

s/ovbiously/obviously

>     because we now die early in many code paths.
>
>   - t9xxx: All of these are exercising CVS-related tooling and pass
>     since at least Git v2.40. It's likely that these pass for a long
>     time already, but nobody ever noticed because noone has CVS on their

s/noone/no one

>     machine.
>
> Mark all of these tests as passing.
>

[snip]
diff mbox series

Patch

diff --git a/t/t0411-clone-from-partial.sh b/t/t0411-clone-from-partial.sh
index c98d501869..932bf2067d 100755
--- a/t/t0411-clone-from-partial.sh
+++ b/t/t0411-clone-from-partial.sh
@@ -2,6 +2,7 @@ 
 
 test_description='check that local clone does not fetch from promisor remotes'
 
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
 test_expect_success 'create evil repo' '
diff --git a/t/t0610-reftable-basics.sh b/t/t0610-reftable-basics.sh
index cc5bbfd732..b06c46999d 100755
--- a/t/t0610-reftable-basics.sh
+++ b/t/t0610-reftable-basics.sh
@@ -10,6 +10,7 @@  export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 GIT_TEST_DEFAULT_REF_FORMAT=reftable
 export GIT_TEST_DEFAULT_REF_FORMAT
 
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
 INVALID_OID=$(test_oid 001)
diff --git a/t/t2405-worktree-submodule.sh b/t/t2405-worktree-submodule.sh
index 11018f37c7..1d7f605633 100755
--- a/t/t2405-worktree-submodule.sh
+++ b/t/t2405-worktree-submodule.sh
@@ -5,6 +5,7 @@  test_description='Combination of submodules and multiple worktrees'
 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
 base_path=$(pwd -P)
diff --git a/t/t4153-am-resume-override-opts.sh b/t/t4153-am-resume-override-opts.sh
index 4add7c7757..6bc377b917 100755
--- a/t/t4153-am-resume-override-opts.sh
+++ b/t/t4153-am-resume-override-opts.sh
@@ -2,6 +2,7 @@ 
 
 test_description='git-am command-line options override saved options'
 
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 . "$TEST_DIRECTORY"/lib-terminal.sh
 
diff --git a/t/t7006-pager.sh b/t/t7006-pager.sh
index e56ca5b0fa..60e4c90de1 100755
--- a/t/t7006-pager.sh
+++ b/t/t7006-pager.sh
@@ -2,6 +2,7 @@ 
 
 test_description='Test automatic use of a pager.'
 
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 . "$TEST_DIRECTORY"/lib-pager.sh
 . "$TEST_DIRECTORY"/lib-terminal.sh
diff --git a/t/t7423-submodule-symlinks.sh b/t/t7423-submodule-symlinks.sh
index 3d3c7af3ce..f45d806201 100755
--- a/t/t7423-submodule-symlinks.sh
+++ b/t/t7423-submodule-symlinks.sh
@@ -2,6 +2,7 @@ 
 
 test_description='check that submodule operations do not follow symlinks'
 
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
 test_expect_success 'prepare' '
diff --git a/t/t9200-git-cvsexportcommit.sh b/t/t9200-git-cvsexportcommit.sh
index a44eabf0d8..3d4842164c 100755
--- a/t/t9200-git-cvsexportcommit.sh
+++ b/t/t9200-git-cvsexportcommit.sh
@@ -4,6 +4,7 @@ 
 #
 test_description='Test export of commits to CVS'
 
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
 if ! test_have_prereq PERL; then
diff --git a/t/t9401-git-cvsserver-crlf.sh b/t/t9401-git-cvsserver-crlf.sh
index a34805acdc..a67e6abd49 100755
--- a/t/t9401-git-cvsserver-crlf.sh
+++ b/t/t9401-git-cvsserver-crlf.sh
@@ -12,6 +12,7 @@  repository using cvs CLI client via git-cvsserver server'
 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
 marked_as () {
diff --git a/t/t9600-cvsimport.sh b/t/t9600-cvsimport.sh
index 5680849218..41fcf3606b 100755
--- a/t/t9600-cvsimport.sh
+++ b/t/t9600-cvsimport.sh
@@ -4,6 +4,7 @@  test_description='git cvsimport basic tests'
 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 
+TEST_PASSES_SANITIZE_LEAK=true
 . ./lib-cvs.sh
 
 if ! test_have_prereq NOT_ROOT; then
diff --git a/t/t9601-cvsimport-vendor-branch.sh b/t/t9601-cvsimport-vendor-branch.sh
index 116cddba3a..e007669495 100755
--- a/t/t9601-cvsimport-vendor-branch.sh
+++ b/t/t9601-cvsimport-vendor-branch.sh
@@ -35,6 +35,7 @@  test_description='git cvsimport handling of vendor branches'
 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 
+TEST_PASSES_SANITIZE_LEAK=true
 . ./lib-cvs.sh
 
 setup_cvs_test_repository t9601
diff --git a/t/t9602-cvsimport-branches-tags.sh b/t/t9602-cvsimport-branches-tags.sh
index e5266c9a87..3768e3bd8c 100755
--- a/t/t9602-cvsimport-branches-tags.sh
+++ b/t/t9602-cvsimport-branches-tags.sh
@@ -7,6 +7,7 @@  test_description='git cvsimport handling of branches and tags'
 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
 
+TEST_PASSES_SANITIZE_LEAK=true
 . ./lib-cvs.sh
 
 setup_cvs_test_repository t9602
diff --git a/t/t9603-cvsimport-patchsets.sh b/t/t9603-cvsimport-patchsets.sh
index 19f38f78f2..2a387fdbaa 100755
--- a/t/t9603-cvsimport-patchsets.sh
+++ b/t/t9603-cvsimport-patchsets.sh
@@ -12,6 +12,8 @@ 
 # bug.
 
 test_description='git cvsimport testing for correct patchset estimation'
+
+TEST_PASSES_SANITIZE_LEAK=true
 . ./lib-cvs.sh
 
 setup_cvs_test_repository t9603
diff --git a/t/t9604-cvsimport-timestamps.sh b/t/t9604-cvsimport-timestamps.sh
index 2d03259729..9cf0685d56 100755
--- a/t/t9604-cvsimport-timestamps.sh
+++ b/t/t9604-cvsimport-timestamps.sh
@@ -1,6 +1,8 @@ 
 #!/bin/sh
 
 test_description='git cvsimport timestamps'
+
+TEST_PASSES_SANITIZE_LEAK=true
 . ./lib-cvs.sh
 
 test_lazy_prereq POSIX_TIMEZONE '