From 90409af56f6f86487cf6fcad731b9a5aa6508540 Mon Sep 17 00:00:00 2001 From: Simon Warta Date: Sat, 8 Aug 2015 12:42:45 +0200 Subject: Rename fuzzer test consistently Align filename with test_fuzzer() --- src/tests/test_fuzz.cpp | 68 ----------------------------------------------- src/tests/test_fuzzer.cpp | 68 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+), 68 deletions(-) delete mode 100644 src/tests/test_fuzz.cpp create mode 100644 src/tests/test_fuzzer.cpp (limited to 'src/tests') diff --git a/src/tests/test_fuzz.cpp b/src/tests/test_fuzz.cpp deleted file mode 100644 index a44110f24..000000000 --- a/src/tests/test_fuzz.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* -* (C) 2015 Jack Lloyd -* -* Botan is released under the Simplified BSD License (see license.txt) -*/ - -#include "tests.h" -#include -#include - -#if defined(BOTAN_HAS_X509_CERTIFICATES) - -#include -#include -#include -#include - -#endif - -namespace { - -size_t test_x509_fuzz() - { - size_t fails = 0; - -#if defined(BOTAN_HAS_X509_CERTIFICATES) - - size_t tests = 0; - const std::string fuzz_data = TEST_DATA_DIR "/fuzz"; - - for(auto vec: Botan::get_files_recursive(fuzz_data + "/x509")) - { - ++tests; - - auto start = std::chrono::system_clock::now(); - try - { - // TODO: check for memory consumption? - Botan::X509_Certificate cert(vec); - } - catch(std::exception& e) - { - //std::cout << e.what() << "\n"; - } - auto end = std::chrono::system_clock::now(); - - uint64_t duration = std::chrono::duration_cast(end - start).count(); - - if(duration > 100) - { - std::cout << "Fuzz test " << vec << " took " << duration << " ms\n"; - } - } - - test_report("Fuzz Checks", tests, fails); -#endif - - return fails; - } - -} - -size_t test_fuzzer() - { - size_t fails = 0; - fails += test_x509_fuzz(); - return fails; - } diff --git a/src/tests/test_fuzzer.cpp b/src/tests/test_fuzzer.cpp new file mode 100644 index 000000000..212a313a8 --- /dev/null +++ b/src/tests/test_fuzzer.cpp @@ -0,0 +1,68 @@ +/* +* (C) 2015 Jack Lloyd +* +* Botan is released under the Simplified BSD License (see license.txt) +*/ + +#include "tests.h" +#include +#include + +#if defined(BOTAN_HAS_X509_CERTIFICATES) + +#include +#include +#include +#include + +#endif + +namespace { + +size_t test_x509_fuzz() + { + size_t fails = 0; + +#if defined(BOTAN_HAS_X509_CERTIFICATES) + + size_t tests = 0; + const std::string fuzz_data = TEST_DATA_DIR "/fuzz"; + + for(auto vec: Botan::get_files_recursive(fuzz_data + "/x509")) + { + ++tests; + + auto start = std::chrono::system_clock::now(); + try + { + // TODO: check for memory consumption? + Botan::X509_Certificate cert(vec); + } + catch(std::exception& e) + { + //std::cout << e.what() << "\n"; + } + auto end = std::chrono::system_clock::now(); + + uint64_t duration = std::chrono::duration_cast(end - start).count(); + + if(duration > 100) + { + std::cout << "Fuzzer test " << vec << " took " << duration << " ms" << std::endl; + } + } + + test_report("Fuzzer checks", tests, fails); +#endif + + return fails; + } + +} + +size_t test_fuzzer() + { + size_t fails = 0; + fails += test_x509_fuzz(); + return fails; + } -- cgit v1.2.3