diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 03daf7f..2fcf40a 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -37,7 +37,9 @@ macro(configure_tests target) target_compile_definitions(${target} PRIVATE # Somewhat speed up Catch2 compile times CATCH_CONFIG_FAST_COMPILE - # Enable assertions for more thorough tests + # Fortify test suite for more thorough checks + _GLIBCXX_ASSERTIONS + _LIBCPP_ENABLE_ASSERTIONS=1 GFX_TIMSORT_ENABLE_ASSERT ) @@ -85,6 +87,7 @@ endmacro() # Tests that can run with C++98 add_executable(cxx_98_tests cxx_98_tests.cpp + verbose_abort.cpp ) configure_tests(cxx_98_tests) target_compile_features(cxx_98_tests PRIVATE cxx_std_98) @@ -93,6 +96,7 @@ target_compile_features(cxx_98_tests PRIVATE cxx_std_98) add_executable(cxx_11_tests merge_cxx_11_tests.cpp cxx_11_tests.cpp + verbose_abort.cpp ) configure_tests(cxx_11_tests) target_compile_features(cxx_11_tests PRIVATE cxx_std_11) @@ -100,6 +104,7 @@ target_compile_features(cxx_11_tests PRIVATE cxx_std_11) # Tests requiring C++17 support add_executable(cxx_17_tests cxx_17_tests.cpp + verbose_abort.cpp ) configure_tests(cxx_17_tests) target_compile_features(cxx_17_tests PRIVATE cxx_std_17) @@ -107,6 +112,7 @@ target_compile_features(cxx_17_tests PRIVATE cxx_std_17) # Tests requiring C++20 support add_executable(cxx_20_tests cxx_20_tests.cpp + verbose_abort.cpp ) configure_tests(cxx_20_tests) target_compile_features(cxx_20_tests PRIVATE cxx_std_20) diff --git a/tests/verbose_abort.cpp b/tests/verbose_abort.cpp new file mode 100644 index 0000000..d78e049 --- /dev/null +++ b/tests/verbose_abort.cpp @@ -0,0 +1,22 @@ +#include + +#ifdef _LIBCPP_VERSION + +#include +#include +#include + +namespace std::__1 +{ + [[noreturn]] + void __libcpp_verbose_abort(char const* format, ...) { + va_list list; + va_start(list, format); + std::vfprintf(stderr, format, list); + va_end(list); + + std::abort(); + } + } + +#endif \ No newline at end of file