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

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Andres Freund <andres(at)anarazel(dot)de>
Cc: Dagfinn Ilmari Mannsåker <ilmari(at)ilmari(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: bailing out in tap tests nearly always a bad idea
Date: 2022-02-15 14:34:32
Message-ID: d3d66aa9-422a-7dc9-0105-e3a679c9b849@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On 2/14/22 12:58, Tom Lane wrote:
> Andres Freund <andres(at)anarazel(dot)de> writes:
>> Even just getting rid of the "Tests were run but no plan was declared and
>> done_testing() was not seen." noise would be helpful. So I think using a fatal
>> error routine that forced a failure to be recognized via ok(0, 'fatal error')
>> and then does done_testing() would be better...
> Maybe we could do something in an END block provided by Utils.pm?
> I still think that insisting that people avoid die() is going to
> be annoying.
>
>

See references to $SIG{__DIE__} in `perldoc-f die` and `perldoc perlvar`
for how to set up a handler for die() cleanup. Maybe we could set up a
handler that calls done_testing(). ?

cheers

andrew

--
Andrew Dunstan
EDB: https://www.enterprisedb.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Ashutosh Sharma 2022-02-15 14:47:20 Re: Make mesage at end-of-recovery less scary.
Previous Message Robert Haas 2022-02-15 14:16:06 Re: do only critical work during single-user vacuum?