From: "Rubén Justo" <rjusto@gmail.com>
To: Jeff King <peff@peff.net>
Cc: "Git List" <git@vger.kernel.org>,
"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Subject: Re: [PATCH 1/2] test-lib: prevent misuses of --invert-exit-code
Date: Fri, 15 Sep 2023 02:10:12 +0200 [thread overview]
Message-ID: <0d0e903f-aa3e-964d-7935-ceaae04a413e@gmail.com> (raw)
In-Reply-To: <20230912083528.GC1630538@coredump.intra.peff.net>
On 12-sep-2023 04:35:28, Jeff King wrote:
> On Sun, Sep 10, 2023 at 01:08:11AM +0200, Rubén Justo wrote:
>
> > GIT_TEST_PASSING_SANITIZE_LEAK=true and GIT_TEST_SANITIZE_LEAK_LOG=true
> > use internnlly the --invert-exit-code machinery. Therefore if the user
> > wants to use --invert-exit-code in combination with them, the result
> > will be confusing.
> >
> > For the same reason, we are already using BAIL_OUT if the user tries to
> > combine GIT_TEST_PASSING_SANITIZE_LEAK=check with --invert-exit-code.
> >
> > Let's do the same for GIT_TEST_PASSING_SANITIZE_LEAK=true and
> > GIT_TEST_SANITIZE_LEAK_LOG=true.
>
> OK, so we are trying to find a case where the user is triggering
> --invert-exit-code themselves and complaining. But in the code...
>
> > @@ -1557,15 +1557,25 @@ then
> > say "in GIT_TEST_PASSING_SANITIZE_LEAK=check mode, setting --invert-exit-code for TEST_PASSES_SANITIZE_LEAK != true"
> > invert_exit_code=t
> > fi
> > - elif test -z "$passes_sanitize_leak" &&
> > - test_bool_env GIT_TEST_PASSING_SANITIZE_LEAK false
> > + elif test_bool_env GIT_TEST_PASSING_SANITIZE_LEAK false
> > then
> > - skip_all="skipping $this_test under GIT_TEST_PASSING_SANITIZE_LEAK=true"
> > - test_done
> > + if test -n "$invert_exit_code"
> > + then
> > + BAIL_OUT "cannot use --invert-exit-code under GIT_TEST_PASSING_SANITIZE_LEAK=true"
> > + elif test -z "$passes_sanitize_leak"
> > + then
> > + skip_all="skipping $this_test under GIT_TEST_PASSING_SANITIZE_LEAK=true"
> > + test_done
> > + fi
> > fi
>
> You can see at the top of the context that we will set
> invert_exit_code=t ourselves, which will then complain here:
>
> > if test_bool_env GIT_TEST_SANITIZE_LEAK_LOG false
> > then
> > + if test -n "$invert_exit_code"
> > + then
> > + BAIL_OUT "cannot use --invert-exit-code and GIT_TEST_SANITIZE_LEAK_LOG=true"
> > + fi
> > +
> > if ! mkdir -p "$TEST_RESULTS_SAN_DIR"
> > then
> > BAIL_OUT "cannot create $TEST_RESULTS_SAN_DIR"
>
> That varible-set in the earlier context is from running in "check" mode.
> So:
>
> make GIT_TEST_PASSING_SANITIZE_LEAK=check GIT_TEST_SANITIZE_LEAK_LOG=true
>
> will now always fail. But this is the main way you'd want to run it
> (enabling the leak log catches more stuff, and the log-check function
> you touch in patch 2 already covers check mode).
>
> So I think you'd have to hoist your check above the if/else for setting
> up PASSING_SANITIZE_LEAK modes.
Arrg, sorry. You're right.
This was part of the series by mistake. Please, discard it.
In my tree, I have a previous commit with:
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 87cfea9e9a..46b8a76e9c 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -1556,7 +1556,6 @@ then
if test -z "$passes_sanitize_leak"
then
say "in GIT_TEST_PASSING_SANITIZE_LEAK=check mode, setting --invert-exit-code for TEST_PASSES_SANITIZE_LEAK != true"
- invert_exit_code=t
fi
elif test_bool_env GIT_TEST_PASSING_SANITIZE_LEAK false
then
that is part of an unsent attempt to make:
$ make SANITIZE=leak T=t7510-signed-commit.sh GIT_TEST_PASSING_SANITIZE_LEAK=check test
not to suggest, when GPG is missing, that t7510-signed-commit.sh is a
candidate to be marked as leak-free. Which is distracting to me.
However I was not satisfied with the solution and discarded it. But
unfortunately not entirely. Sorry.
>
> -Peff
next prev parent reply other threads:[~2023-09-15 0:10 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-09 23:03 [PATCH 0/2] fix GIT_TEST_SANITIZE_LEAK_LOG=true Rubén Justo
2023-09-09 23:08 ` [PATCH 1/2] test-lib: prevent misuses of --invert-exit-code Rubén Justo
2023-09-10 1:59 ` Eric Sunshine
2023-09-10 22:58 ` Rubén Justo
2023-09-12 8:35 ` Jeff King
2023-09-15 0:10 ` Rubén Justo [this message]
2023-09-09 23:09 ` [PATCH 2/2] test-lib: fix GIT_TEST_SANITIZE_LEAK_LOG Rubén Justo
2023-09-12 8:27 ` Jeff King
2023-09-15 0:28 ` Rubén Justo
2023-09-15 11:29 ` Jeff King
2023-09-15 17:51 ` Junio C Hamano
2023-09-16 5:32 ` Jeff King
2023-09-15 17:49 ` Junio C Hamano
2023-09-22 20:38 ` [PATCH v2] " Rubén Justo
2023-09-23 6:24 ` Jeff King
2023-09-23 8:11 ` Rubén Justo
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0d0e903f-aa3e-964d-7935-ceaae04a413e@gmail.com \
--to=rjusto@gmail.com \
--cc=avarab@gmail.com \
--cc=git@vger.kernel.org \
--cc=peff@peff.net \
/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.
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 NNTP newsgroup(s).