Subject: Re: [PATCH 4/4] test-lib: check for TEST_PASSES_SANITIZE_LEAK

From: Junio C Hamano <[email-masked]>
Date: Mon, 29 Jan 2024 14:25:48 -0800

Rubén Justo <[email-masked]> writes:

> In a recent commit we fixed a test where it was set after sourcing
> test-lib.sh, leading to confusing results.

OK, the reference is to the previous step.  Makes sense.

>
> To prevent future oversights, let's add a simple check to ensure the
> value for TEST_PASSES_SANITIZE_LEAK remains unchanged at test_done().
>
> Signed-off-by: Rubén Justo <[email-masked]>
> ---
>  t/test-lib.sh | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/t/test-lib.sh b/t/test-lib.sh
> index fc93aa57e6..042f557a6f 100644
> --- a/t/test-lib.sh
> +++ b/t/test-lib.sh
> @@ -1297,6 +1297,11 @@ test_done () {
>  		EOF
>  	fi
>  
> +	if test -z "$passes_sanitize_leak" && test_bool_env TEST_PASSES_SANITIZE_LEAK false
> +	then
> +		BAIL_OUT "Please, set TEST_PASSES_SANITIZE_LEAK before sourcing test-lib.sh"
> +	fi
> +
>  	if test "$test_fixed" != 0
>  	then
>  		say_color error "# $test_fixed known breakage(s) vanished; please update test(s)"