From 2a2dbe2bfd5e37eeb3b4d072a2ef217bc910ce55 Mon Sep 17 00:00:00 2001 From: Jack Lloyd Date: Wed, 29 Mar 2017 10:17:20 -0400 Subject: Add --test-runs option to test binary Just runs the specified test several times, or until first failure. --- src/tests/main.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src') 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 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: -- cgit v1.2.3