To avoid duplicating the PG_TEST_EXTRA logic in Makefiles into the upcoming
meson based build definition, move the checks into the the tests
themselves. That also has the advantage of making skipped tests visible.
Reviewed-by: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
Author: Nazir Bilal Yavuz <byavuz81@gmail.com>
Author: Andres Freund <andres@anarazel.de>
Discussion: https://postgr.es/m/
7dae5979-c6c0-cec5-7a36-
76a85aa8053d@enterprisedb.com
ifeq ($(with_icu),yes)
SUBDIRS += icu
endif
-
-# Test suites that are not safe by default but can be run if selected
-# by the user via the whitespace-separated list in variable
-# PG_TEST_EXTRA:
ifeq ($(with_gssapi),yes)
-ifneq (,$(filter kerberos,$(PG_TEST_EXTRA)))
SUBDIRS += kerberos
endif
-endif
ifeq ($(with_ldap),yes)
-ifneq (,$(filter ldap,$(PG_TEST_EXTRA)))
SUBDIRS += ldap
endif
-endif
ifeq ($(with_ssl),openssl)
-ifneq (,$(filter ssl,$(PG_TEST_EXTRA)))
SUBDIRS += ssl
endif
-endif
+
+# Test suites that are not safe by default but can be run if selected
+# by the user via the whitespace-separated list in variable PG_TEST_EXTRA.
+# Export PG_TEST_EXTRA to check it in individual tap tests.
+export PG_TEST_EXTRA
# We don't build or execute these by default, but we do want "make
# clean" etc to recurse into them. (We must filter out those that we
{
plan skip_all => 'GSSAPI/Kerberos not supported by this build';
}
+elsif ($ENV{PG_TEST_EXTRA} !~ /\bkerberos\b/)
+{
+ plan skip_all => 'Potentially unsafe test GSSAPI/Kerberos not enabled in PG_TEST_EXTRA';
+}
my ($krb5_bin_dir, $krb5_sbin_dir);
{
plan skip_all => 'LDAP not supported by this build';
}
+elsif ($ENV{PG_TEST_EXTRA} !~ /\bldap\b/)
+{
+ plan skip_all => 'Potentially unsafe test LDAP not enabled in PG_TEST_EXTRA';
+}
elsif ($^O eq 'darwin' && -d '/usr/local/opt/openldap')
{
# typical paths for Homebrew
{
plan skip_all => 'OpenSSL not supported by this build';
}
+elsif ($ENV{PG_TEST_EXTRA} !~ /ssl/)
+{
+ plan skip_all => 'Potentially unsafe test SSL not enabled in PG_TEST_EXTRA';
+}
my $ssl_server = SSL::Server->new();
{
plan skip_all => 'OpenSSL not supported by this build';
}
+elsif ($ENV{PG_TEST_EXTRA} !~ /\bssl\b/)
+{
+ plan skip_all => 'Potentially unsafe test SSL not enabled in PG_TEST_EXTRA';
+}
my $ssl_server = SSL::Server->new();
{
plan skip_all => 'OpenSSL not supported by this build';
}
+elsif ($ENV{PG_TEST_EXTRA} !~ /\bssl\b/)
+{
+ plan skip_all => 'Potentially unsafe test SSL not enabled in PG_TEST_EXTRA';
+}
#### Some configuration
my $ssl_server = SSL::Server->new();