[PATCH 0/2] test-lib.sh: add BAIL_OUT function, use it for SANITIZE=leak
- From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
- Date
- Oct 14, 2021, 00:47 UTC
- Message-ID
- <cover-0.2-00000000000-20211014T004542Z-avarab@gmail.com>
This series adds a BAIL_OUT function, and uses it when the new GIT_TEST_PASSING_SANITIZE_LEAK=true mode is misused.
Once we have this function we'll be able to use it for any other error that's a cause for aborting the entire test run.
I experimented with making BUG() and error() always be a "BAIL_OUT". I think that's worth pursuing, but e.g. for the error about missing "&&-chains" we'd need to support emitting multi-line messages.
TAP consumers only understand what follows the "Bail out!" message up to the first "\n", so we can't quote the entire "test_expect_success", as the "&&-chain" error does. I think emitting them with "say_error()" beforehand (piped with ">&7" in the case of "BUG()") should work, but let's leave those #leftoverbits for later.
Ævar Arnfjörð Bjarmason (2): test-lib.sh: de-duplicate error() teardown code test-lib.sh: use "Bail out!" syntax on bad SANITIZE=leak use
t/test-lib.sh | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-)
-- 2.33.1.1346.g48288c3c089