aboutsummaryrefslogtreecommitdiff
path: root/src/test/perl/TestLib.pm
diff options
context:
space:
mode:
authorPeter Eisentraut <peter_e@gmx.net>2018-01-09 12:28:49 -0500
committerPeter Eisentraut <peter_e@gmx.net>2018-01-09 12:28:49 -0500
commitc3d41ccf5931a2e587d114d9886717df76459a9d (patch)
tree6943b6e921b1dce5b7023b715dc8da29ed50ad63 /src/test/perl/TestLib.pm
parent8a906204aec44de6d8a1514082870f25085d9431 (diff)
downloadpostgresql-c3d41ccf5931a2e587d114d9886717df76459a9d.tar.gz
postgresql-c3d41ccf5931a2e587d114d9886717df76459a9d.zip
Fix ssl tests for when tls-server-end-point is not supported
Add a function to TestLib that allows us to check pg_config.h and then decide the expected test outcome based on that. Author: Michael Paquier <michael.paquier@gmail.com>
Diffstat (limited to 'src/test/perl/TestLib.pm')
-rw-r--r--src/test/perl/TestLib.pm19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/test/perl/TestLib.pm b/src/test/perl/TestLib.pm
index 72826d5bad8..fdd427608ba 100644
--- a/src/test/perl/TestLib.pm
+++ b/src/test/perl/TestLib.pm
@@ -26,6 +26,7 @@ our @EXPORT = qw(
slurp_dir
slurp_file
append_to_file
+ check_pg_config
system_or_bail
system_log
run_log
@@ -221,6 +222,24 @@ sub append_to_file
close $fh;
}
+# Check presence of a given regexp within pg_config.h for the installation
+# where tests are running, returning a match status result depending on
+# that.
+sub check_pg_config
+{
+ my ($regexp) = @_;
+ my ($stdout, $stderr);
+ my $result = IPC::Run::run [ 'pg_config', '--includedir' ], '>',
+ \$stdout, '2>', \$stderr
+ or die "could not execute pg_config";
+ chomp($stdout);
+
+ open my $pg_config_h, '<', "$stdout/pg_config.h" or die "$!";
+ my $match = (grep {/^$regexp/} <$pg_config_h>);
+ close $pg_config_h;
+ return $match;
+}
+
#
# Test functions
#