From 98ef83f68975279267f290dfdc772d1e3725ecd8 Mon Sep 17 00:00:00 2001
From: Michael Paquier <michael@paquier.xyz>
Date: Fri, 2 Mar 2018 17:00:23 +0900
Subject: [PATCH 1/2] Prevent SSL and LDAP tests from running without support
 in build

An extra set of checks in each one of the test files is added to make
the tests fail should they be invoked without the proper build options.
This makes use of TestLib::check_pg_config to check for the build
configuration.
---
 src/test/ldap/t/001_auth.pl    | 4 ++++
 src/test/ssl/t/001_ssltests.pl | 4 ++++
 src/test/ssl/t/002_scram.pl    | 4 ++++
 3 files changed, 12 insertions(+)

diff --git a/src/test/ldap/t/001_auth.pl b/src/test/ldap/t/001_auth.pl
index a83d96ae91..f1d2f9a1e6 100644
--- a/src/test/ldap/t/001_auth.pl
+++ b/src/test/ldap/t/001_auth.pl
@@ -4,6 +4,10 @@ use TestLib;
 use PostgresNode;
 use Test::More tests => 19;
 
+# LDAP tests are not supported without proper build options
+BAIL_OUT("LDAP tests not supported without support in build") unless
+	check_pg_config("#define USE_LDAP 1");
+
 my ($slapd, $ldap_bin_dir, $ldap_schema_dir);
 
 $ldap_bin_dir = undef;			# usually in PATH
diff --git a/src/test/ssl/t/001_ssltests.pl b/src/test/ssl/t/001_ssltests.pl
index 4b097a69bf..cb8bc81f9a 100644
--- a/src/test/ssl/t/001_ssltests.pl
+++ b/src/test/ssl/t/001_ssltests.pl
@@ -6,6 +6,10 @@ use Test::More tests => 62;
 use ServerSetup;
 use File::Copy;
 
+# SSL tests are not supported without proper build options
+BAIL_OUT("SSL tests not supported without support in build") unless
+	check_pg_config("#define USE_OPENSSL 1");
+
 #### Some configuration
 
 # This is the hostname used to connect to the server. This cannot be a
diff --git a/src/test/ssl/t/002_scram.pl b/src/test/ssl/t/002_scram.pl
index 9460763a65..be1f49fe21 100644
--- a/src/test/ssl/t/002_scram.pl
+++ b/src/test/ssl/t/002_scram.pl
@@ -8,6 +8,10 @@ use Test::More tests => 6;
 use ServerSetup;
 use File::Copy;
 
+# SSL tests are not supported without proper build
+BAIL_OUT("SSL tests not supported without support in build") unless
+	check_pg_config("#define USE_OPENSSL 1");
+
 # This is the hostname used to connect to the server.
 my $SERVERHOSTADDR = '127.0.0.1';
 
-- 
2.16.2

