From 03f8babefe4372acb2580873a637d51bc2086a2b Mon Sep 17 00:00:00 2001 From: Darshit Shah Date: Sat, 26 Jul 2014 23:45:57 +0530 Subject: [PATCH] Group common switches in test suite together Some command line switches are passed to Wget unconditionally. These switches should exist in a single place instead of being redundantly defined in each test file. We add the following two switches by default here: 1. --debug: This causes wget to be most verbose and output a lot of debugging information. Hence, if a test fails, the test log should provide valuable information. 2. --no-config: Users may have their own wgetrc files on the system. However, for the tests, we want Wget to run with vanilla settings. Hence, disbale loading any config files. --- testenv/ChangeLog | 6 ++++++ testenv/Test--https.py | 2 +- testenv/Test--spider-r.py | 2 +- testenv/Test-Content-disposition-2.py | 2 +- testenv/Test-Content-disposition.py | 2 +- testenv/Test-Head.py | 2 +- testenv/Test-O.py | 2 +- testenv/Test-Parallel-Proto.py | 2 +- testenv/Test-Post.py | 2 +- testenv/Test-Proto.py | 2 +- testenv/Test-auth-basic-fail.py | 2 +- testenv/Test-auth-basic.py | 2 +- testenv/Test-auth-both.py | 2 +- testenv/Test-auth-digest.py | 2 +- testenv/Test-auth-no-challenge-url.py | 2 +- testenv/Test-auth-no-challenge.py | 2 +- testenv/Test-auth-retcode.py | 2 +- testenv/Test-auth-with-content-disposition.py | 2 +- testenv/Test-c-full.py | 2 +- testenv/Test-cookie-401.py | 2 +- testenv/Test-cookie-domain-mismatch.py | 2 +- testenv/Test-cookie-expires.py | 2 +- testenv/Test-cookie.py | 2 +- testenv/test/base_test.py | 3 ++- 24 files changed, 30 insertions(+), 23 deletions(-) diff --git a/testenv/ChangeLog b/testenv/ChangeLog index ad5a562a..fe910884 100644 --- a/testenv/ChangeLog +++ b/testenv/ChangeLog @@ -1,3 +1,9 @@ +2014-07-26 Darshit Shah + + * Test-*.py: Remove the '-d' switch from WGET_OPTIONS. + * test/base_test (BaseTest.gen_cmd_line): Add --debug and --no-config to the + list of switches passed to wget unconditionally. + 2014-07-23 Darshit Shah * test/base_test.py (BaseTest.gen_cmd_line): Add support for running all diff --git a/testenv/Test--https.py b/testenv/Test--https.py index 55f417be..17f49d3d 100755 --- a/testenv/Test--https.py +++ b/testenv/Test--https.py @@ -17,7 +17,7 @@ A_File = WgetFile ("File1", File1) B_File = WgetFile ("File2", File2) C_File = WgetFile ("File3", File3) -WGET_OPTIONS = "-d --no-check-certificate" +WGET_OPTIONS = "--no-check-certificate" WGET_URLS = [["File1", "File2"]] Files = [[A_File, B_File]] diff --git a/testenv/Test--spider-r.py b/testenv/Test--spider-r.py index df023d3a..5eb01e46 100755 --- a/testenv/Test--spider-r.py +++ b/testenv/Test--spider-r.py @@ -74,7 +74,7 @@ Request_List = [ ] ] -WGET_OPTIONS = "-d --spider -r" +WGET_OPTIONS = "--spider -r" WGET_URLS = [[""]] Files = [[index_html, secondpage_html, thirdpage_html, dummy_txt]] diff --git a/testenv/Test-Content-disposition-2.py b/testenv/Test-Content-disposition-2.py index 3bf49405..5b9cf91a 100755 --- a/testenv/Test-Content-disposition-2.py +++ b/testenv/Test-Content-disposition-2.py @@ -20,7 +20,7 @@ File2_rules = { A_File = WgetFile ("HTTP.Teapot", File1) B_File = WgetFile ("File2", File2, rules=File2_rules) -WGET_OPTIONS = "-d --content-disposition" +WGET_OPTIONS = "--content-disposition" WGET_URLS = [["File2"]] Files = [[B_File]] diff --git a/testenv/Test-Content-disposition.py b/testenv/Test-Content-disposition.py index ce245994..027a9e8c 100755 --- a/testenv/Test-Content-disposition.py +++ b/testenv/Test-Content-disposition.py @@ -25,7 +25,7 @@ File1_rules = { } A_File = WgetFile ("LOTR", File1, rules=File1_rules) -WGET_OPTIONS = "-d --content-disposition" +WGET_OPTIONS = "--content-disposition" WGET_URLS = [["LOTR"]] Files = [[A_File]] diff --git a/testenv/Test-Head.py b/testenv/Test-Head.py index e3562529..77e5c575 100755 --- a/testenv/Test-Head.py +++ b/testenv/Test-Head.py @@ -13,7 +13,7 @@ File1 = "You shall not pass!" A_File = WgetFile ("File1", File1) -WGET_OPTIONS = "-d --method=HEAD" +WGET_OPTIONS = "--method=HEAD" WGET_URLS = [["File1"]] Files = [[A_File]] diff --git a/testenv/Test-O.py b/testenv/Test-O.py index 784a229d..90cb146a 100755 --- a/testenv/Test-O.py +++ b/testenv/Test-O.py @@ -13,7 +13,7 @@ File1 = "Test Contents." A_File = WgetFile ("File1", File1) -WGET_OPTIONS = "-d -O NewFile.txt" +WGET_OPTIONS = "-O NewFile.txt" WGET_URLS = [["File1"]] Files = [[A_File]] diff --git a/testenv/Test-Parallel-Proto.py b/testenv/Test-Parallel-Proto.py index b5e42bbe..beb768c5 100755 --- a/testenv/Test-Parallel-Proto.py +++ b/testenv/Test-Parallel-Proto.py @@ -18,7 +18,7 @@ A_File = WgetFile ("File1", File1) B_File = WgetFile ("File2", File2) C_File = WgetFile ("File3", File3) -WGET_OPTIONS = "-d" +WGET_OPTIONS = "" WGET_URLS = [["File1"], ["File2"]] Files = [[A_File], [B_File]] diff --git a/testenv/Test-Post.py b/testenv/Test-Post.py index 8983454b..223641af 100755 --- a/testenv/Test-Post.py +++ b/testenv/Test-Post.py @@ -17,7 +17,7 @@ TestMessage""" A_File = WgetFile ("File1", File1) -WGET_OPTIONS = "-d --method=post --body-data=TestMessage" +WGET_OPTIONS = "--method=post --body-data=TestMessage" WGET_URLS = [["File1"]] Files = [[A_File]] diff --git a/testenv/Test-Proto.py b/testenv/Test-Proto.py index d26b2bb3..cc71fb9d 100755 --- a/testenv/Test-Proto.py +++ b/testenv/Test-Proto.py @@ -39,7 +39,7 @@ A_File = WgetFile ("File1", File1, rules=File1_rules) B_File = WgetFile ("File2", File2, rules=File2_rules) C_File = WgetFile ("File3", File3) -WGET_OPTIONS = "-d --content-disposition --user=Sauron --password=TheEye" +WGET_OPTIONS = "--content-disposition --user=Sauron --password=TheEye" WGET_URLS = [["File1", "File2"]] Servers = [HTTP] diff --git a/testenv/Test-auth-basic-fail.py b/testenv/Test-auth-basic-fail.py index 263f7566..0badf693 100755 --- a/testenv/Test-auth-basic-fail.py +++ b/testenv/Test-auth-basic-fail.py @@ -20,7 +20,7 @@ File1_rules = { } A_File = WgetFile ("File1", File1, rules=File1_rules) -WGET_OPTIONS = "-d --user=Sauron --password=Eye" +WGET_OPTIONS = "--user=Sauron --password=Eye" WGET_URLS = [["File1"]] Files = [[A_File]] diff --git a/testenv/Test-auth-basic.py b/testenv/Test-auth-basic.py index 102bf8c6..49bb27b2 100755 --- a/testenv/Test-auth-basic.py +++ b/testenv/Test-auth-basic.py @@ -28,7 +28,7 @@ File2_rules = { A_File = WgetFile ("File1", File1, rules=File1_rules) B_File = WgetFile ("File2", File2, rules=File2_rules) -WGET_OPTIONS = "-d --user=Sauron --password=TheEye" +WGET_OPTIONS = "--user=Sauron --password=TheEye" WGET_URLS = [["File1", "File2"]] Files = [[A_File, B_File]] diff --git a/testenv/Test-auth-both.py b/testenv/Test-auth-both.py index 2da2840f..91d72b84 100755 --- a/testenv/Test-auth-both.py +++ b/testenv/Test-auth-both.py @@ -46,7 +46,7 @@ A_File = WgetFile ("File1", File1, rules=File1_rules) B_File = WgetFile ("File2", File2, rules=File2_rules) C_File = WgetFile ("File3", File3, rules=File3_rules) -WGET_OPTIONS = "-d --user=Sauron --password=TheEye" +WGET_OPTIONS = "--user=Sauron --password=TheEye" WGET_URLS = [["File1", "File2", "File3"]] Files = [[A_File, B_File, C_File]] diff --git a/testenv/Test-auth-digest.py b/testenv/Test-auth-digest.py index f6d28c7c..8a73c0d5 100755 --- a/testenv/Test-auth-digest.py +++ b/testenv/Test-auth-digest.py @@ -19,7 +19,7 @@ File1_rules = { } A_File = WgetFile ("File1", File1, rules=File1_rules) -WGET_OPTIONS = "-d --user=Pacman --password=Omnomnom" +WGET_OPTIONS = "--user=Pacman --password=Omnomnom" WGET_URLS = [["File1"]] Files = [[A_File]] diff --git a/testenv/Test-auth-no-challenge-url.py b/testenv/Test-auth-no-challenge-url.py index c39ebaa9..9e062600 100755 --- a/testenv/Test-auth-no-challenge-url.py +++ b/testenv/Test-auth-no-challenge-url.py @@ -23,7 +23,7 @@ File1_rules = { } A_File = WgetFile ("File1", File1, rules=File1_rules) -WGET_OPTIONS = "-d --auth-no-challenge http://Pacman:Omnomnom@localhost:{{port}}/File1" +WGET_OPTIONS = "--auth-no-challenge http://Pacman:Omnomnom@localhost:{{port}}/File1" WGET_URLS = [[]] Files = [[A_File]] diff --git a/testenv/Test-auth-no-challenge.py b/testenv/Test-auth-no-challenge.py index f02c0307..d155d725 100755 --- a/testenv/Test-auth-no-challenge.py +++ b/testenv/Test-auth-no-challenge.py @@ -23,7 +23,7 @@ File1_rules = { } A_File = WgetFile ("File1", File1, rules=File1_rules) -WGET_OPTIONS = "-d --auth-no-challenge --user=Pacman --password=Omnomnom" +WGET_OPTIONS = "--auth-no-challenge --user=Pacman --password=Omnomnom" WGET_URLS = [["File1"]] Files = [[A_File]] diff --git a/testenv/Test-auth-retcode.py b/testenv/Test-auth-retcode.py index 8719bd01..13eb583b 100755 --- a/testenv/Test-auth-retcode.py +++ b/testenv/Test-auth-retcode.py @@ -19,7 +19,7 @@ File1_rules = { A_File = WgetFile ("File1", File1, rules=File1_rules) -WGET_OPTIONS = "-d" +WGET_OPTIONS = "" WGET_URLS = [["File1"]] Files = [[A_File]] diff --git a/testenv/Test-auth-with-content-disposition.py b/testenv/Test-auth-with-content-disposition.py index f74a9592..df28c91e 100755 --- a/testenv/Test-auth-with-content-disposition.py +++ b/testenv/Test-auth-with-content-disposition.py @@ -23,7 +23,7 @@ File1_rules = { } A_File = WgetFile ("File1", File1, rules=File1_rules) -WGET_OPTIONS = "-d --user=Pacman --password=Omnomnom --content-disposition" +WGET_OPTIONS = "--user=Pacman --password=Omnomnom --content-disposition" WGET_URLS = [["File1"]] Files = [[A_File]] diff --git a/testenv/Test-c-full.py b/testenv/Test-c-full.py index 3cdcd768..6dc3f5e2 100755 --- a/testenv/Test-c-full.py +++ b/testenv/Test-c-full.py @@ -20,7 +20,7 @@ D_File = WgetFile ("File2", File2) E_File = WgetFile ("File3", File1) -WGET_OPTIONS = "-d -c" +WGET_OPTIONS = "-c" WGET_URLS = [["File1", "File2", "File3"]] Files = [[A_File, C_File, E_File]] diff --git a/testenv/Test-cookie-401.py b/testenv/Test-cookie-401.py index 9488c34e..4ffb1ff9 100755 --- a/testenv/Test-cookie-401.py +++ b/testenv/Test-cookie-401.py @@ -28,7 +28,7 @@ File2_rules = { A_File = WgetFile ("File1", File1, rules=File1_rules) B_File = WgetFile ("File2", File2, rules=File2_rules) -WGET_OPTIONS = "-d" +WGET_OPTIONS = "" WGET_URLS = [["File1", "File2"]] Files = [[A_File, B_File]] diff --git a/testenv/Test-cookie-domain-mismatch.py b/testenv/Test-cookie-domain-mismatch.py index 92487f43..45c5f1de 100755 --- a/testenv/Test-cookie-domain-mismatch.py +++ b/testenv/Test-cookie-domain-mismatch.py @@ -26,7 +26,7 @@ File2_rules = { A_File = WgetFile ("File1", File1, rules=File1_rules) B_File = WgetFile ("File2", File2, rules=File2_rules) -WGET_OPTIONS = "-d" +WGET_OPTIONS = "" WGET_URLS = [["File1", "File2"]] Files = [[A_File, B_File]] diff --git a/testenv/Test-cookie-expires.py b/testenv/Test-cookie-expires.py index 48a93b99..7ad919d5 100755 --- a/testenv/Test-cookie-expires.py +++ b/testenv/Test-cookie-expires.py @@ -49,7 +49,7 @@ B_File = WgetFile ("File2", File2, rules=File2_rules) C_File = WgetFile ("File3", File3, rules=File3_rules) D_File = WgetFile ("File4", File4, rules=File4_rules) -WGET_OPTIONS = "-d" +WGET_OPTIONS = "" WGET_URLS = [["File1", "File2", "File3", "File4"]] Files = [[A_File, B_File, C_File, D_File]] diff --git a/testenv/Test-cookie.py b/testenv/Test-cookie.py index b70316d8..13935181 100755 --- a/testenv/Test-cookie.py +++ b/testenv/Test-cookie.py @@ -26,7 +26,7 @@ File2_rules = { A_File = WgetFile ("File1", File1, rules=File1_rules) B_File = WgetFile ("File2", File2, rules=File2_rules) -WGET_OPTIONS = "-d" +WGET_OPTIONS = "" WGET_URLS = [["File1", "File2"]] Files = [[A_File, B_File]] diff --git a/testenv/test/base_test.py b/testenv/test/base_test.py index 369370a3..db65b5a9 100644 --- a/testenv/test/base_test.py +++ b/testenv/test/base_test.py @@ -98,12 +98,13 @@ class BaseTest: test_path = os.path.abspath(".") wget_path = os.path.abspath(os.path.join(test_path, "..", '..', 'src', "wget")) + wget_options = '--debug --no-config %s' % self.wget_options if os.getenv("VALGRIND_TESTS"): valgrind_test = "valgrind --error-exitcode=301 --leak-check=full" else: valgrind_test = "" - cmd_line = '%s %s %s ' % (valgrind_test, wget_path, self.wget_options) + cmd_line = '%s %s %s ' % (valgrind_test, wget_path, wget_options) for protocol, urls, domain in zip(self.protocols, self.urls, self.domains):