aboutsummaryrefslogtreecommitdiff
path: root/src/test/perl/TestLib.pm
diff options
context:
space:
mode:
authorPeter Eisentraut <peter_e@gmx.net>2016-07-26 10:48:43 -0400
committerPeter Eisentraut <peter_e@gmx.net>2016-09-21 12:00:00 -0400
commiteb5089a05ba0852cc3eafea53c5d23e7633fca81 (patch)
tree190319097f6cc3fcaeebb8aec4c46f830d5fbcbe /src/test/perl/TestLib.pm
parente767db2242079b4ec2a7bbd18da7649d9ee1d696 (diff)
downloadpostgresql-eb5089a05ba0852cc3eafea53c5d23e7633fca81.tar.gz
postgresql-eb5089a05ba0852cc3eafea53c5d23e7633fca81.zip
pg_ctl: Add tests for promote action
Reviewed-by: Michael Paquier <michael.paquier@gmail.com>
Diffstat (limited to 'src/test/perl/TestLib.pm')
-rw-r--r--src/test/perl/TestLib.pm11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/test/perl/TestLib.pm b/src/test/perl/TestLib.pm
index c7b3262087d..51b533e08cd 100644
--- a/src/test/perl/TestLib.pm
+++ b/src/test/perl/TestLib.pm
@@ -34,6 +34,7 @@ our @EXPORT = qw(
program_version_ok
program_options_handling_ok
command_like
+ command_fails_like
$windows_os
);
@@ -281,4 +282,14 @@ sub command_like
like($stdout, $expected_stdout, "$test_name: matches");
}
+sub command_fails_like
+{
+ my ($cmd, $expected_stderr, $test_name) = @_;
+ my ($stdout, $stderr);
+ print("# Running: " . join(" ", @{$cmd}) . "\n");
+ my $result = IPC::Run::run $cmd, '>', \$stdout, '2>', \$stderr;
+ ok(!$result, "$test_name: exit code not 0");
+ like($stderr, $expected_stderr, "$test_name: matches");
+}
+
1;