From 4476c07bae00dc2cec5183878d81b3e53ff3b97e Mon Sep 17 00:00:00 2001 From: Matthias Gierlings Date: Fri, 6 Apr 2018 20:20:35 +0200 Subject: Make tests pass by default in UBSAN mode - Adds macros to check if botan was compiled with a certain sanitizers. - Automatically excludes the tests that are intended to provoke undefined behaviour from the test bench, when botan is compiled with UBSAN. - Changes option `--avoid-undefined` to `--no-avoid-undefined` so the failing tests can be explicitly activated when needed. --- src/tests/test_dl_group.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/tests/test_dl_group.cpp') diff --git a/src/tests/test_dl_group.cpp b/src/tests/test_dl_group.cpp index 10a7e3bc6..c9e654bd7 100644 --- a/src/tests/test_dl_group.cpp +++ b/src/tests/test_dl_group.cpp @@ -44,16 +44,19 @@ class DL_Group_Tests final : public Test "DL_Group uninitialized", []() { Botan::DL_Group dl; dl.get_p(); }); - if(Test::avoid_undefined_behavior() == false) +#if defined(BOTAN_HAS_SANITIZER_UNDEFINED) + if(Test::no_avoid_undefined_behavior()) { +#endif result.test_throws("Bad generator param", "Invalid argument DL_Group unknown PrimeType", []() { auto invalid_type = static_cast(9); Botan::DL_Group dl(Test::rng(), invalid_type, 1024); }); +#if defined(BOTAN_HAS_SANITIZER_UNDEFINED) } - +#endif return result; } -- cgit v1.2.3