v1-0003-perl-tap-Show-die-reason-in-TAP-output.patch
text/x-patch
Filename: v1-0003-perl-tap-Show-die-reason-in-TAP-output.patch
Type: text/x-patch
Part: 3
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: format-patch
Series: patch v1-0003
Subject: perl tap: Show die reason in TAP output
| File | + | − |
|---|---|---|
| src/test/perl/PostgreSQL/Test/Utils.pm | 8 | 0 |
From c88f1fbf6462da56a1f0739dd83a6284d6bdd389 Mon Sep 17 00:00:00 2001
From: Jelte Fennema-Nio <postgres@jeltef.nl>
Date: Mon, 26 Jan 2026 09:32:15 +0100
Subject: [PATCH v1 3/5] perl tap: Show die reason in TAP output
In our Perl tests the most commonly used function is probably safe_psql.
But if that call failed you would get this totally useless output in the
meson output:
Tests were run but no plan was declared and done_testing() was not seen.
Looks like your test exited with 29 just after 21.
With this change you get the actual failure reason too:
die: error running SQL: 'psql:<stdin>:2: ERROR: unterminated quoted string at or near "'"
LINE 1: GRANT ALL ON sysuser_data TO scram_role '
^'
while running 'psql --no-psqlrc --no-align --tuples-only --quiet --dbname port=18204 host=/tmp/tKBBBekcsW dbname='postgres' --file - --variable ON_ERROR_STOP=1' with sql 'CREATE TABLE sysuser_data (n) AS SELECT NULL FROM generate_series(1, 10);
GRANT ALL ON sysuser_data TO scram_role '' at /home/jelte/work/postgres-3/src/test/perl/PostgreSQL/Test/Cluster.pm line 2300.
Tests were run but no plan was declared and done_testing() was not seen.
Looks like your test exited with 29 just after 21.
---
src/test/perl/PostgreSQL/Test/Utils.pm | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/test/perl/PostgreSQL/Test/Utils.pm b/src/test/perl/PostgreSQL/Test/Utils.pm
index bd1e981c6f0..df328d0f571 100644
--- a/src/test/perl/PostgreSQL/Test/Utils.pm
+++ b/src/test/perl/PostgreSQL/Test/Utils.pm
@@ -206,6 +206,14 @@ INIT
# test may still fail, but it's more likely to report useful facts.
$SIG{PIPE} = 'IGNORE';
+ # Emit die messages as TAP diagnostics so they appear in test output.
+ $SIG{__DIE__} = sub {
+ return if $^S; # Ignore dies inside eval
+ my $msg = shift;
+ chomp $msg;
+ diag("die: $msg");
+ };
+
# Determine output directories, and create them. The base paths are the
# TESTDATADIR / TESTLOGDIR environment variables, which are normally set
# by the invoking Makefile.
--
2.52.0