Skip to content

Commit 549ec20

Browse files
Replace Test::More plans with done_testing
Rather than doing manual book keeping to plan the number of tests to run in each TAP suite, conclude each run with done_testing() summing up the the number of tests that ran. This removes the need for maintaning and updating the plan count at the expense of an accurate count of remaining during the test suite runtime. This patch has been discussed a number of times, often in the context of other patches which updates tests, so a larger number of discussions can be found in the archives. Reviewed-by: Julien Rouhaud <[email protected]> Reviewed-by: Dagfinn Ilmari Mannsåker <[email protected]> Reviewed-by: Tom Lane <[email protected]> Reviewed-by: Michael Paquier <[email protected]> Reviewed-by: Kyotaro Horiguchi <[email protected]> Discussion: https://postgr.es/m/[email protected]
1 parent 751b8d2 commit 549ec20

File tree

139 files changed

+394
-303
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

139 files changed

+394
-303
lines changed

contrib/amcheck/t/001_verify_heapam.pl

+3-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
use PostgreSQL::Test::Utils;
99

1010
use Fcntl qw(:seek);
11-
use Test::More tests => 272;
11+
use Test::More;
1212

1313
my ($node, $result);
1414

@@ -283,3 +283,5 @@ sub check_all_options_uncorrupted
283283
}
284284
}
285285
}
286+
287+
done_testing();

contrib/amcheck/t/002_cic.pl

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
use PostgreSQL::Test::Cluster;
1010
use PostgreSQL::Test::Utils;
1111

12-
use Test::More tests => 3;
12+
use Test::More;
1313

1414
my ($node, $result);
1515

contrib/amcheck/t/003_cic_2pc.pl

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
use PostgreSQL::Test::Cluster;
1010
use PostgreSQL::Test::Utils;
1111

12-
use Test::More tests => 5;
12+
use Test::More;
1313

1414
Test::More->builder->todo_start('filesystem bug')
1515
if PostgreSQL::Test::Utils::has_wal_read_bug;

contrib/auto_explain/t/001_auto_explain.pl

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
use PostgreSQL::Test::Cluster;
88
use PostgreSQL::Test::Utils;
9-
use Test::More tests => 4;
9+
use Test::More;
1010

1111
my $node = PostgreSQL::Test::Cluster->new('main');
1212
$node->init;
@@ -53,3 +53,5 @@
5353
$log_contents,
5454
qr/"Node Type": "Index Scan"[^}]*"Index Name": "pg_class_relname_nsp_index"/s,
5555
"index scan logged, json mode");
56+
57+
done_testing();

contrib/bloom/t/001_wal.pl

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
use warnings;
77
use PostgreSQL::Test::Cluster;
88
use PostgreSQL::Test::Utils;
9-
use Test::More tests => 31;
9+
use Test::More;
1010

1111
my $node_primary;
1212
my $node_standby;
@@ -80,3 +80,5 @@ sub test_index_replay
8080
);
8181
test_index_replay("insert $i");
8282
}
83+
84+
done_testing();

contrib/oid2name/t/001_basic.pl

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@
55
use warnings;
66

77
use PostgreSQL::Test::Utils;
8-
use Test::More tests => 8;
8+
use Test::More;
99

1010
#########################################
1111
# Basic checks
1212

1313
program_help_ok('oid2name');
1414
program_version_ok('oid2name');
1515
program_options_handling_ok('oid2name');
16+
17+
done_testing();

contrib/test_decoding/t/001_repl_stats.pl

+3-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
use File::Path qw(rmtree);
99
use PostgreSQL::Test::Cluster;
1010
use PostgreSQL::Test::Utils;
11-
use Test::More tests => 2;
11+
use Test::More;
1212

1313
# Test set-up
1414
my $node = PostgreSQL::Test::Cluster->new('test');
@@ -118,3 +118,5 @@ sub test_slot_stats
118118

119119
# shutdown
120120
$node->stop;
121+
122+
done_testing();

contrib/vacuumlo/t/001_basic.pl

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@
55
use warnings;
66

77
use PostgreSQL::Test::Utils;
8-
use Test::More tests => 8;
8+
use Test::More;
99

1010
program_help_ok('vacuumlo');
1111
program_version_ok('vacuumlo');
1212
program_options_handling_ok('vacuumlo');
13+
14+
done_testing();

src/bin/initdb/t/001_initdb.pl

+3-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
use File::stat qw{lstat};
1212
use PostgreSQL::Test::Cluster;
1313
use PostgreSQL::Test::Utils;
14-
use Test::More tests => 22;
14+
use Test::More;
1515

