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

Re: [PATCH 2/2] test-lib.sh: use "Bail out!" syntax on bad SANITIZE=leak use

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 14, 2021, 16:39 UTC
Message-ID
<xmqqsfx3d0i3.fsf@gitster.g>
In-Reply-To
<patch-2.2-6fd2a64bcfa-20211014T004542Z-avarab@gmail.com>
Show 11 quoted lines
> +BAIL_OUT () {
> +	test $# -ne 1 && BUG "1 param"
> +
> +	# Do not change "Bail out! " string. It's part of TAP syntax:
> +	# https://testanything.org/tap-specification.html
> +	local bail_out="Bail out! "
> +	local message="$1"
> +
> +	say_color error $bail_out "$message"
> +	_error_exit
> +}

This looks like a good addition that can be used in similar cases later. I'd assume that "Bail out!" early of a test sequence will mark the test suite as a failure as a whole, but I wonder if there is a similar "early abort" mechanism that would cause a success? In some tests we do

	if .. some condition ..
	then
		test_done ;# because we cannot test the remainder
	fi
        .. more tests ...
and I've always thought the "done" an ugly hack.
But that has nothing to do with the value of this change.
Thanks.
Previous: Ævar Arnfjörð BjarmasonNext: Ævar Arnfjörð Bjarmason
Message 5 of 6 in “test-lib.sh: add BAIL_OUT function, use it for SANITIZE=leak”
  1. 0/2 test-lib.sh: add BAIL_OUT function, use it for SANITIZE=leakÆvar Arnfjörð Bjarmason, Oct 14, 2021
  2. 1/2 test-lib.sh: de-duplicate error() teardown codeÆvar Arnfjörð Bjarmason, Oct 14, 2021
  3. Junio C HamanoOct 14, 2021
  4. 2/2 test-lib.sh: use "Bail out!" syntax on bad SANITIZE=leak useÆvar Arnfjörð Bjarmason, Oct 14, 2021
  5. Junio C HamanoOct 14, 2021
  6. Ævar Arnfjörð BjarmasonOct 14, 2021

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.