CMake verbose output from tests
cmake, ctest
Solution
From GNU Radio's wiki page on doing tests on out-of-tree modules (courtesy of Mr. Braun):
Run `ctest -V` from the build directory (usually), and it will give you verbose information. Add `-R regex` to execute only tests that match `regex`.
Now, re-running a test on failure does seem to make a whole lot of sense to me -- and not automatically doing that on every `make test`, too, as tests might be time-consuming, and shouldn't be repeated in a broken build environment, etc. by default.
How to add that behaviour to the default `make test` behaviour of course depends on your CMake infrastructure, and I can't answer that without reading through your code.
Problem
How do I get "make test" to display verbose output? I want "make test" to do the same thing as ctest -V through the command line. I have tried adding the following to my CMakeLists.txt, nothing worked :( ``` set(ENV{CTEST_OUTPUT_ON_FAILURE} TRUE) add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --verbose) add_custom_command(TARGET test PRE_BUILD COMMAND ${CMAKE_CTEST_COMMAND} -V) ``` But I still get this when I run make test: ``` Start 1: unittest1 1/143 Test #1: unittest1 .................................... Passed 0.01 sec Start 2: unittest2 2/143 Test #2: unittest2 ............................ Passed 0.03 sec Start 3: unittest3 3/143 Test #3: unittest3 .................... Passed 0.02 sec ``` To clarify, I want to add something to my CMakeLists.txt to make this possible, I don't want a manual solution that requires me to append something to "make test" in the command line such as ``` CTEST_OUTPUT_ON_FAILURE=TRUE make test ``` or ``` ctest -V ``` My question is similar to Using cmake how do I get verbose output from ctest?.