Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Always define the raii_event_tests test suite #16564

Merged
merged 1 commit into from
May 31, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions src/test/raii_event_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand All @@ -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;
Expand All @@ -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);
Expand Down Expand Up @@ -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()