Prevent LDAP and SSL tests from running without support in build
authorPeter Eisentraut <[email protected]>
Sat, 3 Mar 2018 13:52:21 +0000 (08:52 -0500)
committerPeter Eisentraut <[email protected]>
Sat, 3 Mar 2018 13:52:21 +0000 (08:52 -0500)
Add checks in each test file that the build supports the feature,
otherwise skip all the tests.  Before, if someone were to (accidentally)
invoke these tests without build support, they would fail in confusing
ways.

based on patch from Michael Paquier <[email protected]>

src/test/ldap/Makefile
src/test/ldap/t/001_auth.pl
src/test/ssl/Makefile
src/test/ssl/t/001_ssltests.pl
src/test/ssl/t/002_scram.pl

index fef5742b82c441c7a3b06dda42046a75442b186b..74fef48650bb290dcfa8897fb12cf44c95489250 100644 (file)
@@ -13,6 +13,8 @@ subdir = src/test/ldap
 top_builddir = ../../..
 include $(top_builddir)/src/Makefile.global
 
+export with_ldap
+
 check:
        $(prove_check)
 
index a83d96ae91954b81004259ee101f7ec902c5de94..3a71e0535382c1e1c34a7eaac6d87050a710454a 100644 (file)
@@ -2,7 +2,16 @@ use strict;
 use warnings;
 use TestLib;
 use PostgresNode;
-use Test::More tests => 19;
+use Test::More;
+
+if ($ENV{with_ldap} eq 'yes')
+{
+       plan tests => 19;
+}
+else
+{
+       plan skip_all => 'LDAP not supported by this build';
+}
 
 my ($slapd, $ldap_bin_dir, $ldap_schema_dir);
 
index 4e9095529af4afd8233699ea62c80d46fe9cd20d..5cd2c5a404ef728b0f727b7c30ca0ced53a4a319 100644 (file)
@@ -13,6 +13,8 @@ subdir = src/test/ssl
 top_builddir = ../../..
 include $(top_builddir)/src/Makefile.global
 
+export with_openssl
+
 CERTIFICATES := server_ca server-cn-and-alt-names \
        server-cn-only server-single-alt-name server-multiple-alt-names \
        server-no-names server-revoked server-ss \
index 4b097a69bf2f229b8955aa876fc6980d999a8444..34df5e9dbb74599adb16fbb9ece2e5fe83cec58d 100644 (file)
@@ -2,10 +2,19 @@ use strict;
 use warnings;
 use PostgresNode;
 use TestLib;
-use Test::More tests => 62;
+use Test::More;
 use ServerSetup;
 use File::Copy;
 
+if ($ENV{with_openssl} eq 'yes')
+{
+       plan tests => 62;
+}
+else
+{
+       plan skip_all => 'SSL not supported by this build';
+}
+
 #### Some configuration
 
 # This is the hostname used to connect to the server. This cannot be a
index 9460763a65a149d174e3cf2ba1d2da985f33753f..7c6be7a219b050834a5093d0c2ede589ecd42ba4 100644 (file)
@@ -4,10 +4,19 @@ use strict;
 use warnings;
 use PostgresNode;
 use TestLib;
-use Test::More tests => 6;
+use Test::More;
 use ServerSetup;
 use File::Copy;
 
+if ($ENV{with_openssl} eq 'yes')
+{
+       plan tests => 6;
+}
+else
+{
+       plan skip_all => 'SSL not supported by this build';
+}
+
 # This is the hostname used to connect to the server.
 my $SERVERHOSTADDR = '127.0.0.1';