Skip to content

Commit c3382a3

Browse files
committed
Refactor PG_TEST_EXTRA logic in autoconf build
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
1 parent bb44a6b commit c3382a3

File tree

6 files changed

+25
-10
lines changed

6 files changed

+25
-10
lines changed

src/test/Makefile

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,20 @@ SUBDIRS = perl regress isolation modules authentication recovery subscription
1717
ifeq ($(with_icu),yes)
1818
SUBDIRS += icu
1919
endif
20-
21-
# Test suites that are not safe by default but can be run if selected
22-
# by the user via the whitespace-separated list in variable
23-
# PG_TEST_EXTRA:
2420
ifeq ($(with_gssapi),yes)
25-
ifneq (,$(filter kerberos,$(PG_TEST_EXTRA)))
2621
SUBDIRS += kerberos
2722
endif
28-
endif
2923
ifeq ($(with_ldap),yes)
30-
ifneq (,$(filter ldap,$(PG_TEST_EXTRA)))
3124
SUBDIRS += ldap
3225
endif
33-
endif
3426
ifeq ($(with_ssl),openssl)
35-
ifneq (,$(filter ssl,$(PG_TEST_EXTRA)))
3627
SUBDIRS += ssl
3728
endif
38-
endif
29+
30+
# Test suites that are not safe by default but can be run if selected
31+
# by the user via the whitespace-separated list in variable PG_TEST_EXTRA.
32+
# Export PG_TEST_EXTRA to check it in individual tap tests.
33+
export PG_TEST_EXTRA
3934

4035
# We don't build or execute these by default, but we do want "make
4136
# clean" etc to recurse into them. (We must filter out those that we

src/test/kerberos/t/001_auth.pl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@
2525
{
2626
plan skip_all => 'GSSAPI/Kerberos not supported by this build';
2727
}
28+
elsif ($ENV{PG_TEST_EXTRA} !~ /\bkerberos\b/)
29+
{
30+
plan skip_all => 'Potentially unsafe test GSSAPI/Kerberos not enabled in PG_TEST_EXTRA';
31+
}
2832

2933
my ($krb5_bin_dir, $krb5_sbin_dir);
3034

src/test/ldap/t/001_auth.pl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616
{
1717
plan skip_all => 'LDAP not supported by this build';
1818
}
19+
elsif ($ENV{PG_TEST_EXTRA} !~ /\bldap\b/)
20+
{
21+
plan skip_all => 'Potentially unsafe test LDAP not enabled in PG_TEST_EXTRA';
22+
}
1923
elsif ($^O eq 'darwin' && -d '/usr/local/opt/openldap')
2024
{
2125
# typical paths for Homebrew

src/test/ssl/t/001_ssltests.pl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717
{
1818
plan skip_all => 'OpenSSL not supported by this build';
1919
}
20+
elsif ($ENV{PG_TEST_EXTRA} !~ /ssl/)
21+
{
22+
plan skip_all => 'Potentially unsafe test SSL not enabled in PG_TEST_EXTRA';
23+
}
2024

2125
my $ssl_server = SSL::Server->new();
2226

src/test/ssl/t/002_scram.pl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@
2020
{
2121
plan skip_all => 'OpenSSL not supported by this build';
2222
}
23+
elsif ($ENV{PG_TEST_EXTRA} !~ /\bssl\b/)
24+
{
25+
plan skip_all => 'Potentially unsafe test SSL not enabled in PG_TEST_EXTRA';
26+
}
2327

2428
my $ssl_server = SSL::Server->new();
2529

src/test/ssl/t/003_sslinfo.pl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@
1818
{
1919
plan skip_all => 'OpenSSL not supported by this build';
2020
}
21+
elsif ($ENV{PG_TEST_EXTRA} !~ /\bssl\b/)
22+
{
23+
plan skip_all => 'Potentially unsafe test SSL not enabled in PG_TEST_EXTRA';
24+
}
2125

2226
#### Some configuration
2327
my $ssl_server = SSL::Server->new();

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy