Is there a way, ideally from CMakeLists.txt, to setup ctest as to
The footer should appear below the default output
The following tests FAILED:
76 - MyHardTest
Errors while running CTest
This concretizes and generalizes a somewhat unclear question that is open since more than 2 years (CMakeLists.txt: How to print a message if ctest fails?). Therefore I fear there is no easy solution.
Thence an alternative question: could the desired bevhavior achieved with CDash?
YES, CTest does have macros to achieve exactly this [1]:
CTEST_CUSTOM_PRE_TEST Command to execute before any tests are run during Test stageCTEST_CUSTOM_POST_TEST Command to execute after any tests are run during Test stageTo activate these macros from cmake for use by ctest, they must somehow be placed into the build directory. So it seems, two steps are necessary:
(1) Have a script scriptdir/CTestCustom.cmake.in somewhere in the source tree, which contains
set(CTEST_CUSTOM_POST_TEST "echo AFTER_THE_TEST")
or whatever whatever command instead of "echo"
(2) Let CMakeLists.txt call
configure_file("scriptdir/CTestCustom.cmake.in" ${CMAKE_BINARY_DIR}/CTestCustom.cmake)
so that during configuration stage a CTest configuration file is placed under the preferred name [2] CTestCustom.cmake in the build directory.
[1] https://cmake.org/Wiki/CMake/Testing_With_CTest [2] https://blog.kitware.com/ctest-performance-tip-use-ctestcustom-cmake-not-ctest/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With