diff options
author | Jack Lloyd <[email protected]> | 2017-03-29 10:17:20 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2017-03-29 10:17:20 -0400 |
commit | 2a2dbe2bfd5e37eeb3b4d072a2ef217bc910ce55 (patch) | |
tree | e9241e9edcd0e8803d509efb3497b6c23e009667 | |
parent | dea2ad7dfc9f5f883c5f24a71771d8ac884b5fb9 (diff) |
Add --test-runs option to test binary
Just runs the specified test several times, or until first failure.
-rw-r--r-- | src/tests/main.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/tests/main.cpp b/src/tests/main.cpp index 7f46ab733..4248de56b 100644 --- a/src/tests/main.cpp +++ b/src/tests/main.cpp @@ -35,7 +35,7 @@ namespace { class Test_Runner : public Botan_CLI::Command { public: - Test_Runner() : Command("test --threads=0 --run-long-tests --run-online-tests --drbg-seed= --data-dir= --pkcs11-lib= --log-success *suites") {} + Test_Runner() : Command("test --threads=0 --run-long-tests --run-online-tests --test-runs=1 --drbg-seed= --data-dir= --pkcs11-lib= --log-success *suites") {} std::string help_text() const override { @@ -79,6 +79,7 @@ class Test_Runner : public Botan_CLI::Command const bool run_long_tests = flag_set("run-long-tests"); const std::string data_dir = get_arg_or("data-dir", "src/tests/data"); const std::string pkcs11_lib = get_arg("pkcs11-lib"); + const size_t runs = get_arg_sz("test-runs"); std::vector<std::string> req = get_arg_list("suites"); @@ -176,11 +177,14 @@ class Test_Runner : public Botan_CLI::Command Botan_Tests::Test::setup_tests(log_success, run_online_tests, run_long_tests, data_dir, pkcs11_lib, rng.get()); - const size_t failed = run_tests(req, output(), threads); + for(size_t i = 0; i != runs; ++i) + { + const size_t failed = run_tests(req, output(), threads); - // Throw so main returns an error - if(failed) - throw Botan_Tests::Test_Error("Test suite failure"); + // Throw so main returns an error + if(failed) + throw Botan_Tests::Test_Error("Test suite failure"); + } } private: |