1616
my $tempdir = PostgreSQL::Test::Utils::tempdir;
1717
my $xlogdir = "$tempdir/pgxlog";
@@ -92,3 +92,5 @@
9292
ok(check_mode_recursive($datadir_group, 0750, 0640),
9393
'check PGDATA permissions');
9494
}
95+
96+
done_testing();

src/bin/pg_amcheck/t/001_basic.pl

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@
55
use warnings;
66

77
use PostgreSQL::Test::Utils;
8-
use Test::More tests => 8;
8+
use Test::More;
99

1010
program_help_ok('pg_amcheck');
1111
program_version_ok('pg_amcheck');
1212
program_options_handling_ok('pg_amcheck');
13+
14+
done_testing();

src/bin/pg_amcheck/t/002_nonesuch.pl

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
use PostgreSQL::Test::Cluster;
88
use PostgreSQL::Test::Utils;
9-
use Test::More tests => 76;
9+
use Test::More;
1010

1111
# Test set-up
1212
my ($node, $port);
@@ -268,3 +268,5 @@
268268
qr/pg_amcheck: error: no relations to check/
269269
],
270270
'schema exclusion pattern overrides all inclusion patterns');
271+
272+
done_testing();

src/bin/pg_amcheck/t/003_check.pl

+3-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
use PostgreSQL::Test::Utils;
99

1010
use Fcntl qw(:seek);
11-
use Test::More tests => 63;
11+
use Test::More;
1212

1313
my ($node, $port, %corrupt_page, %remove_relation);
1414

@@ -517,3 +517,5 @@ ()
517517
[ @cmd, '-d', 'db1', '-d', 'db2', '-d', 'db3', '-S', 's*' ],
518518
0, [$no_output_re], [$no_output_re],
519519
'pg_amcheck excluding all corrupt schemas');
520+
521+
done_testing();

src/bin/pg_amcheck/t/004_verify_heapam.pl

+2-1
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,6 @@ sub write_tuple
297297
$node->start;
298298

299299
# Ok, Xids and page layout look ok. We can run corruption tests.
300-
plan tests => 19;
301300

302301
# Check that pg_amcheck runs against the uncorrupted table without error.
303302
$node->command_ok(
@@ -528,3 +527,5 @@ sub header
528527

529528
$node->teardown_node;
530529
$node->clean_node;
530+
531+
done_testing();

src/bin/pg_amcheck/t/005_opclass_damage.pl

+3-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
use warnings;
99
use PostgreSQL::Test::Cluster;
1010
use PostgreSQL::Test::Utils;
11-
use Test::More tests => 5;
11+
use Test::More;
1212

1313
my $node = PostgreSQL::Test::Cluster->new('test');
1414
$node->init;
@@ -57,3 +57,5 @@
5757
[],
5858
'pg_amcheck all schemas, tables and indexes reports fickleidx corruption'
5959
);
60+
61+
done_testing();

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

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
use strict;
55
use warnings;
66
use PostgreSQL::Test::Utils;
7-
use Test::More tests => 42;
7+
use Test::More;
88

99
program_help_ok('pg_archivecleanup');
1010
program_version_ok('pg_archivecleanup');
@@ -101,3 +101,5 @@ sub run_check
101101
run_check('', 'pg_archivecleanup');
102102
run_check('.partial', 'pg_archivecleanup with .partial file');
103103
run_check('.00000020.backup', 'pg_archivecleanup with .backup file');
104+
105+
done_testing();

src/bin/pg_basebackup/t/020_pg_receivewal.pl

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use warnings;
66
use PostgreSQL::Test::Utils;
77
use PostgreSQL::Test::Cluster;
8-
use Test::More tests => 42;
8+
use Test::More;
99

1010
program_help_ok('pg_receivewal');
1111
program_version_ok('pg_receivewal');
@@ -334,3 +334,5 @@
334334
"WAL segment $walfile_after_promotion archived after timeline jump");
335335
ok(-e "$timeline_dir/00000002.history",
336336
"timeline history file archived after timeline jump");
337+
338+
done_testing();

src/bin/pg_basebackup/t/030_pg_recvlogical.pl

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use warnings;
66
use PostgreSQL::Test::Utils;
77
use PostgreSQL::Test::Cluster;
8-
use Test::More tests => 20;
8+
use Test::More;
99

1010
program_help_ok('pg_recvlogical');
1111
program_version_ok('pg_recvlogical');
@@ -106,3 +106,5 @@
106106
'--start', '--endpos', "$nextlsn", '--no-loop', '-f', '-'
107107
],
108108
'replayed a two-phase transaction');
109+
110+
done_testing();

src/bin/pg_checksums/t/001_basic.pl

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44
use strict;
55
use warnings;
66
use PostgreSQL::Test::Utils;
7-
use Test::More tests => 8;
7+
use Test::More;
88

