]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Quick tests: make quick test output more responsive
authorMatthias Maier <tamiko@43-1.org>
Tue, 4 Jul 2023 14:25:49 +0000 (09:25 -0500)
committerMatthias Maier <tamiko@43-1.org>
Tue, 4 Jul 2023 20:15:54 +0000 (15:15 -0500)
tests/CMakeLists.txt
tests/run_quick_tests.cmake

index f3fe17a96ce009b7a1e0d6ef661dd6f564bf4e9a..ce5d7a0e44fb26e5affdd7722b8b39ef70705e6b 100644 (file)
@@ -174,6 +174,7 @@ add_custom_target(test
   COMMAND ${CMAKE_COMMAND} -DCMAKE_BUILD_TYPE=${_my_build} -P ${CMAKE_CURRENT_SOURCE_DIR}/run_quick_tests.cmake
   WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
   COMMENT "Running quicktests..."
+  USES_TERMINAL
   )
 add_dependencies(test setup_tests_quick_tests)
 
index 4f79df5969aae3099ea8500395b200e3d28920a4..978d87c9ec4947341a76abb1af3bba40035dbcc6 100644 (file)
@@ -36,6 +36,20 @@ if("${CMAKE_BUILD_TYPE}" STREQUAL "")
 endif()
 message(STATUS "Running quick_tests in ${CMAKE_BUILD_TYPE} mode with -j${_n_processors}:")
 
+#
+# Redirect quick tests to an output.log for CMake versions 3.18 onwards
+# (when we can actually instruct CMake to also print to the standard
+# terminal).
+#
+
+set(_redirect_output "")
+if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.18)
+  set(_redirect_output
+    OUTPUT_VARIABLE _output ECHO_OUTPUT_VARIABLE
+    ERROR_VARIABLE _output ECHO_ERROR_VARIABLE
+    )
+endif()
+
 #
 # Always restrict quick tests with specified build type, but run the step
 # and affinity quick tests in all available configuration:
@@ -45,10 +59,11 @@ string(TOLOWER "${CMAKE_BUILD_TYPE}" _build_type)
 execute_process(COMMAND ${CMAKE_CTEST_COMMAND}
   -j${_n_processors} -C ${CMAKE_BUILD_TYPE} --force-new-ctest-process
   -R "quick_tests/(step.debug|step.release|affinity|.*.${_build_type})"
-  OUTPUT_VARIABLE _output ERROR_VARIABLE _output RESULT_VARIABLE _return_value
+  --output-on-failure
+  ${_redirect_output}
+  RESULT_VARIABLE _return_value
   )
 file(WRITE quick_tests.log ${_output})
-message(${_output})
 
 if(NOT "${_return_value}" STREQUAL "0")
   message("

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.