From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: git@vger.kernel.org
Cc: "Junio C Hamano" <gitster@pobox.com>,
"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Subject: [PATCH 0/6] tests: fix ignored & hidden exit codes
Date: Thu, 21 Jul 2022 08:51:37 +0200 [thread overview]
Message-ID: <cover-0.6-00000000000-20220721T064349Z-avarab@gmail.com> (raw)
A small set of fixes to correct git on the LHS of a pipe, and in $()
within a "test" expression, or where its exit code is otherwise
hidden.
This also includes a (reworded) version of a case where we exit'd out
of test-lib.sh itself, which Junio requested by spun off in:
https://lore.kernel.org/git/xmqqmtd33e1h.fsf@gitster.g/
As noted in [1] there's no need to rebase the other series on top of
this, it benefits from 6/6 here, but the two can proceed
independently.
This is still just the tip of the iceberg in terms of hidden exit
codes in the test suite, as can be seen with e.g.:
git grep 'test.*\$\((git|test-tool)' -- 't/*.sh'
But these are all cases I've run into actual issues with, almost all
when testing with SANITIZE=leak. In most cases just with one of the
hunks in a given commit, but then I converted the rest of the file to
fix a similar bad pattern.
That doesn't mean that these are more important than e.g. the output
of the "grep" above, but we've got to start somewhere...
The range-diff below is to the tip of [2], to show how 6/6 was
reworded.
1. https://lore.kernel.org/git/cover-v2-00.14-00000000000-20220720T211221Z-avarab@gmail.com/
2. https://lore.kernel.org/git/cover-00.10-00000000000-20220719T205710Z-avarab@gmail.com/
Ævar Arnfjörð Bjarmason (6):
diff tests: fix ignored exit codes in t4023
t/lib-patch-mode.sh: fix ignored "git" exit codes
auto-crlf tests: check "git checkout" exit code
test-lib-functions: add and use test_cmp_cmd
merge tests: don't ignore "rev-parse" exit code in helper
log tests: don't use "exit 1" outside a sub-shell
t/lib-patch-mode.sh | 13 ++++++---
t/t0027-auto-crlf.sh | 14 +++++++---
t/t0060-path-utils.sh | 45 +++++++++++++++++--------------
t/t4023-diff-rename-typechange.sh | 12 ++++-----
t/t4205-log-pretty-formats.sh | 2 +-
t/t7600-merge.sh | 9 +++----
t/test-lib-functions.sh | 18 +++++++++++++
7 files changed, 74 insertions(+), 39 deletions(-)
Range-diff:
-: ----------- > 1: f8a382841d5 diff tests: fix ignored exit codes in t4023
-: ----------- > 2: 85c6ab40e91 t/lib-patch-mode.sh: fix ignored "git" exit codes
-: ----------- > 3: cfc1abbf7e3 auto-crlf tests: check "git checkout" exit code
-: ----------- > 4: df1b674b8a7 test-lib-functions: add and use test_cmp_cmd
-: ----------- > 5: 563666f9426 merge tests: don't ignore "rev-parse" exit code in helper
1: 9cedf0cb0e2 ! 6: 259b4618fcb log tests: don't use "exit 1" outside a sub-shell
@@ Commit message
Using "exit 1" outside a sub-shell will cause the test framework
itself to exit on failure, which isn't what we want to do here.
- This issue was spotted with the new
- "GIT_TEST_PASSING_SANITIZE_LEAK=check" mode, i.e. that "git show"
- command leaks memory, and we'd thus "exit 1". Another implementation
- of "GIT_TEST_PASSING_SANITIZE_LEAK=check" or "--invert-exit-code"
- might have intercepted the "exit 1", and thus hidden the underlying
- issue here, but we correctly distinguish the two.
+ This issue was spotted with the in-flight
+ "GIT_TEST_PASSING_SANITIZE_LEAK=check" test mode[1]. This "git show"
+ invocation currently leaks memory, and we'd thus "exit 1". This change
+ was initially part of that topic[2] to demonstrate the correctness of
+ the "check" implementation.
+
+ 1. https://lore.kernel.org/git/patch-07.10-0961df2ab6c-20220719T205710Z-avarab@gmail.com/
+ 2. https://lore.kernel.org/git/patch-10.10-9cedf0cb0e2-20220719T205710Z-avarab@gmail.com/
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
--
2.37.1.1095.g64a1e8362fd
next reply other threads:[~2022-07-21 6:51 UTC|newest]
Thread overview: 83+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-21 6:51 Ævar Arnfjörð Bjarmason [this message]
2022-07-21 6:51 ` [PATCH 1/6] diff tests: fix ignored exit codes in t4023 Ævar Arnfjörð Bjarmason
2022-07-21 6:51 ` [PATCH 2/6] t/lib-patch-mode.sh: fix ignored "git" exit codes Ævar Arnfjörð Bjarmason
2022-07-21 6:51 ` [PATCH 3/6] auto-crlf tests: check "git checkout" exit code Ævar Arnfjörð Bjarmason
2022-07-21 6:51 ` [PATCH 4/6] test-lib-functions: add and use test_cmp_cmd Ævar Arnfjörð Bjarmason
2022-07-21 6:51 ` [PATCH 5/6] merge tests: don't ignore "rev-parse" exit code in helper Ævar Arnfjörð Bjarmason
2022-07-21 6:51 ` [PATCH 6/6] log tests: don't use "exit 1" outside a sub-shell Ævar Arnfjörð Bjarmason
2022-12-02 0:06 ` [PATCH v2 0/8] tests: fix ignored & hidden exit codes Ævar Arnfjörð Bjarmason
2022-12-02 0:06 ` [PATCH v2 1/8] log tests: don't use "exit 1" outside a sub-shell Ævar Arnfjörð Bjarmason
2022-12-02 1:02 ` Eric Sunshine
2022-12-02 1:48 ` Junio C Hamano
2022-12-02 2:45 ` Ævar Arnfjörð Bjarmason
2022-12-02 9:03 ` Eric Sunshine
2022-12-02 10:02 ` Ævar Arnfjörð Bjarmason
2022-12-07 6:09 ` Eric Sunshine
2022-12-02 3:24 ` Junio C Hamano
2022-12-02 0:06 ` [PATCH v2 2/8] auto-crlf tests: check "git checkout" exit code Ævar Arnfjörð Bjarmason
2022-12-02 1:02 ` René Scharfe
2022-12-02 1:10 ` Eric Sunshine
2022-12-02 5:59 ` Torsten Bögershausen
2022-12-02 6:03 ` Eric Sunshine
2022-12-02 0:06 ` [PATCH v2 3/8] diff tests: fix ignored exit codes in t4023 Ævar Arnfjörð Bjarmason
2022-12-02 2:02 ` Junio C Hamano
2022-12-02 0:06 ` [PATCH v2 4/8] test-lib-functions: add and use test_cmp_cmd Ævar Arnfjörð Bjarmason
2022-12-02 1:30 ` René Scharfe
2022-12-02 1:33 ` Eric Sunshine
2022-12-02 1:45 ` Eric Sunshine
2022-12-02 1:52 ` Eric Sunshine
2022-12-02 3:41 ` Junio C Hamano
2022-12-02 0:06 ` [PATCH v2 5/8] t/lib-patch-mode.sh: fix ignored "git" exit codes Ævar Arnfjörð Bjarmason
2022-12-02 1:31 ` René Scharfe
2022-12-02 0:06 ` [PATCH v2 6/8] merge tests: don't ignore "rev-parse" exit code in helper Ævar Arnfjörð Bjarmason
2022-12-02 1:41 ` René Scharfe
2022-12-02 0:06 ` [PATCH v2 7/8] tests: use "test_cmp_cmd" instead of "test" in sub-shells Ævar Arnfjörð Bjarmason
2022-12-02 0:06 ` [PATCH v2 8/8] tests: use "test_cmp_cmd" in misc tests Ævar Arnfjörð Bjarmason
2022-12-02 2:19 ` Junio C Hamano
2022-12-02 11:52 ` [PATCH v3 0/8] tests: fix ignored & hidden exit codes Ævar Arnfjörð Bjarmason
2022-12-02 11:52 ` [PATCH v3 1/8] merge tests: don't ignore "rev-parse" exit code in helper Ævar Arnfjörð Bjarmason
2022-12-05 0:24 ` Junio C Hamano
2022-12-02 11:52 ` [PATCH v3 2/8] auto-crlf tests: don't lose exit code in loops and outside tests Ævar Arnfjörð Bjarmason
2022-12-02 15:59 ` René Scharfe
2022-12-02 11:52 ` [PATCH v3 3/8] diff tests: fix ignored exit codes in t4023 Ævar Arnfjörð Bjarmason
2022-12-05 0:26 ` Junio C Hamano
2022-12-02 11:52 ` [PATCH v3 4/8] t/lib-patch-mode.sh: fix ignored exit codes Ævar Arnfjörð Bjarmason
2022-12-02 15:59 ` René Scharfe
2022-12-04 0:45 ` Eric Sunshine
2022-12-02 11:52 ` [PATCH v3 5/8] tests: use "test_cmp" instead of "test" in sub-shells Ævar Arnfjörð Bjarmason
2022-12-05 0:39 ` Junio C Hamano
2022-12-02 11:52 ` [PATCH v3 6/8] tests: don't lose 'test <str> = $(cmd ...)"' exit code Ævar Arnfjörð Bjarmason
2022-12-02 11:52 ` [PATCH v3 7/8] tests: don't lose "git" exit codes in "! ( git ... | grep )" Ævar Arnfjörð Bjarmason
2022-12-02 18:31 ` René Scharfe
2022-12-02 11:52 ` [PATCH v3 8/8] tests: don't lose mist "git" exit codes Ævar Arnfjörð Bjarmason
2022-12-04 0:40 ` Eric Sunshine
2022-12-05 0:45 ` Junio C Hamano
2022-12-19 10:19 ` [PATCH v4 0/6] tests: fix ignored & hidden " Ævar Arnfjörð Bjarmason
2022-12-19 10:19 ` [PATCH v4 1/6] auto-crlf tests: don't lose exit code in loops and outside tests Ævar Arnfjörð Bjarmason
2022-12-19 12:07 ` René Scharfe
2022-12-19 10:19 ` [PATCH v4 2/6] t/lib-patch-mode.sh: fix ignored exit codes Ævar Arnfjörð Bjarmason
2022-12-20 0:09 ` Junio C Hamano
2022-12-27 16:40 ` Phillip Wood
2022-12-27 18:14 ` Ævar Arnfjörð Bjarmason
2022-12-19 10:19 ` [PATCH v4 3/6] tests: don't lose exit status with "(cd ...; test <op> $(git ...))" Ævar Arnfjörð Bjarmason
2022-12-20 0:20 ` Junio C Hamano
2022-12-19 10:19 ` [PATCH v4 4/6] tests: don't lose exit status with "test <op> $(git ...)" Ævar Arnfjörð Bjarmason
2022-12-26 1:14 ` Junio C Hamano
2022-12-19 10:19 ` [PATCH v4 5/6] tests: don't lose "git" exit codes in "! ( git ... | grep )" Ævar Arnfjörð Bjarmason
2022-12-26 1:18 ` Junio C Hamano
2022-12-27 16:44 ` Phillip Wood
2022-12-27 17:13 ` Phillip Wood
2022-12-27 23:16 ` Junio C Hamano
2022-12-19 10:19 ` [PATCH v4 6/6] tests: don't lose misc "git" exit codes Ævar Arnfjörð Bjarmason
2022-12-27 16:46 ` Phillip Wood
2022-12-27 18:18 ` Ævar Arnfjörð Bjarmason
2022-12-27 23:17 ` Junio C Hamano
2022-12-20 0:06 ` [PATCH v4 0/6] tests: fix ignored & hidden " Junio C Hamano
2023-02-06 22:44 ` [PATCH v5 " Ævar Arnfjörð Bjarmason
2023-02-06 22:44 ` [PATCH v5 1/6] auto-crlf tests: don't lose exit code in loops and outside tests Ævar Arnfjörð Bjarmason
2023-02-06 22:44 ` [PATCH v5 2/6] t/lib-patch-mode.sh: fix ignored exit codes Ævar Arnfjörð Bjarmason
2023-02-06 22:44 ` [PATCH v5 3/6] tests: don't lose exit status with "(cd ...; test <op> $(git ...))" Ævar Arnfjörð Bjarmason
2023-02-06 22:44 ` [PATCH v5 4/6] tests: don't lose exit status with "test <op> $(git ...)" Ævar Arnfjörð Bjarmason
2023-02-06 22:44 ` [PATCH v5 5/6] tests: don't lose "git" exit codes in "! ( git ... | grep )" Ævar Arnfjörð Bjarmason
2023-02-06 22:44 ` [PATCH v5 6/6] tests: don't lose misc "git" exit codes Ævar Arnfjörð Bjarmason
2023-02-06 23:33 ` [PATCH v5 0/6] tests: fix ignored & hidden " Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cover-0.6-00000000000-20220721T064349Z-avarab@gmail.com \
--to=avarab@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).