git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 2/2] test-lib: fix GIT_TEST_SANITIZE_LEAK_LOG

From
Jeff King <peff@peff.net>
Date
Sep 15, 2023, 11:29 UTC
Message-ID
<20230915112906.GA3125427@coredump.intra.peff.net>
In-Reply-To
<2890b210-c42f-41cf-e676-0b1c56310f73@gmail.com>
On Fri, Sep 15, 2023 at 02:28:15AM +0200, Rubén Justo wrote:
Show 37 quoted lines
> > And the problem is in (3). You switch it to trigger only if we have no
> > failures (fixing the inversion). But should we have the same a/b split
> > for this case? I.e.:
> > 
> >   3a. if we saw no test failures, invert to cause a failure
> >   3b. we saw other failures; do not invert, but _do_ mention that the
> >       log found extra leaks
> > 
> > In 3b we are explaining to the user what happened. Though maybe it is
> > not super important, because I think we'd have dumped the log contents
> > anyway?
> 
> I think so too.  At that point we've already dumped the contents of the
> $TEST_RESULTS_SAN_FILE file.
> 
> IMO, when $test_failure is zero (the "if" I'm touching), the message
> makes sense not so much to say that a leak has been found, but rather
> because we're forcing the non-zero exit.
> 
> But when $test_failure is not zero, after we've already dumped the
> log, maybe this is somewhat redundant:
> 
> diff --git a/t/test-lib.sh b/t/test-lib.sh
> index 87cfea9e9a..b160ae3f7a 100644
> --- a/t/test-lib.sh
> +++ b/t/test-lib.sh
> @@ -1267,6 +1267,8 @@ check_test_results_san_file_ () {
>         then
>                 say "With GIT_TEST_SANITIZE_LEAK_LOG=true our logs revealed a memory leak, exit non-zero!" &&
>                 invert_exit_code=t
> +       else
> +               say "With GIT_TEST_SANITIZE_LEAK_LOG=true our logs revealed a memory leak"
>         fi
>  }
> 
> However, if you or anyone else thinks it adds value, I have no objection
> to re-roll with it.

I'm on the fence. It is probably not a big deal, and my biggest issue is just that I had to walk through the explanation in my previous mail to convince myself the change was not missing an important case.

But having done so, the main value in re-rolling would be preventing somebody else from reading the code and having the same question. But this discussion in the archive is probably sufficient.

-Peff
Previous: Rubén JustoNext: Junio C Hamano
Message 10 of 16 in “fix GIT_TEST_SANITIZE_LEAK_LOG=true”
  1. 0/2 fix GIT_TEST_SANITIZE_LEAK_LOG=trueRubén Justo, Sep 9, 2023
  2. 1/2 test-lib: prevent misuses of --invert-exit-codeRubén Justo, Sep 9, 2023
  3. Eric SunshineSep 10, 2023
  4. Rubén JustoSep 10, 2023
  5. Jeff KingSep 12, 2023
  6. Rubén JustoSep 15, 2023
  7. 2/2 test-lib: fix GIT_TEST_SANITIZE_LEAK_LOGRubén Justo, Sep 9, 2023
  8. Jeff KingSep 12, 2023
  9. Rubén JustoSep 15, 2023
  10. Jeff KingSep 15, 2023
  11. Junio C HamanoSep 15, 2023
  12. Jeff KingSep 16, 2023
  13. Junio C HamanoSep 15, 2023
  14. test-lib: fix GIT_TEST_SANITIZE_LEAK_LOGRubén Justo, Sep 22, 2023
  15. Jeff KingSep 23, 2023
  16. Rubén JustoSep 23, 2023

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.