Skip to content
Snippets Groups Projects
Commit 14c714c9 authored by Elias Pipping's avatar Elias Pipping
Browse files

Make testdebugallocator_fail{1,4,5} pass on OS X

mprotect violations are required to lead to a SIGSEGV on Linux.
OS X is more permissive, allowing for both SIGSEGV and SIGBUS.

And practice, the tests generate a SIGBUS for me, causing the tests to
fail. Confusingly, ctest describes the problem as

  Exception: SegFault

which I assume they use as a catch-all term.
parent a0a914d4
No related branches found
No related tags found
1 merge request!43`mprotect` can only be used for `mmap`'ed memory
......@@ -116,7 +116,7 @@ dune_add_test(SOURCES testdebugallocator.cc
dune_add_test(NAME testdebugallocator_fail1
SOURCES testdebugallocator.cc
LINK_LIBRARIES dunecommon
COMPILE_DEFINITIONS "FAILURE1;EXPECTED_SIGNAL=SIGSEGV"
COMPILE_DEFINITIONS "FAILURE1;EXPECTED_SIGNAL=SIGSEGV;EXPECTED_ALT_SIGNAL=SIGBUS"
EXPECT_FAIL)
dune_add_test(NAME testdebugallocator_fail2
......@@ -134,13 +134,13 @@ dune_add_test(NAME testdebugallocator_fail3
dune_add_test(NAME testdebugallocator_fail4
SOURCES testdebugallocator.cc
LINK_LIBRARIES dunecommon
COMPILE_DEFINITIONS "FAILURE4;DEBUG_ALLOCATOR_KEEP=1;EXPECTED_SIGNAL=SIGSEGV"
COMPILE_DEFINITIONS "FAILURE4;DEBUG_ALLOCATOR_KEEP=1;EXPECTED_SIGNAL=SIGSEGV;EXPECTED_ALT_SIGNAL=SIGBUS"
EXPECT_FAIL)
dune_add_test(NAME testdebugallocator_fail5
SOURCES testdebugallocator.cc
LINK_LIBRARIES dunecommon
COMPILE_DEFINITIONS "FAILURE5;EXPECTED_SIGNAL=SIGSEGV"
COMPILE_DEFINITIONS "FAILURE5;EXPECTED_SIGNAL=SIGSEGV;EXPECTED_ALT_SIGNAL=SIGBUS"
EXPECT_FAIL)
dune_add_test(SOURCES testfloatcmp.cc)
......
......@@ -93,6 +93,9 @@ int main(int, char**)
#if EXPECTED_SIGNAL
std::signal(EXPECTED_SIGNAL, std::_Exit);
#endif
#if EXPECTED_ALT_SIGNAL
std::signal(EXPECTED_ALT_SIGNAL, std::_Exit);
#endif
basic_tests();
allocator_tests();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment