diff options
author | Alexander Bluhm <[email protected]> | 2017-03-31 15:14:36 +0200 |
---|---|---|
committer | Alexander Bluhm <[email protected]> | 2017-04-21 14:21:10 +0200 |
commit | eeb01d7267801988fe2b068b5dfac0bb38a2b359 (patch) | |
tree | 0bfbc2147309c121409fed01e1cc38898883b88c /src/tests/tests.cpp | |
parent | 8ee030e6d4f3b7b449aab3c1cca1a3837a5143e5 (diff) |
Run tests for a specific provider.
Currently botan runs the tests for all crypto providers it can find.
Add a --provider option for botan-test to specify exactly one
provider. This allows to see which parts of a specific implementation
have been tested. Pass down the given provider to a specific test
class.
Diffstat (limited to 'src/tests/tests.cpp')
-rw-r--r-- | src/tests/tests.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/tests/tests.cpp b/src/tests/tests.cpp index e4a755831..a7de5c45e 100644 --- a/src/tests/tests.cpp +++ b/src/tests/tests.cpp @@ -417,6 +417,22 @@ std::string Test::Result::result_string(bool verbose) const return report.str(); } +std::vector<std::string> Provider_Filter::filter(const std::vector<std::string> &in) const + { + if(m_provider.empty()) + { + return in; + } + for(auto&& provider : in) + { + if(provider == m_provider) + { + return std::vector<std::string> { provider }; + } + } + return std::vector<std::string> {}; + } + // static Test:: functions //static std::map<std::string, std::unique_ptr<Test>>& Test::global_registry() @@ -488,6 +504,7 @@ bool Test::m_log_success = false; bool Test::m_run_online_tests = false; bool Test::m_run_long_tests = false; std::string Test::m_pkcs11_lib; +Botan_Tests::Provider_Filter Test::m_provider_filter; //static void Test::setup_tests(bool log_success, @@ -495,6 +512,7 @@ void Test::setup_tests(bool log_success, bool run_long, const std::string& data_dir, const std::string& pkcs11_lib, + const Botan_Tests::Provider_Filter& pf, Botan::RandomNumberGenerator* rng) { m_data_dir = data_dir; @@ -503,6 +521,7 @@ void Test::setup_tests(bool log_success, m_run_long_tests = run_long; m_test_rng = rng; m_pkcs11_lib = pkcs11_lib; + m_provider_filter = pf; } //static @@ -542,6 +561,12 @@ std::string Test::pkcs11_lib() } //static +std::vector<std::string> Test::provider_filter(const std::vector<std::string>& in) + { + return m_provider_filter.filter(in); + } + +//static Botan::RandomNumberGenerator& Test::rng() { if(!m_test_rng) |