From 036f19fc218e595d06144024c562645709b99344 Mon Sep 17 00:00:00 2001 From: Bram de Greve Date: Thu, 9 May 2024 18:39:14 +0200 Subject: [PATCH] Add CTest output on failure When running the test suite through CMake (by building RUN_TESTS are make test), you don't get to see the output of the tests. You just see something like this: Start 1: test_io_arg_parser 1/82 Test #1: test_io_arg_parser ................. Passed 0.00 sec Start 2: test_io_binary_stream 2/82 Test #2: test_io_binary_stream ........... ***Failed 0.00 sec Start 3: test_io_file_attributes 3/82 Test #3: test_io_file_attributes ............ Passed 0.01 sec This makes it hard to debug failing unittests on CI builds, where it's hard to get to the output log files, or to rerun unittests manually. This flag will print the output of failing tests, for easier debugging. --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 26864b72..8becf78b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -119,6 +119,7 @@ endif() set(DART_TESTING_TIMEOUT 240 CACHE STRING "Maximum time allowed before CTest will kill the test.") include(CTest) if(BUILD_TESTING) + list(APPEND CMAKE_CTEST_ARGUMENTS "--output-on-failure") enable_testing() add_subdirectory(test_suite) if(MSVC_IDE)