Skip to content

Commit

Permalink
Always define the raii_event_tests test suite
Browse files Browse the repository at this point in the history
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 #9493
  • Loading branch information
candrews committed Aug 7, 2019
1 parent fa27a07 commit 2728557
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions src/test/raii_event_tests.cpp
Expand Up @@ -4,20 +4,28 @@

#include <event2/event.h>

#include <test/test_bitcoin.h>

#include <boost/test/unit_test.hpp>

BOOST_FIXTURE_TEST_SUITE(raii_event_tests, BasicTestingSetup)

#ifndef EVENT_SET_MEM_FUNCTIONS_IMPLEMENTED
BOOST_AUTO_TEST_CASE(raii_event_creation)
{
// dummy; do nothing
}
#endif // EVENT_SET_MEM_FUNCTIONS_IMPLEMENTED

#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>

#include <support/events.h>

#include <test/test_bitcoin.h>

#include <vector>

#include <boost/test/unit_test.hpp>

static std::map<void*, short> tags;
static std::map<void*, uint16_t> orders;
static uint16_t tagSequence = 0;
Expand All @@ -36,8 +44,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);
Expand Down Expand Up @@ -89,6 +95,6 @@ BOOST_AUTO_TEST_CASE(raii_event_order)
event_set_mem_functions(malloc, realloc, free);
}

BOOST_AUTO_TEST_SUITE_END()

#endif // EVENT_SET_MEM_FUNCTIONS_IMPLEMENTED

BOOST_AUTO_TEST_SUITE_END()

0 comments on commit 2728557

Please sign in to comment.