diff options
Diffstat (limited to 'src/scripts')
-rwxr-xr-x | src/scripts/cli_tests.py | 2 | ||||
-rwxr-xr-x | src/scripts/test_all_configs.py | 5 | ||||
-rw-r--r-- | src/scripts/test_python.py | 18 |
3 files changed, 15 insertions, 10 deletions
diff --git a/src/scripts/cli_tests.py b/src/scripts/cli_tests.py index 03ce4de48..b4e973c2b 100755 --- a/src/scripts/cli_tests.py +++ b/src/scripts/cli_tests.py @@ -113,7 +113,7 @@ def get_testdata(document, max_tests): for direction in ['encrypt', 'decrypt']: testname = "{} no {:0>3} ({})".format( algorithm.lower(), testcase_number, direction) - testname = re.sub("[^-a-z0-9-]", "_", testname) + testname = re.sub("[^a-z0-9-]", "_", testname) testname = re.sub("_+", "_", testname) testname = testname.strip("_") out[testname] = {} diff --git a/src/scripts/test_all_configs.py b/src/scripts/test_all_configs.py index 208720c55..e0950e08f 100755 --- a/src/scripts/test_all_configs.py +++ b/src/scripts/test_all_configs.py @@ -100,6 +100,7 @@ def main(args): cant_disable = ['block', 'hash', 'hex', 'mac', 'modes', 'rng', 'stream', 'utils', 'cpuid', 'entropy'] always_include = ['thread_utils', 'sha2_64']#, 'sha2_64', 'aes'] + fails = 0 failed = [] for module in sorted(modules): @@ -111,17 +112,21 @@ def main(args): extra.append('dev_random') if run_test_build(configure_py, [module] + always_include + extra, True, jobs, run_tests) is False: failed.append(module) + fails += 1 for module in sorted(modules): if module in cant_disable or module in always_include: continue if run_test_build(configure_py, [module], False, jobs, run_tests) is False: failed.append(module) + fails += 1 if len(failed) > 0: print("Failed building with %s" % (' '.join(failed))) else: print("All configurations ok") + return fails + if __name__ == '__main__': sys.exit(main(sys.argv)) diff --git a/src/scripts/test_python.py b/src/scripts/test_python.py index 34629398f..f662d8e88 100644 --- a/src/scripts/test_python.py +++ b/src/scripts/test_python.py @@ -24,9 +24,9 @@ class BotanPythonTests(unittest.TestCase): self.assertTrue(version_str.startswith('Botan ')) self.assertEqual(botan2.version_major(), 2) - self.assertTrue(botan2.version_minor() >= 8) + self.assertGreaterEqual(botan2.version_minor(), 8) - self.assertTrue(botan2.ffi_api_version() >= 20180713) + self.assertGreaterEqual(botan2.ffi_api_version(), 20180713) def test_compare(self): @@ -168,7 +168,7 @@ class BotanPythonTests(unittest.TestCase): (kmin, kmax) = enc.key_length() - self.assertTrue(kmin <= kmax) + self.assertLessEqual(kmin, kmax) rng = botan2.RandomNumberGenerator() iv = rng.get(enc.default_nonce_length()) @@ -296,7 +296,7 @@ ofvkP1EDmpx50fHLawIDAQAB priv_der = rsapriv.to_der() self.assertEqual(priv_pem[0:28], "-----BEGIN PRIVATE KEY-----\n") - self.assertTrue(len(priv_pem) > len(priv_der)) + self.assertGreater(len(priv_pem), len(priv_der)) rsapub = rsapriv.get_public_key() self.assertEqual(rsapub.algo_name(), 'RSA') @@ -306,7 +306,7 @@ ofvkP1EDmpx50fHLawIDAQAB pub_der = rsapub.to_der() self.assertEqual(pub_pem[0:27], "-----BEGIN PUBLIC KEY-----\n") - self.assertTrue(len(pub_pem) > len(pub_der)) + self.assertGreater(len(pub_pem), len(pub_der)) enc = botan2.PKEncrypt(rsapub, "OAEP(SHA-256)") dec = botan2.PKDecrypt(rsapriv, "OAEP(SHA-256)") @@ -490,8 +490,8 @@ ofvkP1EDmpx50fHLawIDAQAB self.assertEqual(ten, five + five) self.assertNotEqual(ten, five) - self.assertTrue(five < ten) - self.assertTrue(five <= ten) + self.assertLess(five, ten) + self.assertLessEqual(five, ten) x = botan2.MPI(five) @@ -551,8 +551,8 @@ ofvkP1EDmpx50fHLawIDAQAB for _i in range(10): x = botan2.MPI.random_range(rng, l, u) - self.assertTrue(x < u) - self.assertTrue(x > l) + self.assertLess(x, u) + self.assertGreater(x, l) def test_fpe(self): |