aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2019-06-10 08:17:16 +0200
committerDaniel Stenberg <daniel@haxx.se>2019-06-17 16:08:00 +0200
commit40259ca65544cd5227cec387d1bb4ded01596ebc (patch)
tree582ca9b6a654788aeca0fb7a65fa7d8d398d1ca9 /tests
parent13d9bb8bad62dfcf23486885bfa3d0b5542a8193 (diff)
tests: have runtests figure out disabled features
... so that runtests can skip individual test cases that test features that are explicitly disabled in this build. This new logic is intended for disabled features that aren't otherwise easily visible through the curl_version_info() or other API calls. tests/server/disabled is a newly built executable that will output a list of disabled features. Outputs nothing for a default build. Closes #3950
Diffstat (limited to 'tests')
-rw-r--r--tests/data/test10011
-rwxr-xr-xtests/runtests.pl399
-rw-r--r--tests/server/Makefile.inc4
-rw-r--r--tests/server/disabled.c79
4 files changed, 168 insertions, 315 deletions
diff --git a/tests/data/test1001 b/tests/data/test1001
index 91b13203e..53d7da381 100644
--- a/tests/data/test1001
+++ b/tests/data/test1001
@@ -66,6 +66,7 @@ http
<features>
!SSPI
crypto
+proxy
</features>
<name>
HTTP POST --digest with PUT and resumed upload and modified method
diff --git a/tests/runtests.pl b/tests/runtests.pl
index 59788404e..52045ab14 100755
--- a/tests/runtests.pl
+++ b/tests/runtests.pl
@@ -291,6 +291,7 @@ my %timevrfyend; # timestamp for each test result verification end
my $testnumcheck; # test number, set in singletest sub.
my %oldenv;
+my %feature; # array of enabled features
#######################################################################
# variables that command line options may set
@@ -2561,6 +2562,65 @@ sub compare {
return $result;
}
+sub setupfeatures {
+ $feature{"SSL"} = $has_ssl;
+ $feature{"MultiSSL"} = $has_multissl;
+ $feature{"SSLpinning"} = $has_sslpinning;
+ $feature{"OpenSSL"} = $has_openssl;
+ $feature{"GnuTLS"} = $has_gnutls;
+ $feature{"NSS"} = $has_nss;
+ $feature{"WinSSL"} = $has_winssl;
+ $feature{"Schannel"} = $has_winssl; # alias
+ $feature{"sectransp"} = $has_darwinssl;
+ $feature{"DarwinSSL"} = $has_darwinssl; # alias
+ $feature{"ld_preload"} = ($has_ldpreload && !$debug_build);
+ $feature{"unittest"} = $debug_build;
+ $feature{"debug"} = $debug_build;
+ $feature{"TrackMemory"} = $has_memory_tracking;
+ $feature{"large_file"} = $has_largefile;
+ $feature{"idn"} = $has_idn;
+ $feature{"ipv6"} = $has_ipv6;
+ $feature{"libz"} = $has_libz;
+ $feature{"brotli"} = $has_brotli;
+ $feature{"NTLM"} = $has_ntlm;
+ $feature{"NTLM_WB"} = $has_ntlm_wb;
+ $feature{"SSPI"} = $has_sspi;
+ $feature{"GSS-API"} = $has_gssapi;
+ $feature{"Kerberos"} = $has_kerberos;
+ $feature{"SPNEGO"} = $has_spnego;
+ $feature{"getrlimit"} = $has_getrlimit;
+ $feature{"crypto"} = $has_crypto;
+ $feature{"TLS-SRP"} = $has_tls_srp;
+ $feature{"Metalink"} = $has_metalink;
+ $feature{"http/2"} = $has_http2;
+ $feature{"threaded-resolver"} = $has_threadedres;
+ $feature{"PSL"} = $has_psl;
+ $feature{"alt-svc"} = $has_altsvc;
+ $feature{"manual"} = $has_manual;
+ $feature{"unix-sockets"} = $has_unix;
+
+ # make each protocol an enabled "feature"
+ for my $p (@protocols) {
+ $feature{$p} = 1;
+ }
+ # 'socks' was once here but is now removed
+
+ #
+ # strings that must match the names used in server/disabled.c
+ #
+ $feature{"cookies"} = 1;
+ $feature{"DoH"} = 1;
+ $feature{"HTTP-auth"} = 1;
+ $feature{"Mime"} = 1;
+ $feature{"netrc"} = 1;
+ $feature{"parsedate"} = 1;
+ $feature{"proxy"} = 1;
+ $feature{"shuffle-dns"} = 1;
+ $feature{"typecheck"} = 1;
+ $feature{"verbose-strings"} = 1;
+
+}
+
#######################################################################
# display information about curl and the host the test suite runs on
#
@@ -2574,6 +2634,8 @@ sub checksystem {
my $versretval;
my $versnoexec;
my @version=();
+ my @disabled;
+ my $dis = "";
my $curlverout="$LOGDIR/curlverout.log";
my $curlvererr="$LOGDIR/curlvererr.log";
@@ -2589,6 +2651,15 @@ sub checksystem {
@version = <VERSOUT>;
close(VERSOUT);
+ open(DISABLED, "server/disabled|");
+ @disabled = <DISABLED>;
+ close(DISABLED);
+
+ if($disabled[0]) {
+ map s/[\r\n]//g, @disabled;
+ $dis = join(", ", @disabled);
+ }
+
$resolver="stock";
for(@version) {
chomp;
@@ -2877,11 +2948,12 @@ sub checksystem {
my $hosttype=join(' ', runclientoutput("uname -a"));
logmsg ("********* System characteristics ******** \n",
- "* $curl\n",
- "* $libcurl\n",
- "* Features: $feat\n",
- "* Host: $hostname",
- "* System: $hosttype");
+ "* $curl\n",
+ "* $libcurl\n",
+ "* Features: $feat\n",
+ "* Disabled: $dis\n",
+ "* Host: $hostname",
+ "* System: $hosttype");
if($has_memory_tracking && $has_threadedres) {
$has_memory_tracking = 0;
@@ -2953,6 +3025,12 @@ sub checksystem {
$has_textaware = ($^O eq 'MSWin32') || ($^O eq 'msys');
logmsg "***************************************** \n";
+
+ setupfeatures();
+ # toggle off the features that were disabled in the build
+ for my $d(@disabled) {
+ $feature{$d} = 0;
+ }
}
#######################################################################
@@ -3121,7 +3199,6 @@ sub singletest {
my @what;
my $why;
- my %feature;
my $cmd;
my $disablevalgrind;
@@ -3157,177 +3234,7 @@ sub singletest {
$f =~ s/\s//g;
if($f =~ /^([^!].*)$/) {
- # Store the feature for later
- $feature{$1} = $1;
-
- if($1 eq "SSL") {
- if($has_ssl) {
- next;
- }
- }
- elsif($1 eq "MultiSSL") {
- if($has_multissl) {
- next;
- }
- }
- elsif($1 eq "SSLpinning") {
- if($has_sslpinning) {
- next;
- }
- }
- elsif($1 eq "OpenSSL") {
- if($has_openssl) {
- next;
- }
- }
- elsif($1 eq "GnuTLS") {
- if($has_gnutls) {
- next;
- }
- }
- elsif($1 eq "NSS") {
- if($has_nss) {
- next;
- }
- }
- elsif(($1 eq "WinSSL") || ($1 eq "Schannel")) {
- if($has_winssl) {
- next;
- }
- }
- elsif($1 eq "DarwinSSL") {
- if($has_darwinssl) {
- next;
- }
- }
- elsif($1 eq "ld_preload") {
- if($has_ldpreload && !$debug_build) {
- next;
- }
- }
- elsif($1 eq "unittest") {
- if($debug_build) {
- next;
- }
- }
- elsif($1 eq "debug") {
- if($debug_build) {
- next;
- }
- }
- elsif($1 eq "TrackMemory") {
- if($has_memory_tracking) {
- next;
- }
- }
- elsif($1 eq "large_file") {
- if($has_largefile) {
- next;
- }
- }
- elsif($1 eq "idn") {
- if($has_idn) {
- next;
- }
- }
- elsif($1 eq "ipv6") {
- if($has_ipv6) {
- next;
- }
- }
- elsif($1 eq "libz") {
- if($has_libz) {
- next;
- }
- }
- elsif($1 eq "brotli") {
- if($has_brotli) {
- next;
- }
- }
- elsif($1 eq "NTLM") {
- if($has_ntlm) {
- next;
- }
- }
- elsif($1 eq "NTLM_WB") {
- if($has_ntlm_wb) {
- next;
- }
- }
- elsif($1 eq "SSPI") {
- if($has_sspi) {
- next;
- }
- }
- elsif($1 eq "GSS-API") {
- if($has_gssapi) {
- next;
- }
- }
- elsif($1 eq "Kerberos") {
- if($has_kerberos) {
- next;
- }
- }
- elsif($1 eq "SPNEGO") {
- if($has_spnego) {
- next;
- }
- }
- elsif($1 eq "getrlimit") {
- if($has_getrlimit) {
- next;
- }
- }
- elsif($1 eq "crypto") {
- if($has_crypto) {
- next;
- }
- }
- elsif($1 eq "TLS-SRP") {
- if($has_tls_srp) {
- next;
- }
- }
- elsif($1 eq "Metalink") {
- if($has_metalink) {
- next;
- }
- }
- elsif($1 eq "http/2") {
- if($has_http2) {
- next;
- }
- }
- elsif($1 eq "threaded-resolver") {
- if($has_threadedres) {
- next;
- }
- }
- elsif($1 eq "PSL") {
- if($has_psl) {
- next;
- }
- }
- elsif($1 eq "alt-svc") {
- if($has_altsvc) {
- next;
- }
- }
- elsif($1 eq "manual") {
- if($has_manual) {
- next;
- }
- }
- elsif($1 eq "socks") {
- next;
- }
- elsif($1 eq "unix-sockets") {
- next if $has_unix;
- }
- # See if this "feature" is in the list of supported protocols
- elsif (grep /^\Q$1\E$/i, @protocols) {
+ if($feature{$1}) {
next;
}
@@ -3343,135 +3250,7 @@ sub singletest {
$f =~ s/\s//g;
if($f =~ /^!(.*)$/) {
- if($1 eq "SSL") {
- if(!$has_ssl) {
- next;
- }
- }
- elsif($1 eq "MultiSSL") {
- if(!$has_multissl) {
- next;
- }
- }
- elsif($1 eq "OpenSSL") {
- if(!$has_openssl) {
- next;
- }
- }
- elsif($1 eq "GnuTLS") {
- if(!$has_gnutls) {
- next;
- }
- }
- elsif($1 eq "NSS") {
- if(!$has_nss) {
- next;
- }
- }
- elsif(($1 eq "WinSSL") || ($1 eq "Schannel")) {
- if(!$has_winssl) {
- next;
- }
- }
- elsif($1 eq "DarwinSSL") {
- if(!$has_darwinssl) {
- next;
- }
- }
- elsif($1 eq "TrackMemory") {
- if(!$has_memory_tracking) {
- next;
- }
- }
- elsif($1 eq "large_file") {
- if(!$has_largefile) {
- next;
- }
- }
- elsif($1 eq "idn") {
- if(!$has_idn) {
- next;
- }
- }
- elsif($1 eq "ipv6") {
- if(!$has_ipv6) {
- next;
- }
- }
- elsif($1 eq "unix-sockets") {
- next if !$has_unix;
- }
- elsif($1 eq "libz") {
- if(!$has_libz) {
- next;
- }
- }
- elsif($1 eq "brotli") {
- if(!$has_brotli) {
- next;
- }
- }
- elsif($1 eq "NTLM") {
- if(!$has_ntlm) {
- next;
- }
- }
- elsif($1 eq "NTLM_WB") {
- if(!$has_ntlm_wb) {
- next;
- }
- }
- elsif($1 eq "SSPI") {
- if(!$has_sspi) {
- next;
- }
- }
- elsif($1 eq "GSS-API") {
- if(!$has_gssapi) {
- next;
- }
- }
- elsif($1 eq "Kerberos") {
- if(!$has_kerberos) {
- next;
- }
- }
- elsif($1 eq "SPNEGO") {
- if(!$has_spnego) {
- next;
- }
- }
- elsif($1 eq "getrlimit") {
- if(!$has_getrlimit) {
- next;
- }
- }
- elsif($1 eq "crypto") {
- if(!$has_crypto) {
- next;
- }
- }
- elsif($1 eq "TLS-SRP") {
- if(!$has_tls_srp) {
- next;
- }
- }
- elsif($1 eq "Metalink") {
- if(!$has_metalink) {
- next;
- }
- }
- elsif($1 eq "PSL") {
- if(!$has_psl) {
- next;
- }
- }
- elsif($1 eq "threaded-resolver") {
- if(!$has_threadedres) {
- next;
- }
- }
- else {
+ if(!$feature{$1}) {
next;
}
}
@@ -4761,10 +4540,6 @@ sub startservers {
# we can't run ftps tests without stunnel
return "no stunnel";
}
- if(!$has_ssl) {
- # we can't run ftps tests if libcurl is SSL-less
- return "curl lacks SSL support";
- }
if($runcert{'ftps'} && ($runcert{'ftps'} ne $certfile)) {
# stop server when running and using a different cert
stopserver('ftps');
@@ -4799,10 +4574,6 @@ sub startservers {
# we can't run https tests without stunnel
return "no stunnel";
}
- if(!$has_ssl) {
- # we can't run https tests if libcurl is SSL-less
- return "curl lacks SSL support";
- }
if($runcert{'https'} && ($runcert{'https'} ne $certfile)) {
# stop server when running and using a different cert
stopserver('https');
diff --git a/tests/server/Makefile.inc b/tests/server/Makefile.inc
index f14d35d12..6296af7cc 100644
--- a/tests/server/Makefile.inc
+++ b/tests/server/Makefile.inc
@@ -1,4 +1,4 @@
-noinst_PROGRAMS = getpart resolve rtspd sockfilt sws tftpd fake_ntlm socksd
+noinst_PROGRAMS = getpart resolve rtspd sockfilt sws tftpd fake_ntlm socksd disabled
CURLX_SRCS = \
../../lib/mprintf.c \
@@ -74,3 +74,5 @@ fake_ntlm_SOURCES = $(CURLX_SRCS) $(CURLX_HDRS) $(USEFUL) $(UTIL) \
fake_ntlm.c
fake_ntlm_LDADD = @CURL_NETWORK_AND_TIME_LIBS@
fake_ntlm_CFLAGS = $(AM_CFLAGS)
+
+disabled_SOURCES = disabled.c
diff --git a/tests/server/disabled.c b/tests/server/disabled.c
new file mode 100644
index 000000000..c82847d8e
--- /dev/null
+++ b/tests/server/disabled.c
@@ -0,0 +1,79 @@
+/***************************************************************************
+ * _ _ ____ _
+ * Project ___| | | | _ \| |
+ * / __| | | | |_) | |
+ * | (__| |_| | _ <| |___
+ * \___|\___/|_| \_\_____|
+ *
+ * Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al.
+ *
+ * This software is licensed as described in the file COPYING, which
+ * you should have received as part of this distribution. The terms
+ * are also available at https://curl.haxx.se/docs/copyright.html.
+ *
+ * You may opt to use, copy, modify, merge, publish, distribute and/or sell
+ * copies of the Software, and permit persons to whom the Software is
+ * furnished to do so, under the terms of the COPYING file.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ***************************************************************************/
+
+/*
+ * The purpose of this tool is to figure out which, if any, features that are
+ * disabled which should otherwise exist and work. These aren't visible in
+ * regular curl -V output.
+ *
+ * Disabled protocols are visible in curl_version_info() and are not included
+ * in this table.
+ */
+
+#include "curl_setup.h"
+#include <stdio.h>
+
+static const char *disabled[]={
+#ifdef CURL_DISABLE_COOKIES
+ "cookies",
+#endif
+#ifdef CURL_DISABLE_CRYPTO_AUTH
+ "crypto",
+#endif
+#ifdef CURL_DISABLE_DOH
+ "DoH",
+#endif
+#ifdef CURL_DISABLE_HTTP_AUTH
+ "HTTP-auth",
+#endif
+#ifdef CURL_DISABLE_MIME
+ "Mime",
+#endif
+#ifdef CURL_DISABLE_NETRC
+ "netrc",
+#endif
+#ifdef CURL_DISABLE_PARSEDATE
+ "parsedate",
+#endif
+#ifdef CURL_DISABLE_PROXY
+ "proxy",
+#endif
+#ifdef CURL_DISABLE_SHUFFLE_DNS
+ "shuffle-dns",
+#endif
+#ifdef CURL_DISABLE_TYPECHECK
+ "typecheck",
+#endif
+#ifdef CURL_DISABLE_VERBOSE_STRINGS
+ "verbose-strings",
+#endif
+ NULL
+};
+
+int main(void)
+{
+ int i;
+ for(i = 0; disabled[i]; i++)
+ printf("%s\n", disabled[i]);
+
+ return 0;
+}