Re: bailing out in tap tests nearly always a bad idea

From: Andres Freund <andres(at)anarazel(dot)de>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: bailing out in tap tests nearly always a bad idea
Date: 2022-02-13 23:47:19
Message-ID: 20220213234719.fk3ktieef7c4rghv@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 2022-02-13 18:32:59 -0500, Tom Lane wrote:
> Andres Freund <andres(at)anarazel(dot)de> writes:
> > Best with a
> > central function signalling fatal error, rather than individual uses of die
> > or such.
>
> Huh, doesn't Test::More already provide a sane way to do this?

I looked, and didn't see anything. But I'm not a perl person, so I might just
have missed something.

> If not, why isn't die() good enough? (I don't think you can
> realistically expect to prohibit die() anywhere in the TAP tests.)

The output of dying isn't great either:

t/000_fail.pl ........................ Dubious, test returned 25 (wstat 6400, 0x1900)
No subtests run

it'd be nicer if that that showed the actual reason for failing, rather than
the unhelpful "Dubious, test returned" stuff. But it's still better than
BAIL_OUT. So I thought that putting the failure handling in a central routine
would allow us to make the exit nicer in a central place / at a later stage...

Greetings,

Andres Freund

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2022-02-14 00:02:29 Re: pgsql: Add suport for server-side LZ4 base backup compression.
Previous Message Andrew Dunstan 2022-02-13 23:34:00 Re: xml_is_well_formed (was Re: buildfarm warnings)