summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorMichael Paquier <michael@paquier.xyz>2021-10-12 11:15:44 +0900
committerMichael Paquier <michael@paquier.xyz>2021-10-12 11:15:44 +0900
commitf9c4cb686800d46ef9e9e90ed5133493b23962af (patch)
treec6a12871d50f9d098d5b203bfbe4fb308812d6e2 /contrib
parente3e29cec10d15bbcedc6b41887d8f4e138d719bd (diff)
downloadpostgresql-f9c4cb686800d46ef9e9e90ed5133493b23962af.tar.gz
Add more $Test::Builder::Level in the TAP tests
Incrementing the level of the call stack reported is useful for debugging purposes as it allows to control which part of the test is exactly failing, especially if a test is structured with subroutines that call routines from Test::More. This adds more incrementations of $Test::Builder::Level where debugging gets improved (for example it does not make sense for some paths like pg_rewind where long subroutines are used). A note is added to src/test/perl/README about that, based on a suggestion from Andrew Dunstan and a wording coming from both of us. Usage of Test::Builder::Level has spread in 12, so a backpatch down to this version is done. Reviewed-by: Andrew Dunstan, Peter Eisentraut, Daniel Gustafsson Discussion: https://postgr.es/m/YV1CCFwgM1RV1LeS@paquier.xyz Backpatch-through: 12
Diffstat (limited to 'contrib')
-rw-r--r--contrib/amcheck/t/001_verify_heapam.pl8
-rw-r--r--contrib/test_decoding/t/001_repl_stats.pl2
2 files changed, 10 insertions, 0 deletions
diff --git a/contrib/amcheck/t/001_verify_heapam.pl b/contrib/amcheck/t/001_verify_heapam.pl
index ba40f64b58..8e02a8db2a 100644
--- a/contrib/amcheck/t/001_verify_heapam.pl
+++ b/contrib/amcheck/t/001_verify_heapam.pl
@@ -209,6 +209,8 @@ sub corrupt_first_page
sub detects_heap_corruption
{
+ local $Test::Builder::Level = $Test::Builder::Level + 1;
+
my ($function, $testname) = @_;
detects_corruption(
@@ -224,6 +226,8 @@ sub detects_heap_corruption
sub detects_corruption
{
+ local $Test::Builder::Level = $Test::Builder::Level + 1;
+
my ($function, $testname, @re) = @_;
my $result = $node->safe_psql('postgres', qq(SELECT * FROM $function));
@@ -232,6 +236,8 @@ sub detects_corruption
sub detects_no_corruption
{
+ local $Test::Builder::Level = $Test::Builder::Level + 1;
+
my ($function, $testname) = @_;
my $result = $node->safe_psql('postgres', qq(SELECT * FROM $function));
@@ -247,6 +253,8 @@ sub detects_no_corruption
# and should be unique.
sub check_all_options_uncorrupted
{
+ local $Test::Builder::Level = $Test::Builder::Level + 1;
+
my ($relname, $prefix) = @_;
for my $stop (qw(true false))
diff --git a/contrib/test_decoding/t/001_repl_stats.pl b/contrib/test_decoding/t/001_repl_stats.pl
index fdef6cb1ff..e8644e1cbc 100644
--- a/contrib/test_decoding/t/001_repl_stats.pl
+++ b/contrib/test_decoding/t/001_repl_stats.pl
@@ -19,6 +19,8 @@ $node->start;
# Check that replication slot stats are expected.
sub test_slot_stats
{
+ local $Test::Builder::Level = $Test::Builder::Level + 1;
+
my ($node, $expected, $msg) = @_;
my $result = $node->safe_psql(