diff options
author | Jack Lloyd <[email protected]> | 2015-12-19 19:20:53 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2015-12-19 19:20:53 -0500 |
commit | a24c4cd9b26b0533464e8bd4b3016d01b84181cf (patch) | |
tree | 8b8e7274190cfcd875badfdc10257df391d69926 /src | |
parent | 93737a7fe053b154ec56197d85c1b3f009826539 (diff) |
If skipping a test due to diabled algo, only print if in verbose mode.
Also fix KDF tests which failed on missing algo
GH #367
Diffstat (limited to 'src')
-rw-r--r-- | src/tests/main.cpp | 62 | ||||
-rw-r--r-- | src/tests/test_kdf.cpp | 3 | ||||
-rw-r--r-- | src/tests/tests.cpp | 6 | ||||
-rw-r--r-- | src/tests/tests.h | 2 |
4 files changed, 40 insertions, 33 deletions
diff --git a/src/tests/main.cpp b/src/tests/main.cpp index c4313a4ef..6dab50932 100644 --- a/src/tests/main.cpp +++ b/src/tests/main.cpp @@ -30,36 +30,6 @@ namespace { using Botan_Tests::Test; -std::string report_out(const std::vector<Test::Result>& results, - size_t& tests_failed, - size_t& tests_ran) - { - std::ostringstream out; - - std::map<std::string, Test::Result> combined; - for(auto&& result : results) - { - const std::string who = result.who(); - auto i = combined.find(who); - if(i == combined.end()) - { - combined[who] = Test::Result(who); - i = combined.find(who); - } - - i->second.merge(result); - } - - for(auto&& result : combined) - { - out << result.second.result_string(); - tests_failed += result.second.tests_failed(); - tests_ran += result.second.tests_run(); - } - - return out.str(); - } - std::unique_ptr<Botan::RandomNumberGenerator> setup_tests(std::ostream& out, size_t threads, size_t soak_level, @@ -188,6 +158,38 @@ class Test_Runner : public Botan_CLI::Command throw Botan_Tests::Test_Error("Test suite failure"); } private: + + std::string report_out(const std::vector<Test::Result>& results, + size_t& tests_failed, + size_t& tests_ran) + { + std::ostringstream out; + + std::map<std::string, Test::Result> combined; + for(auto&& result : results) + { + const std::string who = result.who(); + auto i = combined.find(who); + if(i == combined.end()) + { + combined[who] = Test::Result(who); + i = combined.find(who); + } + + i->second.merge(result); + } + + for(auto&& result : combined) + { + out << result.second.result_string(verbose()); + tests_failed += result.second.tests_failed(); + tests_ran += result.second.tests_run(); + } + + return out.str(); + } + + size_t run_tests(const std::vector<std::string>& tests_to_run, std::ostream& out, size_t threads) diff --git a/src/tests/test_kdf.cpp b/src/tests/test_kdf.cpp index d9a172bad..ccf742edd 100644 --- a/src/tests/test_kdf.cpp +++ b/src/tests/test_kdf.cpp @@ -26,7 +26,8 @@ class KDF_KAT_Tests : public Text_Based_Test Test::Result run_one_test(const std::string& kdf_name, const VarMap& vars) { Test::Result result(kdf_name); - std::unique_ptr<Botan::KDF> kdf(Botan::get_kdf(kdf_name)); + + std::unique_ptr<Botan::KDF> kdf(Botan::KDF::create(kdf_name)); if(!kdf) { diff --git a/src/tests/tests.cpp b/src/tests/tests.cpp index 111622dab..35a1e01dc 100644 --- a/src/tests/tests.cpp +++ b/src/tests/tests.cpp @@ -305,9 +305,13 @@ std::string format_time(uint64_t ns) } -std::string Test::Result::result_string() const +std::string Test::Result::result_string(bool verbose) const { + if(tests_run() == 0 && !verbose) + return ""; + std::ostringstream report; + report << who() << " ran "; if(tests_run() == 0) diff --git a/src/tests/tests.h b/src/tests/tests.h index 71b839363..74b6de08e 100644 --- a/src/tests/tests.h +++ b/src/tests/tests.h @@ -69,7 +69,7 @@ class Test bool any_results() const { return tests_run() > 0; } const std::string& who() const { return m_who; } - std::string result_string() const; + std::string result_string(bool verbose) const; static Result Failure(const std::string& who, const std::string& what) |