Skip to content

Commit 9a19c9a

Browse files
candrewsluke-jr
authored andcommitted
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 bitcoin/bitcoin#9493
1 parent 9828f9a commit 9a19c9a

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

src/test/raii_event_tests.cpp

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44

55
#include <event2/event.h>
66

7-
#ifdef EVENT_SET_MEM_FUNCTIONS_IMPLEMENTED
8-
// 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)
9-
107
#include <map>
118
#include <stdlib.h>
129

@@ -18,6 +15,10 @@
1815

1916
#include <boost/test/unit_test.hpp>
2017

18+
BOOST_FIXTURE_TEST_SUITE(raii_event_tests, BasicTestingSetup)
19+
20+
#ifdef EVENT_SET_MEM_FUNCTIONS_IMPLEMENTED
21+
2122
static std::map<void*, short> tags;
2223
static std::map<void*, uint16_t> orders;
2324
static uint16_t tagSequence = 0;
@@ -36,8 +37,6 @@ static void tag_free(void* mem) {
3637
free(mem);
3738
}
3839

39-
BOOST_FIXTURE_TEST_SUITE(raii_event_tests, BasicTestingSetup)
40-
4140
BOOST_AUTO_TEST_CASE(raii_event_creation)
4241
{
4342
event_set_mem_functions(tag_malloc, realloc, tag_free);
@@ -89,6 +88,14 @@ BOOST_AUTO_TEST_CASE(raii_event_order)
8988
event_set_mem_functions(malloc, realloc, free);
9089
}
9190

92-
BOOST_AUTO_TEST_SUITE_END()
91+
#else
92+
93+
BOOST_AUTO_TEST_CASE(raii_event_tests_SKIPPED)
94+
{
95+
// 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)
96+
BOOST_TEST_MESSAGE("Skipping raii_event_tess: libevent doesn't support event_set_mem_functions");
97+
}
9398

9499
#endif // EVENT_SET_MEM_FUNCTIONS_IMPLEMENTED
100+
101+
BOOST_AUTO_TEST_SUITE_END()

0 commit comments

Comments
 (0)