diff options
author | Jack Lloyd <[email protected]> | 2018-03-28 18:27:06 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2018-03-28 18:27:06 -0400 |
commit | d422423dcdc6b8735d7072f328c83dd382953a3a (patch) | |
tree | 3bcbcd460ef023b1b31352d0915df16f666ab9df /src/tests/tests.cpp | |
parent | 632392451b2965764fd094cb5195cabc98f2a4b5 (diff) |
Add new test option --abort-on-first-fail
Calls std::abort the first time a test fails. Not for general
consumption but sometimes very useful when tracking down a tricky bug.
Diffstat (limited to 'src/tests/tests.cpp')
-rw-r--r-- | src/tests/tests.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/tests/tests.cpp b/src/tests/tests.cpp index e4ed5e896..2aa1a9d75 100644 --- a/src/tests/tests.cpp +++ b/src/tests/tests.cpp @@ -159,6 +159,11 @@ void Test::Result::test_failure(const std::string& what, const uint8_t buf[], si bool Test::Result::test_failure(const std::string& err) { m_fail_log.push_back(err); + + if(m_who != "Failing Test" && m_abort_on_first_fail) + { + std::abort(); + } return false; } @@ -553,6 +558,7 @@ std::string Test::m_data_dir; bool Test::m_log_success = false; bool Test::m_run_online_tests = false; bool Test::m_run_long_tests = false; +bool Test::m_abort_on_first_fail = false; std::string Test::m_pkcs11_lib; Botan_Tests::Provider_Filter Test::m_provider_filter; @@ -560,6 +566,7 @@ Botan_Tests::Provider_Filter Test::m_provider_filter; void Test::set_test_options(bool log_success, bool run_online, bool run_long, + bool abort_on_first_fail, const std::string& data_dir, const std::string& pkcs11_lib, const Botan_Tests::Provider_Filter& pf) @@ -568,6 +575,7 @@ void Test::set_test_options(bool log_success, m_log_success = log_success; m_run_online_tests = run_online; m_run_long_tests = run_long; + m_abort_on_first_fail = abort_on_first_fail; m_pkcs11_lib = pkcs11_lib; m_provider_filter = pf; } |