aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/tests/main.cpp')
-rw-r--r--src/tests/main.cpp28
1 files changed, 26 insertions, 2 deletions
diff --git a/src/tests/main.cpp b/src/tests/main.cpp
index c15fab438..a330bd79a 100644
--- a/src/tests/main.cpp
+++ b/src/tests/main.cpp
@@ -31,7 +31,7 @@ namespace {
class Test_Runner : public Botan_CLI::Command
{
public:
- Test_Runner() : Command("test --threads=0 --soak=5 --drbg-seed= --data-dir= --log-success *suites") {}
+ Test_Runner() : Command("test --threads=0 --soak=5 --drbg-seed= --data-dir= --pkcs11-lib= --log-success *suites") {}
std::string help_text() const override
{
@@ -73,6 +73,7 @@ class Test_Runner : public Botan_CLI::Command
const std::string drbg_seed = get_arg("drbg-seed");
const bool log_success = flag_set("log-success");
const std::string data_dir = get_arg_or("data-dir", "src/tests/data");
+ const std::string pkcs11_lib = get_arg("pkcs11-lib");
std::vector<std::string> req = get_arg_list("suites");
@@ -88,6 +89,19 @@ class Test_Runner : public Botan_CLI::Command
std::set<std::string> all_others = Botan_Tests::Test::registered_tests();
+ // do not run pkcs11 tests by default
+ for(std::set<std::string>::iterator iter = all_others.begin(); iter != all_others.end();)
+ {
+ if((*iter).find("pkcs11") != std::string::npos)
+ {
+ iter = all_others.erase(iter);
+ }
+ else
+ {
+ ++iter;
+ }
+ }
+
for(auto f : req)
{
all_others.erase(f);
@@ -95,6 +109,11 @@ class Test_Runner : public Botan_CLI::Command
req.insert(req.end(), all_others.begin(), all_others.end());
}
+ else if(req.size() == 1 && req.at(0) == "pkcs11")
+ {
+ req = {"pkcs11-manage", "pkcs11-module", "pkcs11-slot", "pkcs11-session", "pkcs11-object", "pkcs11-rsa",
+ "pkcs11-ecdsa", "pkcs11-ecdh", "pkcs11-rng", "pkcs11-x509"};
+ }
output() << "Testing " << Botan::version_string() << "\n";
output() << "Starting tests";
@@ -104,6 +123,11 @@ class Test_Runner : public Botan_CLI::Command
output() << " soak level:" << soak_level;
+ if(! pkcs11_lib.empty())
+ {
+ output() << " pkcs11 library:" << pkcs11_lib;
+ }
+
std::unique_ptr<Botan::RandomNumberGenerator> rng;
#if defined(BOTAN_HAS_HMAC_DRBG) && defined(BOTAN_HAS_SHA2_64)
@@ -137,7 +161,7 @@ class Test_Runner : public Botan_CLI::Command
output() << "\n";
- Botan_Tests::Test::setup_tests(soak_level, log_success, data_dir, rng.get());
+ Botan_Tests::Test::setup_tests(soak_level, log_success, data_dir, pkcs11_lib, rng.get());
const size_t failed = run_tests(req, output(), threads);