99
program_help_ok('pg_checksums');
1010
program_version_ok('pg_checksums');
1111
program_options_handling_ok('pg_checksums');
12+
13+
done_testing();

src/bin/pg_checksums/t/002_actions.pl

+3-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
use PostgreSQL::Test::Utils;
1212

1313
use Fcntl qw(:seek);
14-
use Test::More tests => 66;
14+
use Test::More;
1515

1616

1717
# Utility routine to create and check a table with corrupted checksums
@@ -257,3 +257,5 @@ sub fail_corrupt
257257
fail_corrupt($node, "99990_init.123");
258258
fail_corrupt($node, "99990_fsm.123");
259259
fail_corrupt($node, "99990_vm.123");
260+
261+
done_testing();

src/bin/pg_config/t/001_pg_config.pl

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
use strict;
55
use warnings;
66
use PostgreSQL::Test::Utils;
7-
use Test::More tests => 20;
7+
use Test::More;
88

99
program_help_ok('pg_config');
1010
program_version_ok('pg_config');
@@ -17,3 +17,5 @@
1717
qr/lib.*\n.*bin/, 'pg_config two options different order');
1818
command_like(['pg_config'], qr/.*\n.*\n.*/,
1919
'pg_config without options prints many lines');
20+
21+
done_testing();

src/bin/pg_controldata/t/001_pg_controldata.pl

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use warnings;
66
use PostgreSQL::Test::Cluster;
77
use PostgreSQL::Test::Utils;
8-
use Test::More tests => 17;
8+
use Test::More;
99

1010
program_help_ok('pg_controldata');
1111
program_version_ok('pg_controldata');
@@ -42,3 +42,5 @@
4242
],
4343
[qr/^$/],
4444
'pg_controldata with corrupted pg_control');
45+
46+
done_testing();

src/bin/pg_ctl/t/001_start_stop.pl

+3-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
use File::stat qw{lstat};
1010
use PostgreSQL::Test::Cluster;
1111
use PostgreSQL::Test::Utils;
12-
use Test::More tests => 24;
12+
use Test::More;
1313

1414
my $tempdir = PostgreSQL::Test::Utils::tempdir;
1515
my $tempdir_short = PostgreSQL::Test::Utils::tempdir_short;
@@ -111,3 +111,5 @@
111111
'pg_ctl restart with server running');
112112

113113
system_or_bail 'pg_ctl', 'stop', '-D', "$tempdir/data";
114+
115+
done_testing();

src/bin/pg_ctl/t/002_status.pl

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
use PostgreSQL::Test::Cluster;
88
use PostgreSQL::Test::Utils;
9-
use Test::More tests => 3;
9+
use Test::More;
1010

1111
my $tempdir = PostgreSQL::Test::Utils::tempdir;
1212

@@ -25,3 +25,5 @@
2525
0, 'pg_ctl status with server running');
2626

2727
system_or_bail 'pg_ctl', 'stop', '-D', $node->data_dir;
28+
29+
done_testing();

src/bin/pg_ctl/t/003_promote.pl

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
use PostgreSQL::Test::Cluster;
88
use PostgreSQL::Test::Utils;
9-
use Test::More tests => 12;
9+
use Test::More;
1010

1111
my $tempdir = PostgreSQL::Test::Utils::tempdir;
1212

@@ -62,3 +62,5 @@
6262

6363
is($node_standby->safe_psql('postgres', 'SELECT pg_is_in_recovery()'),
6464
'f', 'promoted standby is not in recovery');
65+
66+
done_testing();

src/bin/pg_ctl/t/004_logrotate.pl

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
use PostgreSQL::Test::Cluster;
88
use PostgreSQL::Test::Utils;
9-
use Test::More tests => 14;
9+
use Test::More;
1010
use Time::HiRes qw(usleep);
1111

1212
# Extract the file name of a $format from the contents of
@@ -136,3 +136,5 @@ sub check_log_pattern
136136
check_log_pattern('jsonlog', $new_current_logfiles, 'syntax error', $node);
137137

138138
$node->stop();
139+
140+
done_testing();

src/bin/pg_dump/t/001_basic.pl

+3-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
use Config;
88
use PostgreSQL::Test::Cluster;
99
use PostgreSQL::Test::Utils;
10-
use Test::More tests => 82;
10+
use Test::More;
1111

1212
my $tempdir = PostgreSQL::Test::Utils::tempdir;
1313

@@ -188,3 +188,5 @@
188188
qr/\Qpg_dumpall: error: option --exclude-database cannot be used together with -g\/--globals-only\E/,
189189
'pg_dumpall: option --exclude-database cannot be used together with -g/--globals-only'
190190
);
191+
192+
done_testing();

0 commit comments

Comments
 (0)