diff options
Diffstat (limited to 'src/tests/tests.cpp')
-rw-r--r-- | src/tests/tests.cpp | 40 |
1 files changed, 25 insertions, 15 deletions
diff --git a/src/tests/tests.cpp b/src/tests/tests.cpp index 81da95736..a4d81135a 100644 --- a/src/tests/tests.cpp +++ b/src/tests/tests.cpp @@ -337,9 +337,8 @@ bool Test::Result::test_rc(const std::string& func, int expected, int rc) return test_success(); } -namespace { - -std::string format_time(uint64_t ns) +//static +std::string Test::format_time(uint64_t ns) { std::ostringstream o; @@ -355,8 +354,6 @@ std::string format_time(uint64_t ns) return o.str(); } -} - std::string Test::Result::result_string(bool verbose) const { if(tests_run() == 0 && !verbose) @@ -475,34 +472,28 @@ std::vector<Test::Result> Test::run_test(const std::string& test_name, bool fail // static member variables of Test Botan::RandomNumberGenerator* Test::m_test_rng = nullptr; std::string Test::m_data_dir; -size_t Test::m_soak_level = 0; 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; //static -void Test::setup_tests(size_t soak, - bool log_success, +void Test::setup_tests(bool log_success, bool run_online, + bool run_long, const std::string& data_dir, const std::string& pkcs11_lib, Botan::RandomNumberGenerator* rng) { m_data_dir = data_dir; - m_soak_level = soak; m_log_success = log_success; m_run_online_tests = run_online; + m_run_long_tests = run_long; m_test_rng = rng; m_pkcs11_lib = pkcs11_lib; } //static -size_t Test::soak_level() - { - return m_soak_level; - } - -//static std::string Test::data_file(const std::string& what) { return Test::data_dir() + "/" + what; @@ -527,6 +518,12 @@ bool Test::run_online_tests() } //static +bool Test::run_long_tests() + { + return m_run_long_tests; + } + +//static std::string Test::pkcs11_lib() { return m_pkcs11_lib; @@ -787,6 +784,12 @@ parse_cpuid_bits(const std::vector<std::string>& tok) } +bool Text_Based_Test::skip_this_test(const std::string& /*header*/, + const VarMap& /*vars*/) + { + return false; + } + std::vector<Test::Result> Text_Based_Test::run() { std::vector<Test::Result> results; @@ -816,7 +819,9 @@ std::vector<Test::Result> Text_Based_Test::run() continue; } else if(line[0] == '#') + { throw Test_Error("Unknown test pragma '" + line + "' in " + m_cur_src_name); + } if(line[0] == '[' && line[line.size()-1] == ']') { @@ -850,6 +855,11 @@ std::vector<Test::Result> Text_Based_Test::run() { try { + if(skip_this_test(header, vars)) + { + continue; + } + ++test_cnt; uint64_t start = Test::timestamp(); |