diff options
author | Daniel Gustafsson | 2022-02-11 19:54:44 +0000 |
---|---|---|
committer | Daniel Gustafsson | 2022-02-11 19:54:44 +0000 |
commit | 549ec201d6132b7c7ee11ee90a4e02119259ba5b (patch) | |
tree | 44c1669ef24c66233c16b2fa77aff148596f67a7 /src/bin | |
parent | 751b8d23b788580bbff7463e3959f9a92a95b28a (diff) |
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]
Diffstat (limited to 'src/bin')
59 files changed, 169 insertions, 144 deletions
diff --git a/src/bin/initdb/t/001_initdb.pl b/src/bin/initdb/t/001_initdb.pl index 02bc688a3b9..7dc8cdd855b 100644 --- a/src/bin/initdb/t/001_initdb.pl +++ b/src/bin/initdb/t/001_initdb.pl @@ -11,7 +11,7 @@ use Fcntl ':mode'; use File::stat qw{lstat}; use PostgreSQL::Test::Cluster; use PostgreSQL::Test::Utils; -use Test::More tests => 22; +use Test::More; my $tempdir = PostgreSQL::Test::Utils::tempdir; my $xlogdir = "$tempdir/pgxlog"; @@ -92,3 +92,5 @@ SKIP: ok(check_mode_recursive($datadir_group, 0750, 0640), 'check PGDATA permissions'); } + +done_testing(); diff --git a/src/bin/pg_amcheck/t/001_basic.pl b/src/bin/pg_amcheck/t/001_basic.pl index 4bb9d91dfb8..e27312862e7 100644 --- a/src/bin/pg_amcheck/t/001_basic.pl +++ b/src/bin/pg_amcheck/t/001_basic.pl @@ -5,8 +5,10 @@ use strict; use warnings; use PostgreSQL::Test::Utils; -use Test::More tests => 8; +use Test::More; program_help_ok('pg_amcheck'); program_version_ok('pg_amcheck'); program_options_handling_ok('pg_amcheck'); + +done_testing(); diff --git a/src/bin/pg_amcheck/t/002_nonesuch.pl b/src/bin/pg_amcheck/t/002_nonesuch.pl index 8d7bd7ebccd..56d55199f84 100644 --- a/src/bin/pg_amcheck/t/002_nonesuch.pl +++ b/src/bin/pg_amcheck/t/002_nonesuch.pl @@ -6,7 +6,7 @@ use warnings; use PostgreSQL::Test::Cluster; use PostgreSQL::Test::Utils; -use Test::More tests => 76; +use Test::More; # Test set-up my ($node, $port); @@ -268,3 +268,5 @@ $node->command_checks_all( qr/pg_amcheck: error: no relations to check/ ], 'schema exclusion pattern overrides all inclusion patterns'); + +done_testing(); diff --git a/src/bin/pg_amcheck/t/003_check.pl b/src/bin/pg_amcheck/t/003_check.pl index 9df027b37f0..d984eacb24f 100644 --- a/src/bin/pg_amcheck/t/003_check.pl +++ b/src/bin/pg_amcheck/t/003_check.pl @@ -8,7 +8,7 @@ use PostgreSQL::Test::Cluster; use PostgreSQL::Test::Utils; use Fcntl qw(:seek); -use Test::More tests => 63; +use Test::More; my ($node, $port, %corrupt_page, %remove_relation); @@ -517,3 +517,5 @@ $node->command_checks_all( [ @cmd, '-d', 'db1', '-d', 'db2', '-d', 'db3', '-S', 's*' ], 0, [$no_output_re], [$no_output_re], 'pg_amcheck excluding all corrupt schemas'); + +done_testing(); diff --git a/src/bin/pg_amcheck/t/004_verify_heapam.pl b/src/bin/pg_amcheck/t/004_verify_heapam.pl index 84e75862769..94d691a614d 100644 --- a/src/bin/pg_amcheck/t/004_verify_heapam.pl +++ b/src/bin/pg_amcheck/t/004_verify_heapam.pl @@ -297,7 +297,6 @@ close($file) $node->start; # Ok, Xids and page layout look ok. We can run corruption tests. -plan tests => 19; # Check that pg_amcheck runs against the uncorrupted table without error. $node->command_ok( @@ -528,3 +527,5 @@ $node->command_checks_all( $node->teardown_node; $node->clean_node; + +done_testing(); diff --git a/src/bin/pg_amcheck/t/005_opclass_damage.pl b/src/bin/pg_amcheck/t/005_opclass_damage.pl index d81c9583de2..a5e82082700 100644 --- a/src/bin/pg_amcheck/t/005_opclass_damage.pl +++ b/src/bin/pg_amcheck/t/005_opclass_damage.pl @@ -8,7 +8,7 @@ use strict; use warnings; use PostgreSQL::Test::Cluster; use PostgreSQL::Test::Utils; -use Test::More tests => 5; +use Test::More; my $node = PostgreSQL::Test::Cluster->new('test'); $node->init; @@ -57,3 +57,5 @@ $node->command_checks_all( [], 'pg_amcheck all schemas, tables and indexes reports fickleidx corruption' ); + +done_testing(); diff --git a/src/bin/pg_archivecleanup/t/010_pg_archivecleanup.pl b/src/bin/pg_archivecleanup/t/010_pg_archivecleanup.pl index 60331e0a17e..4894a2e4839 100644 --- a/src/bin/pg_archivecleanup/t/010_pg_archivecleanup.pl +++ b/src/bin/pg_archivecleanup/t/010_pg_archivecleanup.pl @@ -4,7 +4,7 @@ use strict; use warnings; use PostgreSQL::Test::Utils; -use Test::More tests => 42; +use Test::More; program_help_ok('pg_archivecleanup'); program_version_ok('pg_archivecleanup'); @@ -101,3 +101,5 @@ sub run_check run_check('', 'pg_archivecleanup'); run_check('.partial', 'pg_archivecleanup with .partial file'); run_check('.00000020.backup', 'pg_archivecleanup with .backup file'); + +done_testing(); diff --git a/src/bin/pg_basebackup/t/020_pg_receivewal.pl b/src/bin/pg_basebackup/t/020_pg_receivewal.pl index 98dbdab595c..0e6e685aa69 100644 --- a/src/bin/pg_basebackup/t/020_pg_receivewal.pl +++ b/src/bin/pg_basebackup/t/020_pg_receivewal.pl @@ -5,7 +5,7 @@ use strict; use warnings; use PostgreSQL::Test::Utils; use PostgreSQL::Test::Cluster; -use Test::More tests => 42; +use Test::More; program_help_ok('pg_receivewal'); program_version_ok('pg_receivewal'); @@ -334,3 +334,5 @@ ok(-e "$timeline_dir/$walfile_after_promotion", "WAL segment $walfile_after_promotion archived after timeline jump"); ok(-e "$timeline_dir/00000002.history", "timeline history file archived after timeline jump"); + +done_testing(); diff --git a/src/bin/pg_basebackup/t/030_pg_recvlogical.pl b/src/bin/pg_basebackup/t/030_pg_recvlogical.pl index 64f2f571fdb..201196f9573 100644 --- a/src/bin/pg_basebackup/t/030_pg_recvlogical.pl +++ b/src/bin/pg_basebackup/t/030_pg_recvlogical.pl @@ -5,7 +5,7 @@ use strict; use warnings; use PostgreSQL::Test::Utils; use PostgreSQL::Test::Cluster; -use Test::More tests => 20; +use Test::More; program_help_ok('pg_recvlogical'); program_version_ok('pg_recvlogical'); @@ -106,3 +106,5 @@ $node->command_ok( '--start', '--endpos', "$nextlsn", '--no-loop', '-f', '-' ], 'replayed a two-phase transaction'); + +done_testing(); diff --git a/src/bin/pg_checksums/t/001_basic.pl b/src/bin/pg_checksums/t/001_basic.pl index fd03e8df0f6..d7cede111e9 100644 --- a/src/bin/pg_checksums/t/001_basic.pl +++ b/src/bin/pg_checksums/t/001_basic.pl @@ -4,8 +4,10 @@ use strict; use warnings; use PostgreSQL::Test::Utils; -use Test::More tests => 8; +use Test::More; program_help_ok('pg_checksums'); program_version_ok('pg_checksums'); program_options_handling_ok('pg_checksums'); + +done_testing(); diff --git a/src/bin/pg_checksums/t/002_actions.pl b/src/bin/pg_checksums/t/002_actions.pl index 7b515dfc6d1..5563244f11e 100644 --- a/src/bin/pg_checksums/t/002_actions.pl +++ b/src/bin/pg_checksums/t/002_actions.pl @@ -11,7 +11,7 @@ use PostgreSQL::Test::Cluster; use PostgreSQL::Test::Utils; use Fcntl qw(:seek); -use Test::More tests => 66; +use Test::More; # Utility routine to create and check a table with corrupted checksums @@ -257,3 +257,5 @@ fail_corrupt($node, "99990_vm"); fail_corrupt($node, "99990_init.123"); fail_corrupt($node, "99990_fsm.123"); fail_corrupt($node, "99990_vm.123"); + +done_testing(); diff --git a/src/bin/pg_config/t/001_pg_config.pl b/src/bin/pg_config/t/001_pg_config.pl index cff4d6ebc90..9a891090688 100644 --- a/src/bin/pg_config/t/001_pg_config.pl +++ b/src/bin/pg_config/t/001_pg_config.pl @@ -4,7 +4,7 @@ use strict; use warnings; use PostgreSQL::Test::Utils; -use Test::More tests => 20; +use Test::More; program_help_ok('pg_config'); program_version_ok('pg_config'); @@ -17,3 +17,5 @@ command_like([ 'pg_config', '--libdir', '--bindir' ], qr/lib.*\n.*bin/, 'pg_config two options different order'); command_like(['pg_config'], qr/.*\n.*\n.*/, 'pg_config without options prints many lines'); + +done_testing(); diff --git a/src/bin/pg_controldata/t/001_pg_controldata.pl b/src/bin/pg_controldata/t/001_pg_controldata.pl index 2f02966bf43..adb9af4e938 100644 --- a/src/bin/pg_controldata/t/001_pg_controldata.pl +++ b/src/bin/pg_controldata/t/001_pg_controldata.pl @@ -5,7 +5,7 @@ use strict; use warnings; use PostgreSQL::Test::Cluster; use PostgreSQL::Test::Utils; -use Test::More tests => 17; +use Test::More; program_help_ok('pg_controldata'); program_version_ok('pg_controldata'); @@ -42,3 +42,5 @@ command_checks_all( ], [qr/^$/], 'pg_controldata with corrupted pg_control'); + +done_testing(); diff --git a/src/bin/pg_ctl/t/001_start_stop.pl b/src/bin/pg_ctl/t/001_start_stop.pl index a084d09cd49..7d3fbc3f6a9 100644 --- a/src/bin/pg_ctl/t/001_start_stop.pl +++ b/src/bin/pg_ctl/t/001_start_stop.pl @@ -9,7 +9,7 @@ use Fcntl ':mode'; use File::stat qw{lstat}; use PostgreSQL::Test::Cluster; use PostgreSQL::Test::Utils; -use Test::More tests => 24; +use Test::More; my $tempdir = PostgreSQL::Test::Utils::tempdir; my $tempdir_short = PostgreSQL::Test::Utils::tempdir_short; @@ -111,3 +111,5 @@ command_ok([ 'pg_ctl', 'restart', '-D', "$tempdir/data" ], 'pg_ctl restart with server running'); system_or_bail 'pg_ctl', 'stop', '-D', "$tempdir/data"; + +done_testing(); diff --git a/src/bin/pg_ctl/t/002_status.pl b/src/bin/pg_ctl/t/002_status.pl index 38c901f88a1..2503d74a76d 100644 --- a/src/bin/pg_ctl/t/002_status.pl +++ b/src/bin/pg_ctl/t/002_status.pl @@ -6,7 +6,7 @@ use warnings; use PostgreSQL::Test::Cluster; use PostgreSQL::Test::Utils; -use Test::More tests => 3; +use Test::More; my $tempdir = PostgreSQL::Test::Utils::tempdir; @@ -25,3 +25,5 @@ command_exit_is([ 'pg_ctl', 'status', '-D', $node->data_dir ], 0, 'pg_ctl status with server running'); system_or_bail 'pg_ctl', 'stop', '-D', $node->data_dir; + +done_testing(); diff --git a/src/bin/pg_ctl/t/003_promote.pl b/src/bin/pg_ctl/t/003_promote.pl index b14bf1d7b04..84d28f4c775 100644 --- a/src/bin/pg_ctl/t/003_promote.pl +++ b/src/bin/pg_ctl/t/003_promote.pl @@ -6,7 +6,7 @@ use warnings; use PostgreSQL::Test::Cluster; use PostgreSQL::Test::Utils; -use Test::More tests => 12; +use Test::More; my $tempdir = PostgreSQL::Test::Utils::tempdir; @@ -62,3 +62,5 @@ command_ok([ 'pg_ctl', '-D', $node_standby->data_dir, 'promote' ], is($node_standby->safe_psql('postgres', 'SELECT pg_is_in_recovery()'), 'f', 'promoted standby is not in recovery'); + +done_testing(); diff --git a/src/bin/pg_ctl/t/004_logrotate.pl b/src/bin/pg_ctl/t/004_logrotate.pl index de6028760d5..d2904521001 100644 --- a/src/bin/pg_ctl/t/004_logrotate.pl +++ b/src/bin/pg_ctl/t/004_logrotate.pl @@ -6,7 +6,7 @@ use warnings; use PostgreSQL::Test::Cluster; use PostgreSQL::Test::Utils; -use Test::More tests => 14; +use Test::More; use Time::HiRes qw(usleep); # Extract the file name of a $format from the contents of @@ -136,3 +136,5 @@ check_log_pattern('csvlog', $new_current_logfiles, 'syntax error', $node); check_log_pattern('jsonlog', $new_current_logfiles, 'syntax error', $node); $node->stop(); + +done_testing(); diff --git a/src/bin/pg_dump/t/001_basic.pl b/src/bin/pg_dump/t/001_basic.pl index d53bef9aa74..48faeb43714 100644 --- a/src/bin/pg_dump/t/001_basic.pl +++ b/src/bin/pg_dump/t/001_basic.pl @@ -7,7 +7,7 @@ use warnings; use Config; use PostgreSQL::Test::Cluster; use PostgreSQL::Test::Utils; -use Test::More tests => 82; +use Test::More; my $tempdir = PostgreSQL::Test::Utils::tempdir; @@ -188,3 +188,5 @@ command_fails_like( qr/\Qpg_dumpall: error: option --exclude-database cannot be used together with -g\/--globals-only\E/, 'pg_dumpall: option --exclude-database cannot be used together with -g/--globals-only' ); + +done_testing(); diff --git a/src/bin/pg_dump/t/002_pg_dump.pl b/src/bin/pg_dump/t/002_pg_dump.pl index 39fa1952e70..dd065c758fa 100644 --- a/src/bin/pg_dump/t/002_pg_dump.pl +++ b/src/bin/pg_dump/t/002_pg_dump.pl @@ -3714,82 +3714,6 @@ my $supports_lz4 = check_pg_config("#define HAVE_LIBLZ4 1"); $node->psql('postgres', 'create database regress_pg_dump_test;'); $node->psql('postgres', 'create database regress_public_owner;'); -# Start with number of command_fails_like()*2 tests below (each -# command_fails_like is actually 2 tests) -my $num_tests = 12; - -foreach my $run (sort keys %pgdump_runs) -{ - my $test_key = $run; - my $run_db = 'postgres'; - - if (defined($pgdump_runs{$run}->{database})) - { - $run_db = $pgdump_runs{$run}->{database}; - } - - # Each run of pg_dump is a test itself - $num_tests++; - - # If there is a restore cmd, that's another test - if ($pgdump_runs{$run}->{restore_cmd}) - { - $num_tests++; - } - - if ($pgdump_runs{$run}->{test_key}) - { - $test_key = $pgdump_runs{$run}->{test_key}; - } - - # Then count all the tests run against each run - foreach my $test (sort keys %tests) - { - - # postgres is the default database, if it isn't overridden - my $test_db = 'postgres'; - - # Specific tests can override the database to use - if (defined($tests{$test}->{database})) - { - $test_db = $tests{$test}->{database}; - } - - # The database to test against needs to match the database the run is - # for, so skip combinations where they don't match up. - if ($run_db ne $test_db) - { - next; - } - - # Skip any collation-related commands if there is no collation support - if (!$collation_support && defined($tests{$test}->{collation})) - { - next; - } - - # Skip tests specific to LZ4 if this build does not support - # this option. - if (!$supports_lz4 && defined($tests{$test}->{lz4})) - { - next; - } - - # If there is a like entry, but no unlike entry, then we will test the like case - if ($tests{$test}->{like}->{$test_key} - && !defined($tests{$test}->{unlike}->{$test_key})) - { - $num_tests++; - } - else - { - # We will test everything that isn't a 'like' - $num_tests++; - } - } -} -plan tests => $num_tests; - ######################################### # Set up schemas, tables, etc, to be dumped. @@ -3975,3 +3899,5 @@ foreach my $run (sort keys %pgdump_runs) # Stop the database instance, which will be removed at the end of the tests. $node->stop('fast'); + +done_testing(); diff --git a/src/bin/pg_dump/t/003_pg_dump_with_server.pl b/src/bin/pg_dump/t/003_pg_dump_with_server.pl index 43c9a9fbf89..528db179cbd 100644 --- a/src/bin/pg_dump/t/003_pg_dump_with_server.pl +++ b/src/bin/pg_dump/t/003_pg_dump_with_server.pl @@ -6,7 +6,7 @@ use warnings; use PostgreSQL::Test::Cluster; use PostgreSQL::Test::Utils; -use Test::More tests => 3; +use Test::More; my $tempdir = PostgreSQL::Test::Utils::tempdir; @@ -36,3 +36,5 @@ command_fails_like( command_ok( [ "pg_dump", '-p', $port, '-a', '--include-foreign-data=s2', 'postgres' ], "dump foreign server with no tables"); + +done_testing(); diff --git a/src/bin/pg_dump/t/010_dump_connstr.pl b/src/bin/pg_dump/t/010_dump_connstr.pl index 2f7919a4b31..7a745ade0fb 100644 --- a/src/bin/pg_dump/t/010_dump_connstr.pl +++ b/src/bin/pg_dump/t/010_dump_connstr.pl @@ -12,10 +12,6 @@ if ($PostgreSQL::Test::Utils::is_msys2) { plan skip_all => 'High bit name tests fail on Msys2'; } -else -{ - plan tests => 14; -} # We're going to use byte sequences that aren't valid UTF-8 strings. Use # LATIN1, which accepts any byte and has a conversion from each byte to UTF-8. @@ -229,3 +225,5 @@ $cmdline_node->run_log( ok($result, 'restore full dump with command-line options for connection parameters'); is($stderr, '', 'no dump errors'); + +done_testing(); diff --git a/src/bin/pg_resetwal/t/001_basic.pl b/src/bin/pg_resetwal/t/001_basic.pl index f9a5e02db2f..b4b192c86cc 100644 --- a/src/bin/pg_resetwal/t/001_basic.pl +++ b/src/bin/pg_resetwal/t/001_basic.pl @@ -6,7 +6,7 @@ use warnings; use PostgreSQL::Test::Cluster; use PostgreSQL::Test::Utils; -use Test::More tests => 12; +use Test::More; program_help_ok('pg_resetwal'); program_version_ok('pg_resetwal'); @@ -28,3 +28,5 @@ SKIP: ok(check_mode_recursive($node->data_dir, 0700, 0600), 'check PGDATA permissions'); } + +done_testing(); diff --git a/src/bin/pg_resetwal/t/002_corrupted.pl b/src/bin/pg_resetwal/t/002_corrupted.pl index 52678428b54..cb4f451d250 100644 --- a/src/bin/pg_resetwal/t/002_corrupted.pl +++ b/src/bin/pg_resetwal/t/002_corrupted.pl @@ -8,7 +8,7 @@ use warnings; use PostgreSQL::Test::Cluster; use PostgreSQL::Test::Utils; -use Test::More tests => 6; +use Test::More; my $node = PostgreSQL::Test::Cluster->new('main'); $node->init; @@ -54,3 +54,5 @@ command_checks_all( qr/\Qpg_resetwal: warning: pg_control specifies invalid WAL segment size (0 bytes); proceed with caution\E/ ], 'processes zero WAL segment size'); + +done_testing(); diff --git a/src/bin/pg_rewind/t/001_basic.pl b/src/bin/pg_rewind/t/001_basic.pl index a20ebda3455..db9201f38e8 100644 --- a/src/bin/pg_rewind/t/001_basic.pl +++ b/src/bin/pg_rewind/t/001_basic.pl @@ -4,7 +4,7 @@ use strict; use warnings; use PostgreSQL::Test::Utils; -use Test::More tests => 23; +use Test::More; use FindBin; use lib $FindBin::RealBin; @@ -191,4 +191,4 @@ run_test('local'); run_test('remote'); run_test('archive'); -exit(0); +done_testing(); diff --git a/src/bin/pg_rewind/t/002_databases.pl b/src/bin/pg_rewind/t/002_databases.pl index 5fac050e4b1..8d6c0c0b280 100644 --- a/src/bin/pg_rewind/t/002_databases.pl +++ b/src/bin/pg_rewind/t/002_databases.pl @@ -4,7 +4,7 @@ use strict; use warnings; use PostgreSQL::Test::Utils; -use Test::More tests => 7; +use Test::More; use FindBin; use lib $FindBin::RealBin; @@ -74,4 +74,4 @@ template1 run_test('local'); run_test('remote'); -exit(0); +done_testing(); diff --git a/src/bin/pg_rewind/t/003_extrafiles.pl b/src/bin/pg_rewind/t/003_extrafiles.pl index 0d140342f23..b1c47ea4514 100644 --- a/src/bin/pg_rewind/t/003_extrafiles.pl +++ b/src/bin/pg_rewind/t/003_extrafiles.pl @@ -6,7 +6,7 @@ use strict; use warnings; use PostgreSQL::Test::Utils; -use Test::More tests => 5; +use Test::More; use File::Find; @@ -103,4 +103,4 @@ sub run_test run_test('local'); run_test('remote'); -exit(0); +done_testing(); diff --git a/src/bin/pg_rewind/t/004_pg_xlog_symlink.pl b/src/bin/pg_rewind/t/004_pg_xlog_symlink.pl index 9754fa7665f..805935c6fd5 100644 --- a/src/bin/pg_rewind/t/004_pg_xlog_symlink.pl +++ b/src/bin/pg_rewind/t/004_pg_xlog_symlink.pl @@ -9,7 +9,7 @@ use warnings; use File::Copy; use File::Path qw(rmtree); use PostgreSQL::Test::Utils; -use Test::More tests => 5; +use Test::More; use FindBin; use lib $FindBin::RealBin; @@ -76,4 +76,4 @@ in standby, after promotion run_test('local'); run_test('remote'); -exit(0); +done_testing(); diff --git a/src/bin/pg_rewind/t/005_same_timeline.pl b/src/bin/pg_rewind/t/005_same_timeline.pl index 2249694d9a6..ffb62f9b05a 100644 --- a/src/bin/pg_rewind/t/005_same_timeline.pl +++ b/src/bin/pg_rewind/t/005_same_timeline.pl @@ -8,7 +8,7 @@ use strict; use warnings; use PostgreSQL::Test::Utils; -use Test::More tests => 1; +use Test::More; use FindBin; use lib $FindBin::RealBin; @@ -20,4 +20,5 @@ RewindTest::start_primary(); RewindTest::create_standby(); RewindTest::run_pg_rewind('local'); RewindTest::clean_rewind_test(); -exit(0); + +done_testing(); diff --git a/src/bin/pg_rewind/t/006_options.pl b/src/bin/pg_rewind/t/006_options.pl index b5f502350f7..c3c27e9894c 100644 --- a/src/bin/pg_rewind/t/006_options.pl +++ b/src/bin/pg_rewind/t/006_options.pl @@ -7,7 +7,7 @@ use strict; use warnings; use PostgreSQL::Test::Utils; -use Test::More tests => 12; +use Test::More; program_help_ok('pg_rewind'); program_version_ok('pg_rewind'); @@ -41,3 +41,5 @@ command_fails( '--write-recovery-conf' ], 'no local source with --write-recovery-conf'); + +done_testing(); diff --git a/src/bin/pg_rewind/t/007_standby_source.pl b/src/bin/pg_rewind/t/007_standby_source.pl index df2e72912b4..47320ea5a67 100644 --- a/src/bin/pg_rewind/t/007_standby_source.pl +++ b/src/bin/pg_rewind/t/007_standby_source.pl @@ -27,7 +27,7 @@ use strict; use warnings; use PostgreSQL::Test::Utils; -use Test::More tests => 3; +use Test::More; use FindBin; use lib $FindBin::RealBin; @@ -176,4 +176,4 @@ $node_a->teardown_node; $node_b->teardown_node; $node_c->teardown_node; -exit(0); +done_testing(); diff --git a/src/bin/pg_rewind/t/008_min_recovery_point.pl b/src/bin/pg_rewind/t/008_min_recovery_point.pl index 8240229230d..e6a7177fb7d 100644 --- a/src/bin/pg_rewind/t/008_min_recovery_point.pl +++ b/src/bin/pg_rewind/t/008_min_recovery_point.pl @@ -34,7 +34,7 @@ use strict; use warnings; use PostgreSQL::Test::Cluster; use PostgreSQL::Test::Utils; -use Test::More tests => 3; +use Test::More; use File::Copy; @@ -173,3 +173,5 @@ and this too), 'table foo after rewind'); $result = $node_2->safe_psql('postgres', 'SELECT * FROM public.bar'); is($result, qq(in both), 'table bar after rewind'); + +done_testing(); diff --git a/src/bin/pg_test_fsync/t/001_basic.pl b/src/bin/pg_test_fsync/t/001_basic.pl index ecfe89a9f20..0b579dde9d6 100644 --- a/src/bin/pg_test_fsync/t/001_basic.pl +++ b/src/bin/pg_test_fsync/t/001_basic.pl @@ -6,7 +6,7 @@ use warnings; use Config; use PostgreSQL::Test::Utils; -use Test::More tests => 12; +use Test::More; ######################################### # Basic checks @@ -26,3 +26,5 @@ command_fails_like( [ 'pg_test_fsync', '--secs-per-test', '0' ], qr/\Qpg_test_fsync: error: --secs-per-test must be in range 1..4294967295\E/, 'pg_test_fsync: --secs-per-test must be in range'); + +done_testing(); diff --git a/src/bin/pg_test_timing/t/001_basic.pl b/src/bin/pg_test_timing/t/001_basic.pl index e2c43070757..ef9f6d67469 100644 --- a/src/bin/pg_test_timing/t/001_basic.pl +++ b/src/bin/pg_test_timing/t/001_basic.pl @@ -6,7 +6,7 @@ use warnings; use Config; use PostgreSQL::Test::Utils; -use Test::More tests => 12; +use Test::More; ######################################### # Basic checks @@ -26,3 +26,5 @@ command_fails_like( [ 'pg_test_timing', '--duration', '0' ], qr/\Qpg_test_timing: --duration must be in range 1..4294967295\E/, 'pg_test_timing: --duration must be in range'); + +done_testing(); diff --git a/src/bin/pg_verifybackup/t/001_basic.pl b/src/bin/pg_verifybackup/t/001_basic.pl index 452f753ab32..16febf9764c 100644 --- a/src/bin/pg_verifybackup/t/001_basic.pl +++ b/src/bin/pg_verifybackup/t/001_basic.pl @@ -4,7 +4,7 @@ use strict; use warnings; use PostgreSQL::Test::Utils; -use Test::More tests => 16; +use Test::More; my $tempdir = PostgreSQL::Test::Utils::tempdir; @@ -34,3 +34,5 @@ command_fails_like( [ 'pg_verifybackup', '-m', "$tempdir/not_the_manifest", $tempdir ], qr/could not open file.*\/not_the_manifest\"/, 'pg_verifybackup respects -m flag'); + +done_testing(); diff --git a/src/bin/pg_verifybackup/t/002_algorithm.pl b/src/bin/pg_verifybackup/t/002_algorithm.pl index 5d9965ba8f4..20e3ca587a5 100644 --- a/src/bin/pg_verifybackup/t/002_algorithm.pl +++ b/src/bin/pg_verifybackup/t/002_algorithm.pl @@ -10,7 +10,7 @@ use Config; use File::Path qw(rmtree); use PostgreSQL::Test::Cluster; use PostgreSQL::Test::Utils; -use Test::More tests => 19; +use Test::More; my $primary = PostgreSQL::Test::Cluster->new('primary'); $primary->init(allows_streaming => 1); @@ -59,3 +59,5 @@ for my $algorithm (qw(bogus none crc32c sha224 sha256 sha384 sha512)) # Remove backup immediately to save disk space. rmtree($backup_path); } + +done_testing(); diff --git a/src/bin/pg_verifybackup/t/003_corruption.pl b/src/bin/pg_verifybackup/t/003_corruption.pl index 53be2efd87d..f402d301ac7 100644 --- a/src/bin/pg_verifybackup/t/003_corruption.pl +++ b/src/bin/pg_verifybackup/t/003_corruption.pl @@ -10,7 +10,7 @@ use Config; use File::Path qw(rmtree); use PostgreSQL::Test::Cluster; use PostgreSQL::Test::Utils; -use Test::More tests => 44; +use Test::More; my $primary = PostgreSQL::Test::Cluster->new('primary'); $primary->init(allows_streaming => 1); @@ -290,3 +290,5 @@ sub cleanup_search_directory_fails chmod(0700, $pathname) || die "chmod $pathname: $!"; return; } + +done_testing(); diff --git a/src/bin/pg_verifybackup/t/004_options.pl b/src/bin/pg_verifybackup/t/004_options.pl index 5a8fd9b0ecb..7461dee03fc 100644 --- a/src/bin/pg_verifybackup/t/004_options.pl +++ b/src/bin/pg_verifybackup/t/004_options.pl @@ -10,7 +10,7 @@ use Config; use File::Path qw(rmtree); use PostgreSQL::Test::Cluster; use PostgreSQL::Test::Utils; -use Test::More tests => 25; +use Test::More; # Start up the server and take a backup. my $primary = PostgreSQL::Test::Cluster->new('primary'); @@ -105,3 +105,5 @@ command_fails_like( ], qr/could not open directory/, 'nonexistent backup directory'); + +done_testing(); diff --git a/src/bin/pg_verifybackup/t/005_bad_manifest.pl b/src/bin/pg_verifybackup/t/005_bad_manifest.pl index ced516877d8..118beb53d77 100644 --- a/src/bin/pg_verifybackup/t/005_bad_manifest.pl +++ b/src/bin/pg_verifybackup/t/005_bad_manifest.pl @@ -10,7 +10,7 @@ use Cwd; use Config; use PostgreSQL::Test::Cluster; use PostgreSQL::Test::Utils; -use Test::More tests => 58; +use Test::More; my $tempdir = PostgreSQL::Test::Utils::tempdir; @@ -209,3 +209,5 @@ sub test_bad_manifest command_fails_like([ 'pg_verifybackup', $tempdir ], $regexp, $test_name); return; } + +done_testing(); diff --git a/src/bin/pg_verifybackup/t/006_encoding.pl b/src/bin/pg_verifybackup/t/006_encoding.pl index b869cd8fe6e..ce45c919a8c 100644 --- a/src/bin/pg_verifybackup/t/006_encoding.pl +++ b/src/bin/pg_verifybackup/t/006_encoding.pl @@ -9,7 +9,7 @@ use Cwd; use Config; use PostgreSQL::Test::Cluster; use PostgreSQL::Test::Utils; -use Test::More tests => 5; +use Test::More; my $primary = PostgreSQL::Test::Cluster->new('primary'); $primary->init(allows_streaming => 1); @@ -32,3 +32,5 @@ command_like( [ 'pg_verifybackup', '-s', $backup_path ], qr/backup successfully verified/, 'backup with forced encoding verified'); + +done_testing(); diff --git a/src/bin/pg_verifybackup/t/007_wal.pl b/src/bin/pg_verifybackup/t/007_wal.pl index 4723047d73d..56fcd84bec7 100644 --- a/src/bin/pg_verifybackup/t/007_wal.pl +++ b/src/bin/pg_verifybackup/t/007_wal.pl @@ -10,7 +10,7 @@ use Config; use File::Path qw(rmtree); use PostgreSQL::Test::Cluster; use PostgreSQL::Test::Utils; -use Test::More tests => 9; +use Test::More; # Start up the server and take a backup. my $primary = PostgreSQL::Test::Cluster->new('primary'); @@ -76,3 +76,5 @@ $primary->command_ok([ 'pg_basebackup', '-D', $backup_path2, '--no-sync', '-cfas command_ok( [ 'pg_verifybackup', $backup_path2 ], 'valid base backup with timeline > 1'); + +done_testing(); diff --git a/src/bin/pg_verifybackup/t/008_untar.pl b/src/bin/pg_verifybackup/t/008_untar.pl index 9d5b0e139a2..03f98966bdd 100644 --- a/src/bin/pg_verifybackup/t/008_untar.pl +++ b/src/bin/pg_verifybackup/t/008_untar.pl @@ -11,7 +11,7 @@ use Config; use File::Path qw(rmtree); use PostgreSQL::Test::Cluster; use PostgreSQL::Test::Utils; -use Test::More tests => 9; +use Test::More; my $primary = PostgreSQL::Test::Cluster->new('primary'); $primary->init(allows_streaming => 1); @@ -110,3 +110,5 @@ for my $tc (@test_configuration) rmtree($extract_path); } } + +done_testing(); diff --git a/src/bin/pg_verifybackup/t/009_extract.pl b/src/bin/pg_verifybackup/t/009_extract.pl index 9f9a7cc6a5f..c51cdf79f8c 100644 --- a/src/bin/pg_verifybackup/t/009_extract.pl +++ b/src/bin/pg_verifybackup/t/009_extract.pl @@ -11,8 +11,7 @@ use Config; use File::Path qw(rmtree); use PostgreSQL::Test::Cluster; use PostgreSQL::Test::Utils; -use Test::More tests => 6; - +use Test::More; my $primary = PostgreSQL::Test::Cluster->new('primary'); $primary->init(allows_streaming => 1); $primary->start; @@ -64,3 +63,5 @@ for my $tc (@test_configuration) # Remove backup immediately to save disk space. rmtree($backup_path); } + +done_testing(); diff --git a/src/bin/pg_verifybackup/t/010_client_untar.pl b/src/bin/pg_verifybackup/t/010_client_untar.pl index 34c9b90669d..159a4f86df0 100644 --- a/src/bin/pg_verifybackup/t/010_client_untar.pl +++ b/src/bin/pg_verifybackup/t/010_client_untar.pl @@ -10,7 +10,7 @@ use Config; use File::Path qw(rmtree); use PostgreSQL::Test::Cluster; use PostgreSQL::Test::Utils; -use Test::More tests => 9; +use Test::More; my $primary = PostgreSQL::Test::Cluster->new('primary'); $primary->init(allows_streaming => 1); @@ -109,3 +109,5 @@ for my $tc (@test_configuration) rmtree($backup_path); } } + +done_testing(); diff --git a/src/bin/pg_waldump/t/001_basic.pl b/src/bin/pg_waldump/t/001_basic.pl index 987d3eb6142..883adff8fa1 100644 --- a/src/bin/pg_waldump/t/001_basic.pl +++ b/src/bin/pg_waldump/t/001_basic.pl @@ -4,8 +4,10 @@ use strict; use warnings; use PostgreSQL::Test::Utils; -use Test::More tests => 8; +use Test::More; program_help_ok('pg_waldump'); program_version_ok('pg_waldump'); program_options_handling_ok('pg_waldump'); + +done_testing(); diff --git a/src/bin/psql/t/001_basic.pl b/src/bin/psql/t/001_basic.pl index 9e14dc71ffb..ba3dd846bad 100644 --- a/src/bin/psql/t/001_basic.pl +++ b/src/bin/psql/t/001_basic.pl @@ -6,7 +6,7 @@ use warnings; use PostgreSQL::Test::Cluster; use PostgreSQL::Test::Utils; -use Test::More tests => 25; +use Test::More; program_help_ok('psql'); program_version_ok('psql'); @@ -80,3 +80,5 @@ psql_like( 'handling of unexpected PQresultStatus', 'START_REPLICATION 0/0', undef, qr/unexpected PQresultStatus: 8$/); + +done_testing(); diff --git a/src/bin/psql/t/020_cancel.pl b/src/bin/psql/t/020_cancel.pl index f445fce67af..3224f8e26af 100644 --- a/src/bin/psql/t/020_cancel.pl +++ b/src/bin/psql/t/020_cancel.pl @@ -6,7 +6,7 @@ use warnings; use PostgreSQL::Test::Cluster; use PostgreSQL::Test::Utils; -use Test::More tests => 2; +use Test::More; use Time::HiRes qw(usleep); my $tempdir = PostgreSQL::Test::Utils::tempdir; @@ -64,3 +64,5 @@ SKIP: { ok(!$result, 'query failed as expected'); like($stderr, qr/canceling statement due to user request/, 'query was canceled'); } + +done_testing(); diff --git a/src/bin/scripts/t/010_clusterdb.pl b/src/bin/scripts/t/010_clusterdb.pl index 0878d9fcbb1..3d9abbbcc39 100644 --- a/src/bin/scripts/t/010_clusterdb.pl +++ b/src/bin/scripts/t/010_clusterdb.pl @@ -6,7 +6,7 @@ use warnings; use PostgreSQL::Test::Cluster; use PostgreSQL::Test::Utils; -use Test::More tests => 14; +use Test::More; program_help_ok('clusterdb'); program_version_ok('clusterdb'); @@ -34,3 +34,5 @@ $node->issues_sql_like( $node->command_ok([qw(clusterdb --echo --verbose dbname=template1)], 'clusterdb with connection string'); + +done_testing(); diff --git a/src/bin/scripts/t/011_clusterdb_all.pl b/src/bin/scripts/t/011_clusterdb_all.pl index 81e03a20d03..7818988976c 100644 --- a/src/bin/scripts/t/011_clusterdb_all.pl +++ b/src/bin/scripts/t/011_clusterdb_all.pl @@ -6,7 +6,7 @@ use warnings; use PostgreSQL::Test::Cluster; use PostgreSQL::Test::Utils; -use Test::More tests => 2; +use Test::More; my $node = PostgreSQL::Test::Cluster->new('main'); $node->init; @@ -20,3 +20,5 @@ $node->issues_sql_like( [ 'clusterdb', '-a' ], qr/statement: CLUSTER.*statement: CLUSTER/s, 'cluster all databases'); + +done_testing(); diff --git a/src/bin/scripts/t/020_createdb.pl b/src/bin/scripts/t/020_createdb.pl index c54c291b7ad..639245466e8 100644 --- a/src/bin/scripts/t/020_createdb.pl +++ b/src/bin/scripts/t/020_createdb.pl @@ -6,7 +6,7 @@ use warnings; use PostgreSQL::Test::Cluster; use PostgreSQL::Test::Utils; -use Test::More tests => 25; +use Test::More; program_help_ok('createdb'); program_version_ok('createdb'); @@ -75,3 +75,5 @@ $node->command_checks_all( qr/^createdb: error: database creation failed: ERROR: invalid locale name|^createdb: error: database creation failed: ERROR: new LC_CTYPE \(foo'; SELECT '1\) is incompatible with the LC_CTYPE of the template database/s ], 'createdb with incorrect --lc-ctype'); + +done_testing(); diff --git a/src/bin/scripts/t/040_createuser.pl b/src/bin/scripts/t/040_createuser.pl index e31e5b0c623..2a34be81cf6 100644 --- a/src/bin/scripts/t/040_createuser.pl +++ b/src/bin/scripts/t/040_createuser.pl @@ -6,7 +6,7 @@ use warnings; use PostgreSQL::Test::Cluster; use PostgreSQL::Test::Utils; -use Test::More tests => 17; +use Test::More; program_help_ok('createuser'); program_version_ok('createuser'); @@ -35,3 +35,5 @@ $node->issues_sql_like( $node->command_fails([ 'createuser', 'regress_user1' ], 'fails if role already exists'); + +done_testing(); diff --git a/src/bin/scripts/t/050_dropdb.pl b/src/bin/scripts/t/050_dropdb.pl index 1e08cbbf7f9..4e946667d5e 100644 --- a/src/bin/scripts/t/050_dropdb.pl +++ b/src/bin/scripts/t/050_dropdb.pl @@ -6,7 +6,7 @@ use warnings; use PostgreSQL::Test::Cluster; use PostgreSQL::Test::Utils; -use Test::More tests => 13; +use Test::More; program_help_ok('dropdb'); program_version_ok('dropdb'); @@ -30,3 +30,5 @@ $node->issues_sql_like( $node->command_fails([ 'dropdb', 'nonexistent' ], 'fails with nonexistent database'); + +done_testing(); diff --git a/src/bin/scripts/t/070_dropuser.pl b/src/bin/scripts/t/070_dropuser.pl index c4fb6329bae..e4eac2186de 100644 --- a/src/bin/scripts/t/070_dropuser.pl +++ b/src/bin/scripts/t/070_dropuser.pl @@ -6,7 +6,7 @@ use warnings; use PostgreSQL::Test::Cluster; use PostgreSQL::Test::Utils; -use Test::More tests => 11; +use Test::More; program_help_ok('dropuser'); program_version_ok('dropuser'); @@ -24,3 +24,5 @@ $node->issues_sql_like( $node->command_fails([ 'dropuser', 'regress_nonexistent' ], 'fails with nonexistent user'); + +done_testing(); diff --git a/src/bin/scripts/t/080_pg_isready.pl b/src/bin/scripts/t/080_pg_isready.pl index 951c0e069c4..e8436dc7e8a 100644 --- a/src/bin/scripts/t/080_pg_isready.pl +++ b/src/bin/scripts/t/080_pg_isready.pl @@ -6,7 +6,7 @@ use warnings; use PostgreSQL::Test::Cluster; use PostgreSQL::Test::Utils; -use Test::More tests => 10; +use Test::More; program_help_ok('pg_isready'); program_version_ok('pg_isready'); @@ -21,3 +21,5 @@ $node->start; # use a long timeout for the benefit of very slow buildfarm machines $node->command_ok([qw(pg_isready --timeout=60)], 'succeeds with server running'); + +done_testing(); diff --git a/src/bin/scripts/t/090_reindexdb.pl b/src/bin/scripts/t/090_reindexdb.pl index 1306fb12341..70cd7606dd9 100644 --- a/src/bin/scripts/t/090_reindexdb.pl +++ b/src/bin/scripts/t/090_reindexdb.pl @@ -6,7 +6,7 @@ use warnings; use PostgreSQL::Test::Cluster; use PostgreSQL::Test::Utils; -use Test::More tests => 58; +use Test::More; program_help_ok('reindexdb'); program_version_ok('reindexdb'); @@ -199,3 +199,5 @@ $node->command_checks_all( qr/^reindexdb: warning: cannot reindex system catalogs concurrently, skipping all/s ], 'parallel reindexdb for system with --concurrently skips catalogs'); + +done_testing(); diff --git a/src/bin/scripts/t/091_reindexdb_all.pl b/src/bin/scripts/t/091_reindexdb_all.pl index 47e8341de3f..378bf9060e9 100644 --- a/src/bin/scripts/t/091_reindexdb_all.pl +++ b/src/bin/scripts/t/091_reindexdb_all.pl @@ -5,7 +5,7 @@ use strict; use warnings; use PostgreSQL::Test::Cluster; -use Test::More tests => 2; +use Test::More; my $node = PostgreSQL::Test::Cluster->new('main'); $node->init; @@ -17,3 +17,5 @@ $node->issues_sql_like( [ 'reindexdb', '-a' ], qr/statement: REINDEX.*statement: REINDEX/s, 'reindex all databases'); + +done_testing(); diff --git a/src/bin/scripts/t/100_vacuumdb.pl b/src/bin/scripts/t/100_vacuumdb.pl index ee3bfdb6d05..96a818a3c16 100644 --- a/src/bin/scripts/t/100_vacuumdb.pl +++ b/src/bin/scripts/t/100_vacuumdb.pl @@ -6,7 +6,7 @@ use warnings; use PostgreSQL::Test::Cluster; use PostgreSQL::Test::Utils; -use Test::More tests => 58; +use Test::More; program_help_ok('vacuumdb'); program_version_ok('vacuumdb'); @@ -146,3 +146,5 @@ $node->issues_sql_like( [ 'vacuumdb', '--min-xid-age', '2147483001', 'postgres' ], qr/GREATEST.*relfrozenxid.*2147483001/, 'vacuumdb --table --min-xid-age'); + +done_testing(); diff --git a/src/bin/scripts/t/101_vacuumdb_all.pl b/src/bin/scripts/t/101_vacuumdb_all.pl index 6e8962154ca..1dcf4117671 100644 --- a/src/bin/scripts/t/101_vacuumdb_all.pl +++ b/src/bin/scripts/t/101_vacuumdb_all.pl @@ -5,7 +5,7 @@ use strict; use warnings; use PostgreSQL::Test::Cluster; -use Test::More tests => 2; +use Test::More; my $node = PostgreSQL::Test::Cluster->new('main'); $node->init; @@ -15,3 +15,5 @@ $node->issues_sql_like( [ 'vacuumdb', '-a' ], qr/statement: VACUUM.*statement: VACUUM/s, 'vacuum all databases'); + +done_testing(); diff --git a/src/bin/scripts/t/102_vacuumdb_stages.pl b/src/bin/scripts/t/102_vacuumdb_stages.pl index c94e9e1d642..caff3a3a0da 100644 --- a/src/bin/scripts/t/102_vacuumdb_stages.pl +++ b/src/bin/scripts/t/102_vacuumdb_stages.pl @@ -5,7 +5,7 @@ use strict; use warnings; use PostgreSQL::Test::Cluster; -use Test::More tests => 4; +use Test::More; my $node = PostgreSQL::Test::Cluster->new('main'); $node->init; @@ -36,3 +36,5 @@ $node->issues_sql_like( .*statement:\ RESET\ default_statistics_target; .*statement:\ ANALYZE/sx, 'analyze more than one database in stages'); + +done_testing(); diff --git a/src/bin/scripts/t/200_connstr.pl b/src/bin/scripts/t/200_connstr.pl index 6d75af1d6cb..c865146a6f8 100644 --- a/src/bin/scripts/t/200_connstr.pl +++ b/src/bin/scripts/t/200_connstr.pl @@ -6,7 +6,7 @@ use warnings; use PostgreSQL::Test::Cluster; use PostgreSQL::Test::Utils; -use Test::More tests => 3; +use Test::More; # Tests to check connection string handling in utilities @@ -40,3 +40,5 @@ $node->command_ok([qw(reindexdb --all --echo)], $node->command_ok( [qw(clusterdb --all --echo --verbose)], 'clusterdb --all with unusual database names'); + +done_testing(); |