aboutsummaryrefslogtreecommitdiff
path: root/src/test/raii_event_tests.cpp
diff options
context:
space:
mode:
authorCraig Andrews <candrews@integralblue.com>2019-08-07 11:38:11 -0400
committerLuke Dashjr <luke-jr+git@utopios.org>2019-09-20 19:15:40 +0000
commit9a19c9ada53e84d1ee8521b48f656faad48b737a (patch)
treeff5ac83be4d0433c5f1807978bd79de2eb23ac1a /src/test/raii_event_tests.cpp
parent9828f9a9962c1bee5c343847030b9cfd87a40a5e (diff)
downloadbitcoin-9a19c9ada53e84d1ee8521b48f656faad48b737a.tar.xz
Always define the raii_event_tests test suite
The test suite must always be defined (even when EVENT_SET_MEM_FUNCTIONS_IMPLEMENTED is not defined) so that the test harness doesn't fail due to not being able to find the raii_event_tests test. This improves upon 95f97f4 actually fixing https://github.com/bitcoin/bitcoin/issues/9493
Diffstat (limited to 'src/test/raii_event_tests.cpp')
-rw-r--r--src/test/raii_event_tests.cpp19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/test/raii_event_tests.cpp b/src/test/raii_event_tests.cpp
index 0f40874f55..6f03ad6fed 100644
--- a/src/test/raii_event_tests.cpp
+++ b/src/test/raii_event_tests.cpp
@@ -4,9 +4,6 @@
#include <event2/event.h>
-#ifdef EVENT_SET_MEM_FUNCTIONS_IMPLEMENTED
-// It would probably be ideal to define dummy test(s) that report skipped, but boost::test doesn't seem to make that practical (at least not in versions available with common distros)
-
#include <map>
#include <stdlib.h>
@@ -18,6 +15,10 @@
#include <boost/test/unit_test.hpp>
+BOOST_FIXTURE_TEST_SUITE(raii_event_tests, BasicTestingSetup)
+
+#ifdef EVENT_SET_MEM_FUNCTIONS_IMPLEMENTED
+
static std::map<void*, short> tags;
static std::map<void*, uint16_t> orders;
static uint16_t tagSequence = 0;
@@ -36,8 +37,6 @@ static void tag_free(void* mem) {
free(mem);
}
-BOOST_FIXTURE_TEST_SUITE(raii_event_tests, BasicTestingSetup)
-
BOOST_AUTO_TEST_CASE(raii_event_creation)
{
event_set_mem_functions(tag_malloc, realloc, tag_free);
@@ -89,6 +88,14 @@ BOOST_AUTO_TEST_CASE(raii_event_order)
event_set_mem_functions(malloc, realloc, free);
}
-BOOST_AUTO_TEST_SUITE_END()
+#else
+
+BOOST_AUTO_TEST_CASE(raii_event_tests_SKIPPED)
+{
+ // It would probably be ideal to report skipped, but boost::test doesn't seem to make that practical (at least not in versions available with common distros)
+ BOOST_TEST_MESSAGE("Skipping raii_event_tess: libevent doesn't support event_set_mem_functions");
+}
#endif // EVENT_SET_MEM_FUNCTIONS_IMPLEMENTED
+
+BOOST_AUTO_TEST_SUITE_END()