mirror of
https://github.com/postgres/postgres.git
synced 2025-07-23 03:21:12 +03:00
Add test for pg_upgrade file transfer modes.
This new test checks all of pg_upgrade's file transfer modes. For each mode, we verify that pg_upgrade either succeeds (and some test objects successfully reach the new version) or fails with an error that indicates the mode is not supported on the current platform. For cross-version tests, we also check that pg_upgrade transfers non-default tablespaces. (Tablespaces can't be tested on same version upgrades because of the version-specific subdirectory conflict, but we might be able to enable such tests once we teach pg_upgrade how to handle in-place tablespaces.) Suggested-by: Robert Haas <robertmhaas@gmail.com> Reviewed-by: Andres Freund <andres@anarazel.de> Discussion: https://postgr.es/m/Zyvop-LxLXBLrZil%40nathan
This commit is contained in:
@ -89,6 +89,7 @@ our @EXPORT = qw(
|
||||
command_like
|
||||
command_like_safe
|
||||
command_fails_like
|
||||
command_ok_or_fails_like
|
||||
command_checks_all
|
||||
|
||||
$windows_os
|
||||
@ -1067,6 +1068,30 @@ sub command_fails_like
|
||||
|
||||
=pod
|
||||
|
||||
=item command_ok_or_fails_like(cmd, expected_stdout, expected_stderr, test_name)
|
||||
|
||||
Check that the command either succeeds or fails with an error that matches the
|
||||
given regular expressions.
|
||||
|
||||
=cut
|
||||
|
||||
sub command_ok_or_fails_like
|
||||
{
|
||||
local $Test::Builder::Level = $Test::Builder::Level + 1;
|
||||
my ($cmd, $expected_stdout, $expected_stderr, $test_name) = @_;
|
||||
my ($stdout, $stderr);
|
||||
print("# Running: " . join(" ", @{$cmd}) . "\n");
|
||||
my $result = IPC::Run::run $cmd, '>' => \$stdout, '2>' => \$stderr;
|
||||
if (!$result)
|
||||
{
|
||||
like($stdout, $expected_stdout, "$test_name: stdout matches");
|
||||
like($stderr, $expected_stderr, "$test_name: stderr matches");
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
=pod
|
||||
|
||||
=item command_checks_all(cmd, ret, out, err, test_name)
|
||||
|
||||
Run a command and check its status and outputs.
|
||||
|
Reference in New Issue
Block a user