aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests/tests.h
diff options
context:
space:
mode:
authorSimon Warta <[email protected]>2015-06-26 20:20:32 +0200
committerSimon Warta <[email protected]>2015-07-03 10:33:45 +0200
commitf472b8fc61accbbaa6a36af9d2d20b0fde37a1a2 (patch)
tree8e71c24da6f7f5b037024741105ca392369e590a /src/tests/tests.h
parentcd9037e29f32197b9c37ef7bec955ac2372b543b (diff)
Make Botan compile when only some modules are enabled
Fixes #146.
Diffstat (limited to 'src/tests/tests.h')
-rw-r--r--src/tests/tests.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/tests/tests.h b/src/tests/tests.h
index a086281e7..15ce4b4ab 100644
--- a/src/tests/tests.h
+++ b/src/tests/tests.h
@@ -1,5 +1,6 @@
/*
* (C) 2014,2015 Jack Lloyd
+* (C) 2015 Simon Warta (Kullo GmbH)
*
* Botan is released under the Simplified BSD License (see license.txt)
*/
@@ -7,12 +8,14 @@
#ifndef BOTAN_TESTS_H__
#define BOTAN_TESTS_H__
+#include <botan/build.h>
#include <botan/rng.h>
#include <functional>
#include <istream>
#include <map>
#include <string>
#include <vector>
+#include <iostream>
Botan::RandomNumberGenerator& test_rng();
@@ -102,4 +105,31 @@ size_t test_nist_x509();
size_t test_srp6();
size_t test_compression();
+#define SKIP_TEST(testname) \
+ size_t test_ ## testname() { \
+ std::cout << "Skipping tests: " << # testname << std::endl; \
+ return 0; \
+ } \
+
+/*
+ * Warn if a test requires loading more modules than necessary to build
+ * the lib. E.g.
+ * $ ./configure.py --no-autoload --enable-modules='ocb'
+ * $ make
+ * $ ./botan-test ocb
+ * warns the user whereas
+ * $ ./configure.py --no-autoload --enable-modules='ocb,aes'
+ * $ make
+ * $ ./botan-test ocb
+ * runs the test.
+ */
+#define UNTESTED_WARNING(testname) \
+ size_t test_ ## testname() { \
+ std::cout << "Skipping tests: " << # testname << std::endl; \
+ std::cout << "WARNING: " << # testname << " has been compiled " \
+ << "but is not tested due to other missing modules." \
+ << std::endl; \
+ return 0; \
+ } \
+
#endif