perl tap: Show die reason in TAP output

Install a $SIG{__DIE__} handler in the INIT block of Utils.pm that emits
the die message as a TAP diagnostic.  Previously, an unexpected die
(e.g. from safe_psql) produced only "no plan was declared" with no
indication of the actual error.  The handler also calls done_testing()
to suppress that confusing message.

Dies during compilation ($^S undefined) and inside eval ($^S == 1) are
left alone.

Author: Jelte Fennema-Nio <[email protected]>
Reviewed-by: Andrew Dunstan <[email protected]>
Reviewed-by: Corey Huinker <[email protected]>
Reviewed-by: Zsolt Parragi <[email protected]>
Reviewed-by: Nazir Bilal Yavuz <[email protected]>
Reviewed-by: Andres Freund <[email protected]>
Discussion: https://postgr.es/m/[email protected]
Discussion: 
https://postgr.es/m/20220222181924.eehi7o4pmneeb4hm%40alap3.anarazel.de

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/76540fdedf405c01518007bef3bdd96e0b96d390

Modified Files
--------------
src/test/perl/PostgreSQL/Test/Utils.pm | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)

Reply via email to