git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Rubén Justo" <rjusto@gmail.com>
Cc: Git List <git@vger.kernel.org>,  Jeff King <peff@peff.net>,
	 Eric Sunshine <sunshine@sunshineco.com>
Subject: Re: [PATCH] test-lib: fix GIT_TEST_SANITIZE_LEAK_LOG
Date: Mon, 01 Jul 2024 13:19:34 -0700	[thread overview]
Message-ID: <xmqqv81ovp9l.fsf@gitster.g> (raw)
In-Reply-To: <f4ae6e2a-218a-419c-b6c4-59a08be247a0@gmail.com> ("Rubén Justo"'s message of "Sun, 30 Jun 2024 08:42:06 +0200")

Rubén Justo <rjusto@gmail.com> writes:

> In the if-else's chain we have in "check_test_results_san_file_", we
> consider three variables: $passes_sanitize_leak, $sanitize_leak_check
> and, implicitly, GIT_TEST_SANITIZE_LEAK_LOG (always set to "true" at
> that point).

Before this paragraph, we'd probably want to say what problem we are
fixing.  Using the verb "fix" on the subject line without saying what
broken behaviour you see around GIT_TEST_SANITIZE_LEAK_LOG does not
help, either.

Your patch from September 2023 [*] did mention it upfront:

    GIT_TEST_SANITIZE_LEAK_LOG=true with a test that leaks, will
    make the test return zero unintentionally.

With that inserted in front of the proposed log message, the
resulting explanation looks reasonable to me.

> diff --git a/t/test-lib.sh b/t/test-lib.sh
> index 79d3e0e7d9..7ed6d3fc47 100644
> --- a/t/test-lib.sh
> +++ b/t/test-lib.sh
> @@ -1269,9 +1269,12 @@ check_test_results_san_file_ () {
>  	then
>  		say "As TEST_PASSES_SANITIZE_LEAK=true isn't set the above leak is 'ok' with GIT_TEST_PASSING_SANITIZE_LEAK=check" &&
>  		invert_exit_code=t
> -	else
> +	elif test "$test_failure" = 0
> +	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
>  }

This is outside the scope of this patch simply because it is
inherited from the original, but does ", exit non-zero!"  part of
the message really add any value?  I am wondering if

	else
-		say "With GIT_TEST_SANITIZE_LEAK_LOG=true ..., exit non-zero!"
+		say "With GIT_TEST_SANITIZE_LEAK_LOG=true our logs revealed a leak."
+		test "$test_failure" != 0 || invert_exit_code=t
	fi

might be what we eventually want to end up with, after the dust
settles from this fix.

Thanks.

  parent reply	other threads:[~2024-07-01 20:19 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-30  6:42 [PATCH] test-lib: fix GIT_TEST_SANITIZE_LEAK_LOG Rubén Justo
2024-07-01  3:49 ` Jeff King
2024-07-01 19:29   ` Junio C Hamano
2024-07-01 20:19 ` Junio C Hamano [this message]
2024-07-03 21:35   ` Rubén Justo
2024-07-03 21:44     ` Rubén Justo
2024-07-06  6:18       ` Jeff King
2024-07-06 11:20         ` Rubén Justo
2024-07-06 23:13           ` Jeff King

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=xmqqv81ovp9l.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    --cc=rjusto@gmail.com \
    --cc=sunshine@sunshineco.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.
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).