Skip to content

Commit

Permalink
Merge pull request #648 from Stonemason5040/common-script-arguments
Browse files Browse the repository at this point in the history
Edit script_retention.py so it accepts 'common_arguments' from .json files
  • Loading branch information
tomato42 committed Mar 4, 2020
2 parents ebb757e + 7ce0ad1 commit c5727aa
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 103 deletions.
8 changes: 4 additions & 4 deletions tests/scripts_retention.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def flush_queue():
break


def run_clients(tests, srv, expected_size):
def run_clients(tests, common_args, srv, expected_size):
good = 0
bad = 0
failed = []
Expand All @@ -123,7 +123,7 @@ def run_clients(tests, srv, expected_size):
arguments = params.get("arguments", [])
arguments = [expected_size if arg == "{expected_size}" else arg for
arg in arguments]
proc_args.extend(arguments)
proc_args.extend(common_args + arguments)
my_env = os.environ.copy()
my_env["PYTHONPATH"]="."
proc = Popen(proc_args, env=my_env,
Expand Down Expand Up @@ -178,9 +178,9 @@ def run_with_json(config_file, srv_path, expected_size):
server_host,
server_port)
logger.info("Server process started")

common_args = srv_conf.get("common_arguments", [])
try:
n_good, n_bad, f_cmds = run_clients(srv_conf["tests"], srv,
n_good, n_bad, f_cmds = run_clients(srv_conf["tests"], common_args, srv,
expected_size)
good += n_good
bad += n_bad
Expand Down
67 changes: 17 additions & 50 deletions tests/tlslite-ng-random-subset.json
Original file line number Diff line number Diff line change
Expand Up @@ -406,45 +406,27 @@
"-c", "tests/serverX509Cert.pem",
"--reqcert", "localhost:4433"],
"environment": {"PYTHONPATH" : "."},
"common_arguments" : ["-k", "tests/clientX509Key.pem",
"-c", "tests/clientX509Cert.pem"],
"tests" : [
{"name": "test-certificate-malformed.py",
"arguments" : ["-k", "tests/clientX509Key.pem",
"-c", "tests/clientX509Cert.pem"]
},
{"name" : "test-certificate-request.py",
"arguments" : ["-k", "tests/clientX509Key.pem",
"-c", "tests/clientX509Cert.pem"]
},
{"name": "test-certificate-malformed.py"},
{"name" : "test-certificate-request.py"},
{"name" : "test-certificate-request.py",
"arguments" : ["-k", "tests/clientRSAPSSKey.pem",
"-c", "tests/clientRSAPSSCert.pem"]
},
{"name" : "test-certificate-verify-malformed-sig.py",
"arguments" : ["-k", "tests/clientX509Key.pem",
"-c", "tests/clientX509Cert.pem"]
},
{"name" : "test-certificate-verify-malformed.py",
"arguments" : ["-k", "tests/clientX509Key.pem",
"-c", "tests/clientX509Cert.pem"]
},
{"name" : "test-certificate-verify.py",
"arguments" : ["-k", "tests/clientX509Key.pem",
"-c", "tests/clientX509Cert.pem"]
},
{"name" : "test-certificate-verify-malformed-sig.py"},
{"name" : "test-certificate-verify-malformed.py"},
{"name" : "test-certificate-verify.py"},
{"name" : "test-certificate-verify.py",
"arguments" : ["-k", "tests/clientX509Key.pem",
"-c", "tests/clientX509Cert.pem", "-d"]
"arguments" : ["-d"]
},
{"name" : "test-ecdsa-in-certificate-verify.py",
"arguments" : ["-k", "tests/serverECKey.pem",
"-c", "tests/serverECCert.pem"]
},
{"name" : "test-rsa-pss-sigs-on-certificate-verify.py",
"comment" : "test script has over 2k test cases, limit it",
"arguments" : ["-k", "tests/clientX509Key.pem",
"-c", "tests/clientX509Cert.pem",
"-n", "15",
"--illegpar"]
"arguments" : ["--illegpar" ,"-n", "15"]
},
{"name" : "test-rsa-pss-sigs-on-certificate-verify.py",
"comment" : "test script has over 2k test cases, limit it",
Expand All @@ -453,32 +435,18 @@
"-n", "15",
"--illegpar"]
},
{"name" : "test-extended-master-secret-extension-with-client-cert.py",
"arguments" : ["-k", "tests/clientX509Key.pem",
"-c", "tests/clientX509Cert.pem"]
},
{"name" : "test-rsa-sigs-on-certificate-verify.py",
"arguments" : ["-k", "tests/clientX509Key.pem",
"-c", "tests/clientX509Cert.pem"]
},
{"name" : "test-tls13-certificate-request.py",
"arguments" : ["-k", "tests/clientX509Key.pem",
"-c", "tests/clientX509Cert.pem"]
},
{"name" : "test-extended-master-secret-extension-with-client-cert.py"},
{"name" : "test-rsa-sigs-on-certificate-verify.py"},
{"name" : "test-tls13-certificate-request.py"},
{"name" : "test-tls13-certificate-request.py",
"comment": "Test with additional extensions",
"arguments" : ["-k", "tests/clientX509Key.pem",
"-c", "tests/clientX509Cert.pem",
"-E", "status_request:CH:CT key_share:SH supported_versions:SH"]
"arguments" : ["-E", "status_request:CH:CT key_share:SH supported_versions:SH"]
},
{"name" : "test-tls13-certificate-verify.py",
"arguments" : ["-k", "tests/clientRSAPSSKey.pem",
"-c", "tests/clientRSAPSSCert.pem", "-n", "10"]
},
{"name" : "test-tls13-certificate-verify.py",
"arguments" : ["-k", "tests/clientX509Key.pem",
"-c", "tests/clientX509Cert.pem", "-n", "10"]
},
{"name" : "test-tls13-certificate-verify.py"},
{"name" : "test-tls13-ecdsa-in-certificate-verify.py",
"arguments" : ["-k", "tests/serverECKey.pem",
"-c", "tests/serverECCert.pem",
Expand Down Expand Up @@ -526,12 +494,11 @@
"server_hostname": "localhost",
"server_port": 4433,
"environment": {"PYTHONPATH": "."},
"common_arguments" : ["--psk-sha384"],
"comment" : "Tests of the TLSv1.3 PSK key exchanges with SHA384 PRF",
"tests" : [
{"name" : "test-tls13-psk_ke.py",
"arguments" : ["--psk-sha384"]},
{"name" : "test-tls13-psk_dhe_ke.py",
"arguments" : ["--psk-sha384"]}
{"name" : "test-tls13-psk_ke.py"},
{"name" : "test-tls13-psk_dhe_ke.py"}
]
},
{"server_command": ["python", "-u", "{command}", "server",
Expand Down
68 changes: 19 additions & 49 deletions tests/tlslite-ng.json
Original file line number Diff line number Diff line change
Expand Up @@ -381,74 +381,45 @@
"-c", "tests/serverX509Cert.pem",
"--reqcert", "localhost:4433"],
"environment": {"PYTHONPATH" : "."},
"common_arguments" : ["-k", "tests/clientX509Key.pem",
"-c", "tests/clientX509Cert.pem"],
"tests" : [
{"name": "test-certificate-malformed.py",
"arguments" : ["-k", "tests/clientX509Key.pem",
"-c", "tests/clientX509Cert.pem"]
},
{"name" : "test-certificate-request.py",
"arguments" : ["-k", "tests/clientX509Key.pem",
"-c", "tests/clientX509Cert.pem"]
},
{"name": "test-certificate-malformed.py"},
{"name" : "test-certificate-request.py"},
{"name" : "test-certificate-request.py",
"arguments" : ["-k", "tests/clientRSAPSSKey.pem",
"-c", "tests/clientRSAPSSCert.pem"]
},
{"name" : "test-certificate-verify-malformed-sig.py",
"arguments" : ["-k", "tests/clientX509Key.pem",
"-c", "tests/clientX509Cert.pem"]
},
{"name" : "test-certificate-verify-malformed.py",
"arguments" : ["-k", "tests/clientX509Key.pem",
"-c", "tests/clientX509Cert.pem"]
},
{"name" : "test-certificate-verify.py",
"arguments" : ["-k", "tests/clientX509Key.pem",
"-c", "tests/clientX509Cert.pem"]
},
{"name" : "test-certificate-verify-malformed-sig.py"},
{"name" : "test-certificate-verify-malformed.py"},
{"name" : "test-certificate-verify.py"},
{"name" : "test-certificate-verify.py",
"arguments" : ["-k", "tests/clientX509Key.pem",
"-c", "tests/clientX509Cert.pem", "-d"]
"arguments" : ["-d"]
},
{"name" : "test-ecdsa-in-certificate-verify.py",
"arguments" : ["-k", "tests/serverECKey.pem",
"-c", "tests/serverECCert.pem"]
},
{"name" : "test-rsa-pss-sigs-on-certificate-verify.py",
"arguments" : ["-k", "tests/clientX509Key.pem",
"-c", "tests/clientX509Cert.pem",
"--illegpar"]
"arguments" : ["--illegpar"]
},
{"name" : "test-rsa-pss-sigs-on-certificate-verify.py",
"arguments" : ["-k", "tests/clientRSAPSSKey.pem",
"-c", "tests/clientRSAPSSCert.pem",
"--illegpar"]
},
{"name" : "test-extended-master-secret-extension-with-client-cert.py",
"arguments" : ["-k", "tests/clientX509Key.pem",
"-c", "tests/clientX509Cert.pem"]
},
{"name" : "test-rsa-sigs-on-certificate-verify.py",
"arguments" : ["-k", "tests/clientX509Key.pem",
"-c", "tests/clientX509Cert.pem"]
},
{"name" : "test-tls13-certificate-request.py",
"arguments" : ["-k", "tests/clientX509Key.pem",
"-c", "tests/clientX509Cert.pem"]
},
{"name" : "test-extended-master-secret-extension-with-client-cert.py"},
{"name" : "test-rsa-sigs-on-certificate-verify.py"},
{"name" : "test-tls13-certificate-request.py"},
{"name" : "test-tls13-certificate-request.py",
"comment": "Test with additional extensions",
"arguments" : ["-k", "tests/clientX509Key.pem",
"-c", "tests/clientX509Cert.pem",
"-E", "status_request:CH:CT key_share:SH supported_versions:SH"]
},
"arguments" : ["-E", "status_request:CH:CT key_share:SH supported_versions:SH"],
"comment": "Test with additional extensions"
},
{"name" : "test-tls13-certificate-verify.py",
"arguments" : ["-k", "tests/clientRSAPSSKey.pem",
"-c", "tests/clientRSAPSSCert.pem"]
},
{"name" : "test-tls13-certificate-verify.py",
"arguments" : ["-k", "tests/clientX509Key.pem",
"-c", "tests/clientX509Cert.pem"]
{"name" : "test-tls13-certificate-verify.py"
},
{"name" : "test-tls13-ecdsa-in-certificate-verify.py",
"arguments" : ["-k", "tests/serverECKey.pem",
Expand Down Expand Up @@ -494,12 +465,11 @@
"server_hostname": "localhost",
"server_port": 4433,
"environment": {"PYTHONPATH": "."},
"common_arguments" : ["--psk-sha384"],
"comment" : "Tests of the TLSv1.3 PSK key exchanges with SHA384 PRF",
"tests" : [
{"name" : "test-tls13-psk_ke.py",
"arguments" : ["--psk-sha384"]},
{"name" : "test-tls13-psk_dhe_ke.py",
"arguments" : ["--psk-sha384"]}
{"name" : "test-tls13-psk_ke.py"},
{"name" : "test-tls13-psk_dhe_ke.py"}
]
},
{"server_command": ["python", "-u", "{command}", "server",
Expand Down

0 comments on commit c5727aa

Please sign in to comment.