From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, Jeff King <peff@peff.net>
Subject: Re: [PATCH 2/2] test-lib.sh: use "Bail out!" syntax on bad SANITIZE=leak use
Date: Thu, 14 Oct 2021 19:25:30 +0200 [thread overview]
Message-ID: <87v91zfrd7.fsf@evledraar.gmail.com> (raw)
In-Reply-To: <xmqqsfx3d0i3.fsf@gitster.g>
On Thu, Oct 14 2021, Junio C Hamano wrote:
>> +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.
That's:
skip_all="reason"
test_done
Which we could spell as:
skip_all "reason"
Or whatever, if we wanted such a self-documenting helper.
There's no facility in TAP syntax to indicate in some special way that
you'd like to skip all remaining things once your test is already
running, the best you can do is just exit at that point.
I.e. the (very light amount of) special-ness (such as it is) is that if
the very first line of the output is "1..0 skip [...]" progarms like
"prove" will emit the skip summary as part of the output. See DIRECTIVES
at https://testanything.org/tap-specification.html
prev parent reply other threads:[~2021-10-14 17:28 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-14 0:47 [PATCH 0/2] test-lib.sh: add BAIL_OUT function, use it for SANITIZE=leak Ævar Arnfjörð Bjarmason
2021-10-14 0:47 ` [PATCH 1/2] test-lib.sh: de-duplicate error() teardown code Ævar Arnfjörð Bjarmason
2021-10-14 16:26 ` Junio C Hamano
2021-10-14 0:47 ` [PATCH 2/2] test-lib.sh: use "Bail out!" syntax on bad SANITIZE=leak use Ævar Arnfjörð Bjarmason
2021-10-14 16:39 ` Junio C Hamano
2021-10-14 17:25 ` Ævar Arnfjörð Bjarmason [this message]
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=87v91zfrd7.fsf@evledraar.gmail.com \
--to=avarab@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=peff@peff.net \
/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).