aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests/unit_ecdsa.cpp
diff options
context:
space:
mode:
authorMatthias Gierlings <[email protected]>2018-04-06 20:20:35 +0200
committerMatthias Gierlings <[email protected]>2018-04-06 20:25:45 +0200
commit4476c07bae00dc2cec5183878d81b3e53ff3b97e (patch)
tree2ab30848e3a561f5999a196187aebdcbafae3faf /src/tests/unit_ecdsa.cpp
parent4292f41101bb86d528252d8395ffb93eb9fa3528 (diff)
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.
Diffstat (limited to 'src/tests/unit_ecdsa.cpp')
-rw-r--r--src/tests/unit_ecdsa.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/tests/unit_ecdsa.cpp b/src/tests/unit_ecdsa.cpp
index dc2a43af5..f94f445ee 100644
--- a/src/tests/unit_ecdsa.cpp
+++ b/src/tests/unit_ecdsa.cpp
@@ -299,14 +299,18 @@ Test::Result test_encoding_options()
result.test_eq("Hybrid point same size as uncompressed",
enc_uncompressed.size(), enc_hybrid.size());
- if(Test::avoid_undefined_behavior() == false)
+#if defined(BOTAN_HAS_SANITIZER_UNDEFINED)
+ if(Test::no_avoid_undefined_behavior())
{
+#endif
auto invalid_format = static_cast<Botan::PointGFp::Compression_Type>(99);
result.test_throws("Invalid point format throws",
"Invalid argument Invalid point encoding for EC_PublicKey",
[&] { key.set_point_encoding(invalid_format); });
+#if defined(BOTAN_HAS_SANITIZER_UNDEFINED)
}
+#endif
return result;
}