From ca0c272eae7dbceef07a52de43e399e297072933 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20R=C3=BChsen?= Date: Fri, 4 Dec 2015 15:49:18 +0100 Subject: [PATCH] SKIP SSL/TLS tests if configured without it * testenv/Makefile.am: Set SSL_TESTS env variable * testenv/Test--https-crl.py, testenv/Test--https.py, testenv/Test-hsts.py: Return 77 (SKIP) if SSL/TLS is not configured --- testenv/Makefile.am | 12 +++++------- testenv/Test--https-crl.py | 3 +++ testenv/Test--https.py | 3 +++ testenv/Test-hsts.py | 8 ++++++-- 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/testenv/Makefile.am b/testenv/Makefile.am index 7fe24bd8..370c4046 100644 --- a/testenv/Makefile.am +++ b/testenv/Makefile.am @@ -37,7 +37,10 @@ AUTOMAKE_OPTIONS = parallel-tests AM_TESTS_ENVIRONMENT = export WGETRC=/dev/null; MAKE_CHECK=True; export MAKE_CHECK;\ export PYTHONPATH=$$PYTHONPATH:$(srcdir); export VALGRIND_TESTS="@VALGRIND_TESTS@"; -SSL_TESTS = Test--https.py Test--https-crl.py Test-hsts.py +if WITH_SSL + AM_TESTS_ENVIRONMENT += export SSL_TESTS=1; +endif + if HAVE_PYTHON3 TESTS = Test-auth-basic-fail.py \ Test-auth-basic.py \ @@ -58,6 +61,7 @@ if HAVE_PYTHON3 Test-Head.py \ Test--https.py \ Test--https-crl.py \ + Test-hsts.py \ Test-O.py \ Test-Post.py \ Test-504.py \ @@ -66,14 +70,8 @@ if HAVE_PYTHON3 Test-redirect-crash.py \ Test-reserved-chars.py \ Test-condget.py \ - $(SSL_TESTS) \ $(METALINK_TESTS) - # added test cases expected to fail here and under TESTS -if !WITH_SSL - XFAIL_TESTS = $(SSL_TESTS) -endif - endif EXTRA_DIST = certs conf exc misc server test README $(TESTS) diff --git a/testenv/Test--https-crl.py b/testenv/Test--https-crl.py index 9330a1e6..88ea7f14 100755 --- a/testenv/Test--https-crl.py +++ b/testenv/Test--https-crl.py @@ -9,6 +9,9 @@ import os This test ensures that Wget can download files from HTTPS Servers """ TEST_NAME = "HTTPS CRL" +if os.getenv('SSL_TESTS') is None: + exit (77) + ############# File Definitions ############################################### File1 = "Would you like some Tea?" File2 = "With lemon or cream?" diff --git a/testenv/Test--https.py b/testenv/Test--https.py index b8d4faf9..d2338350 100755 --- a/testenv/Test--https.py +++ b/testenv/Test--https.py @@ -9,6 +9,9 @@ import os This test ensures that Wget can download files from HTTPS Servers """ TEST_NAME = "HTTPS Downloads" +if os.getenv('SSL_TESTS') is None: + exit (77) + ############# File Definitions ############################################### File1 = "Would you like some Tea?" File2 = "With lemon or cream?" diff --git a/testenv/Test-hsts.py b/testenv/Test-hsts.py index 42909294..64f84af6 100755 --- a/testenv/Test-hsts.py +++ b/testenv/Test-hsts.py @@ -9,6 +9,12 @@ import os """ This test makes sure Wget can parse a given HSTS database and apply the indicated HSTS policy. """ + +TEST_NAME = "HSTS basic test" +print (os.getenv('SSL_TESTS')) +if os.getenv('SSL_TESTS') is None: + exit (77) + def hsts_database_path(): hsts_file = ".wget-hsts-testenv" return os.path.abspath(hsts_file) @@ -25,8 +31,6 @@ def create_hsts_database(path, host, port): f.write(host + "\t" + str(port) + "\t0\t" + str(curtime) + "\t" + max_age + "\n") f.close() -TEST_NAME = "HSTS basic test" - File_Name = "hw" File_Content = "Hello, world!" File = WgetFile(File_Name, File_Content)