Subject: Re: [PATCH 4/6] test-lib: simplify leak-log checking

From: Patrick Steinhardt <[email-masked]>
Date: Fri, 3 Jan 2025 13:05:45 +0100

On Wed, Jan 01, 2025 at 03:17:21PM -0500, Jeff King wrote:
> @@ -1181,8 +1170,14 @@ test_atexit_handler () {
>  }
>  
>  check_test_results_san_file_empty_ () {
> -	test -z "$TEST_RESULTS_SAN_FILE" ||
> -	test "$(nr_san_dir_leaks_)" = 0
> +	test -z "$TEST_RESULTS_SAN_FILE" && return 0
> +
> +	# stderr piped to /dev/null because the directory may have
> +	# been "rmdir"'d already.
> +	! find "$TEST_RESULTS_SAN_DIR" \
> +		-type f \
> +		-name "$TEST_RESULTS_SAN_FILE_PFX.*" 2>/dev/null |
> +	xargs grep -qv "Unable to get registers from thread"

Can't we use `-exec grep -qv "Unable to get registers from thread" {}
\+` instead of using xargs? Or is that unportable? Might make it a bit
easier to reason about the `!` in the presence of a pipe.

Patrick