mirror of
https://github.com/postgres/postgres.git
synced 2025-06-17 17:02:08 +03:00
Remove use of TAP subtests
They turned out to be too much of a portability headache, because they need a fairly new version of Test::More to work properly.
This commit is contained in:
@ -1,7 +1,7 @@
|
|||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use TestLib;
|
use TestLib;
|
||||||
use Test::More tests => 14;
|
use Test::More tests => 19;
|
||||||
|
|
||||||
my $tempdir = TestLib::tempdir;
|
my $tempdir = TestLib::tempdir;
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ use strict;
|
|||||||
use warnings;
|
use warnings;
|
||||||
use Cwd;
|
use Cwd;
|
||||||
use TestLib;
|
use TestLib;
|
||||||
use Test::More tests => 28;
|
use Test::More tests => 33;
|
||||||
|
|
||||||
program_help_ok('pg_basebackup');
|
program_help_ok('pg_basebackup');
|
||||||
program_version_ok('pg_basebackup');
|
program_version_ok('pg_basebackup');
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use TestLib;
|
use TestLib;
|
||||||
use Test::More tests => 3;
|
use Test::More tests => 8;
|
||||||
|
|
||||||
program_help_ok('pg_receivexlog');
|
program_help_ok('pg_receivexlog');
|
||||||
program_version_ok('pg_receivexlog');
|
program_version_ok('pg_receivexlog');
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use TestLib;
|
use TestLib;
|
||||||
use Test::More tests => 7;
|
use Test::More tests => 20;
|
||||||
|
|
||||||
program_help_ok('pg_config');
|
program_help_ok('pg_config');
|
||||||
program_version_ok('pg_config');
|
program_version_ok('pg_config');
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use TestLib;
|
use TestLib;
|
||||||
use Test::More tests => 6;
|
use Test::More tests => 13;
|
||||||
|
|
||||||
my $tempdir = TestLib::tempdir;
|
my $tempdir = TestLib::tempdir;
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use TestLib;
|
use TestLib;
|
||||||
use Test::More tests => 10;
|
use Test::More tests => 15;
|
||||||
|
|
||||||
my $tempdir = TestLib::tempdir;
|
my $tempdir = TestLib::tempdir;
|
||||||
my $tempdir_short = TestLib::tempdir_short;
|
my $tempdir_short = TestLib::tempdir_short;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use TestLib;
|
use TestLib;
|
||||||
use Test::More tests => 6;
|
use Test::More tests => 13;
|
||||||
|
|
||||||
program_help_ok('clusterdb');
|
program_help_ok('clusterdb');
|
||||||
program_version_ok('clusterdb');
|
program_version_ok('clusterdb');
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use TestLib;
|
use TestLib;
|
||||||
use Test::More tests => 1;
|
use Test::More tests => 2;
|
||||||
|
|
||||||
my $tempdir = tempdir;
|
my $tempdir = tempdir;
|
||||||
start_test_server $tempdir;
|
start_test_server $tempdir;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use TestLib;
|
use TestLib;
|
||||||
use Test::More tests => 6;
|
use Test::More tests => 13;
|
||||||
|
|
||||||
program_help_ok('createdb');
|
program_help_ok('createdb');
|
||||||
program_version_ok('createdb');
|
program_version_ok('createdb');
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use TestLib;
|
use TestLib;
|
||||||
use Test::More tests => 6;
|
use Test::More tests => 14;
|
||||||
|
|
||||||
program_help_ok('createlang');
|
program_help_ok('createlang');
|
||||||
program_version_ok('createlang');
|
program_version_ok('createlang');
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use TestLib;
|
use TestLib;
|
||||||
use Test::More tests => 8;
|
use Test::More tests => 17;
|
||||||
|
|
||||||
program_help_ok('createuser');
|
program_help_ok('createuser');
|
||||||
program_version_ok('createuser');
|
program_version_ok('createuser');
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use TestLib;
|
use TestLib;
|
||||||
use Test::More tests => 5;
|
use Test::More tests => 11;
|
||||||
|
|
||||||
program_help_ok('dropdb');
|
program_help_ok('dropdb');
|
||||||
program_version_ok('dropdb');
|
program_version_ok('dropdb');
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use TestLib;
|
use TestLib;
|
||||||
use Test::More tests => 5;
|
use Test::More tests => 11;
|
||||||
|
|
||||||
program_help_ok('droplang');
|
program_help_ok('droplang');
|
||||||
program_version_ok('droplang');
|
program_version_ok('droplang');
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use TestLib;
|
use TestLib;
|
||||||
use Test::More tests => 5;
|
use Test::More tests => 11;
|
||||||
|
|
||||||
program_help_ok('dropuser');
|
program_help_ok('dropuser');
|
||||||
program_version_ok('dropuser');
|
program_version_ok('dropuser');
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use TestLib;
|
use TestLib;
|
||||||
use Test::More tests => 5;
|
use Test::More tests => 10;
|
||||||
|
|
||||||
program_help_ok('pg_isready');
|
program_help_ok('pg_isready');
|
||||||
program_version_ok('pg_isready');
|
program_version_ok('pg_isready');
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use TestLib;
|
use TestLib;
|
||||||
use Test::More tests => 7;
|
use Test::More tests => 16;
|
||||||
|
|
||||||
program_help_ok('reindexdb');
|
program_help_ok('reindexdb');
|
||||||
program_version_ok('reindexdb');
|
program_version_ok('reindexdb');
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use TestLib;
|
use TestLib;
|
||||||
use Test::More tests => 1;
|
use Test::More tests => 2;
|
||||||
|
|
||||||
my $tempdir = tempdir;
|
my $tempdir = tempdir;
|
||||||
start_test_server $tempdir;
|
start_test_server $tempdir;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use TestLib;
|
use TestLib;
|
||||||
use Test::More tests => 8;
|
use Test::More tests => 18;
|
||||||
|
|
||||||
program_help_ok('vacuumdb');
|
program_help_ok('vacuumdb');
|
||||||
program_version_ok('vacuumdb');
|
program_version_ok('vacuumdb');
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use TestLib;
|
use TestLib;
|
||||||
use Test::More tests => 1;
|
use Test::More tests => 2;
|
||||||
|
|
||||||
my $tempdir = tempdir;
|
my $tempdir = tempdir;
|
||||||
start_test_server $tempdir;
|
start_test_server $tempdir;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use TestLib;
|
use TestLib;
|
||||||
use Test::More tests => 2;
|
use Test::More tests => 4;
|
||||||
|
|
||||||
my $tempdir = tempdir;
|
my $tempdir = tempdir;
|
||||||
start_test_server $tempdir;
|
start_test_server $tempdir;
|
||||||
|
@ -37,21 +37,6 @@ BEGIN
|
|||||||
{
|
{
|
||||||
plan skip_all => "IPC::Run not available";
|
plan skip_all => "IPC::Run not available";
|
||||||
};
|
};
|
||||||
|
|
||||||
eval {
|
|
||||||
Test::More->VERSION('0.93_01');
|
|
||||||
} or do
|
|
||||||
{
|
|
||||||
plan skip_all => "version of Test::More is too old to support subplans";
|
|
||||||
};
|
|
||||||
|
|
||||||
eval {
|
|
||||||
require Test::Simple;
|
|
||||||
Test::Simple->VERSION('0.98');
|
|
||||||
} or do
|
|
||||||
{
|
|
||||||
plan skip_all => "version of Test::Simple is too old to support subplans properly";
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Set to untranslated messages, to be able to compare program output
|
# Set to untranslated messages, to be able to compare program output
|
||||||
@ -180,67 +165,51 @@ sub command_exit_is
|
|||||||
sub program_help_ok
|
sub program_help_ok
|
||||||
{
|
{
|
||||||
my ($cmd) = @_;
|
my ($cmd) = @_;
|
||||||
subtest "$cmd --help" => sub {
|
my ($stdout, $stderr);
|
||||||
plan tests => 3;
|
my $result = run [ $cmd, '--help' ], '>', \$stdout, '2>', \$stderr;
|
||||||
my ($stdout, $stderr);
|
ok($result, "$cmd --help exit code 0");
|
||||||
my $result = run [ $cmd, '--help' ], '>', \$stdout, '2>', \$stderr;
|
isnt($stdout, '', "$cmd --help goes to stdout");
|
||||||
ok($result, "$cmd --help exit code 0");
|
is($stderr, '', "$cmd --help nothing to stderr");
|
||||||
isnt($stdout, '', "$cmd --help goes to stdout");
|
|
||||||
is($stderr, '', "$cmd --help nothing to stderr");
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sub program_version_ok
|
sub program_version_ok
|
||||||
{
|
{
|
||||||
my ($cmd) = @_;
|
my ($cmd) = @_;
|
||||||
subtest "$cmd --version" => sub {
|
my ($stdout, $stderr);
|
||||||
plan tests => 3;
|
my $result = run [ $cmd, '--version' ], '>', \$stdout, '2>', \$stderr;
|
||||||
my ($stdout, $stderr);
|
ok($result, "$cmd --version exit code 0");
|
||||||
my $result = run [ $cmd, '--version' ], '>', \$stdout, '2>', \$stderr;
|
isnt($stdout, '', "$cmd --version goes to stdout");
|
||||||
ok($result, "$cmd --version exit code 0");
|
is($stderr, '', "$cmd --version nothing to stderr");
|
||||||
isnt($stdout, '', "$cmd --version goes to stdout");
|
|
||||||
is($stderr, '', "$cmd --version nothing to stderr");
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sub program_options_handling_ok
|
sub program_options_handling_ok
|
||||||
{
|
{
|
||||||
my ($cmd) = @_;
|
my ($cmd) = @_;
|
||||||
subtest "$cmd options handling" => sub {
|
my ($stdout, $stderr);
|
||||||
plan tests => 2;
|
my $result = run [ $cmd, '--not-a-valid-option' ], '>', \$stdout, '2>', \$stderr;
|
||||||
my ($stdout, $stderr);
|
ok(!$result, "$cmd with invalid option nonzero exit code");
|
||||||
my $result = run [ $cmd, '--not-a-valid-option' ], '>', \$stdout,
|
isnt($stderr, '', "$cmd with invalid option prints error message");
|
||||||
'2>', \$stderr;
|
|
||||||
ok(!$result, "$cmd with invalid option nonzero exit code");
|
|
||||||
isnt($stderr, '', "$cmd with invalid option prints error message");
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sub command_like
|
sub command_like
|
||||||
{
|
{
|
||||||
my ($cmd, $expected_stdout, $test_name) = @_;
|
my ($cmd, $expected_stdout, $test_name) = @_;
|
||||||
subtest $test_name => sub {
|
my ($stdout, $stderr);
|
||||||
plan tests => 3;
|
my $result = run $cmd, '>', \$stdout, '2>', \$stderr;
|
||||||
my ($stdout, $stderr);
|
ok($result, "@$cmd exit code 0");
|
||||||
my $result = run $cmd, '>', \$stdout, '2>', \$stderr;
|
is($stderr, '', "@$cmd no stderr");
|
||||||
ok($result, "@$cmd exit code 0");
|
like($stdout, $expected_stdout, "$test_name: matches");
|
||||||
is($stderr, '', "@$cmd no stderr");
|
|
||||||
like($stdout, $expected_stdout, "$test_name: matches");
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sub issues_sql_like
|
sub issues_sql_like
|
||||||
{
|
{
|
||||||
my ($cmd, $expected_sql, $test_name) = @_;
|
my ($cmd, $expected_sql, $test_name) = @_;
|
||||||
subtest $test_name => sub {
|
my ($stdout, $stderr);
|
||||||
plan tests => 2;
|
truncate $test_server_logfile, 0;
|
||||||
my ($stdout, $stderr);
|
my $result = run $cmd, '>', \$stdout, '2>', \$stderr;
|
||||||
truncate $test_server_logfile, 0;
|
ok($result, "@$cmd exit code 0");
|
||||||
my $result = run $cmd, '>', \$stdout, '2>', \$stderr;
|
my $log = `cat '$test_server_logfile'`;
|
||||||
ok($result, "@$cmd exit code 0");
|
like($log, $expected_sql, "$test_name: SQL found in server log");
|
||||||
my $log = `cat '$test_server_logfile'`;
|
|
||||||
like($log, $expected_sql, "$test_name: SQL found in server log");
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
Reference in New Issue
Block a user