From 4ef2264389c6102577d63a26cc80857df1ead5d5 Mon Sep 17 00:00:00 2001 From: Alexander Bluhm Date: Fri, 31 Mar 2017 21:14:04 +0200 Subject: Check name of test suite. If botan-test is invoked with an invalid test name, fail with a usage error. This is more obvious than not running the test. --- src/tests/main.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/tests/main.cpp') diff --git a/src/tests/main.cpp b/src/tests/main.cpp index 4248de56b..93ab4feb2 100644 --- a/src/tests/main.cpp +++ b/src/tests/main.cpp @@ -123,6 +123,17 @@ class Test_Runner : public Botan_CLI::Command req = {"pkcs11-manage", "pkcs11-module", "pkcs11-slot", "pkcs11-session", "pkcs11-object", "pkcs11-rsa", "pkcs11-ecdsa", "pkcs11-ecdh", "pkcs11-rng", "pkcs11-x509"}; } + else + { + std::set all = Botan_Tests::Test::registered_tests(); + for(auto&& r : req) + { + if(all.find(r) == all.end()) + { + throw Botan_CLI::CLI_Usage_Error("Unknown test suite: " + r); + } + } + } output() << "Testing " << Botan::version_string() << "\n"; output() << "Starting tests"; -- cgit v1.2.3