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
This commit is contained in:
Tim Rühsen 2015-12-04 15:49:18 +01:00
parent 8977e63239
commit ca0c272eae
4 changed files with 17 additions and 9 deletions

View File

@ -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)

View File

@ -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?"

View File

@ -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?"

View File

@ -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)