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

Commitbab0ff2

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 parent08f37e2 commitbab0ff2

File tree

10 files changed

+33
-1
lines changed

10 files changed

+33
-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/bin/pg_verifybackup/t/005_bad_manifest.pl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,8 @@
173173

174174
subtest_parse_error
175175
{
176+
local$Test::Builder::Level =$Test::Builder::Level + 1;
177+
176178
my ($test_name,$manifest_contents) =@_;
177179

178180
test_bad_manifest($test_name,
@@ -183,6 +185,8 @@ sub test_parse_error
183185

184186
subtest_fatal_error
185187
{
188+
local$Test::Builder::Level =$Test::Builder::Level + 1;
189+
186190
my ($test_name,$manifest_contents) =@_;
187191

188192
test_bad_manifest($test_name,qr/fatal:$test_name/,$manifest_contents);
@@ -191,6 +195,8 @@ sub test_fatal_error
191195

192196
subtest_bad_manifest
193197
{
198+
local$Test::Builder::Level =$Test::Builder::Level + 1;
199+
194200
my ($test_name,$regexp,$manifest_contents) =@_;
195201

196202
open(my$fh,'>',"$tempdir/backup_manifest") ||die"open:$!";

‎src/bin/psql/t/010_tab_completion.pl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,8 @@ sub check_completion
124124
# (won't work if we are inside a string literal!)
125125
subclear_query
126126
{
127+
local$Test::Builder::Level =$Test::Builder::Level + 1;
128+
127129
check_completion("\\r\n",qr/postgres=#/,"\\r works");
128130
return;
129131
}
@@ -133,6 +135,8 @@ sub clear_query
133135
# than clear_query because we lose evidence in the history file)
134136
subclear_line
135137
{
138+
local$Test::Builder::Level =$Test::Builder::Level + 1;
139+
136140
check_completion("\025\n",qr/postgres=#/,"control-U works");
137141
return;
138142
}

‎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
@@ -11,6 +11,8 @@
1111
# count to reach $num_rows, yet not later than the recovery target.
1212
subtest_recovery_standby
1313
{
14+
local$Test::Builder::Level =$Test::Builder::Level + 1;
15+
1416
my$test_name =shift;
1517
my$node_name =shift;
1618
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

‎src/test/recovery/t/018_wal_optimize.pl

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

1616
subcheck_orphan_relfilenodes
1717
{
18+
local$Test::Builder::Level =$Test::Builder::Level + 1;
19+
1820
my ($node,$test_name) =@_;
1921

2022
my$db_oid =$node->safe_psql('postgres',

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp