Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd5ab331

Browse files
committed
Add more $Test::Builder::Level in the TAP tests
Incrementing the level of the call stack reported is useful fordebugging purposes as it allows to control which part of the test isexactly failing, especially if a test is structured with subroutinesthat call routines from Test::More.This adds more incrementations of $Test::Builder::Level where debugginggets improved (for example it does not make sense for some paths likepg_rewind where long subroutines are used).A note is added to src/test/perl/README about that, based on asuggestion from Andrew Dunstan and a wording coming from both of us.Usage of Test::Builder::Level has spread in 12, so a backpatch down tothis version is done.Reviewed-by: Andrew Dunstan, Peter Eisentraut, Daniel GustafssonDiscussion:https://postgr.es/m/YV1CCFwgM1RV1LeS@paquier.xyzBackpatch-through: 12
1 parent2288973 commitd5ab331

File tree

7 files changed

+21
-1
lines changed

7 files changed

+21
-1
lines changed

‎src/bin/pg_archivecleanup/t/010_pg_archivecleanup.pl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ sub create_files
6969

7070
subrun_check
7171
{
72+
local$Test::Builder::Level =$Test::Builder::Level + 1;
73+
7274
my ($suffix,$test_name) =@_;
7375

7476
create_files();

‎src/test/kerberos/t/001_auth.pl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,8 @@ sub test_access
203203
# As above, but test for an arbitrary query result.
204204
subtest_query
205205
{
206+
local$Test::Builder::Level =$Test::Builder::Level + 1;
207+
206208
my ($node,$role,$query,$expected,$gssencmode,$test_name) =@_;
207209

208210
# need to connect over TCP/IP for Kerberos

‎src/test/perl/README

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,17 @@ Test::More::like entails use of the qr// operator. Avoid Perl 5.8.8 bug
6161
#39185 by not using the "$" regular expression metacharacter in qr// when also
6262
using the "/m" modifier. Instead of "$", use "\n" or "(?=\n|\z)".
6363

64-
Read the Test::More documentation for more on how to write tests:
64+
Test::Builder::Level controls how far up in the call stack a test will look
65+
at when reporting a failure. This should be incremented by any subroutine
66+
which directly or indirectly calls test routines from Test::More, such as
67+
ok() or is():
68+
69+
local $Test::Builder::Level = $Test::Builder::Level + 1;
70+
71+
Read the documentation for more on how to write tests:
6572

6673
perldoc Test::More
74+
perldoc Test::Builder
6775

6876
For available PostgreSQL-specific test methods and some example tests read the
6977
perldoc for the test modules, e.g.:

‎src/test/recovery/t/001_stream_rep.pl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@
7272
# target_session_attrs with multiple nodes.
7373
subtest_target_session_attrs
7474
{
75+
local$Test::Builder::Level =$Test::Builder::Level + 1;
76+
7577
my$node1 =shift;
7678
my$node2 =shift;
7779
my$target_node =shift;

‎src/test/recovery/t/003_recovery_targets.pl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
# count to reach $num_rows, yet not later than the recovery target.
1111
subtest_recovery_standby
1212
{
13+
local$Test::Builder::Level =$Test::Builder::Level + 1;
14+
1315
my$test_name =shift;
1416
my$node_name =shift;
1517
my$node_master =shift;

‎src/test/recovery/t/007_sync_rep.pl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
# the configuration file is reloaded before the test.
1515
subtest_sync_state
1616
{
17+
local$Test::Builder::Level =$Test::Builder::Level + 1;
18+
1719
my ($self,$expected,$msg,$setting) =@_;
1820

1921
if (defined($setting))

‎src/test/recovery/t/009_twophase.pl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
subconfigure_and_reload
1313
{
14+
local$Test::Builder::Level =$Test::Builder::Level + 1;
15+
1416
my ($node,$parameter) =@_;
1517
my$name =$node->name;
1618

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp