Quoting myself from tests that are meant to abort() - #11 by perlun, but moving this to a separate thread for discoverability:
[P]rocesses raising
SIGABRT
(e.g. using asserts which callabort()
) will cause ctest to printException:Subprocess aborted
and not show the output from the failing program despite how hard I try to make it: passing--extra-verbose
or settingCTEST_OUTPUT_ON_FAILURE=1
in the environment won’t make a single bit of a difference.Then when I switched the assertion code in my project to use
exit(1)
instead, it instantly started working.Is this by design or is this a limitation in ctest/cmake? I’ll readily admit I am (very much) a newbie user of cmake. The versions I’ve tested thus far are 3.24.2 which comes bundled with my CLion and 3.25.1; both seem to exhibit the same behaviour. The exception (in ctest) is typically thrown at this line: CMake/Source/CTest/cmCTestRunTest.cxx at v3.25.1 · Kitware/CMake · GitHub, which can be seen when running ctest with
--debug
.