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

From: Andres Freund <andres(at)anarazel(dot)de>
To: Dagfinn Ilmari Mannsåker <ilmari(at)ilmari(dot)org>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: bailing out in tap tests nearly always a bad idea
Date: 2022-02-14 17:46:20
Message-ID: 20220214174620.bt35ruq3qnzddhtu@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 2022-02-14 16:08:42 +0000, Dagfinn Ilmari Mannsåker wrote:
> die()-ing is the correct way to abort a single test script.

There's really no way to nice way to abort without the "Dubious, test returned
255 (wstat 65280, 0xff00)" stuff?

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...

> t/die-immediately.t .... aieee at t/die-immediately.t line 1.
> t/die-immediately.t .... Dubious, test returned 255 (wstat 65280, 0xff00)
> No subtests run

Hm. Looks different when a test is including our test helpers.

t/000_die_pg_test_utils.pl .. Dubious, test returned 25 (wstat 6400, 0x1900)
No subtests run
t/000_die_test_more.pl ...... error at t/000_die_test_more.pl line 2.
t/000_die_test_more.pl ...... Dubious, test returned 255 (wstat 65280, 0xff00)
No subtests run

So I think we broke something... I think it's the log file redirection stuff
in INIT.

Greetings,

Andres Freund

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2022-02-14 17:47:44 Re: bailing out in tap tests nearly always a bad idea
Previous Message Robert Haas 2022-02-14 17:45:08 Re: Mark all GUC variable as PGDLLIMPORT