# Custom targets for the testsuite:
#
-# Setup tests:
-add_custom_target(setup_tests)
+#
+# Clear the test summary files that records how many tests have been configured.
+#
+set(_summary_files_prefix "${CMAKE_CURRENT_BINARY_DIR}/test_summary")
+
+# Set up all tests and print a summary:
+add_custom_target(setup_tests
+ COMMAND ${CMAKE_COMMAND}
+ -D_summary_files_prefix="${_summary_files_prefix}"
+ -P ${CMAKE_CURRENT_SOURCE_DIR}/scripts/print_summary_files.cmake
+ COMMENT "Setting up tests and printing test summary"
+ )
-# Remove all tests:
-add_custom_target(prune_tests)
+# Remove all tests and also remove all test summary files:
+add_custom_target(prune_tests
+ COMMAND ${CMAKE_COMMAND}
+ -D_summary_files_prefix="${_summary_files_prefix}"
+ -P ${CMAKE_CURRENT_SOURCE_DIR}/scripts/remove_summary_files.cmake
+ COMMENT "Cleaning tests and removing test summary files"
+ )
foreach(_category ${_categories})
set(_category_dir ${CMAKE_CURRENT_SOURCE_DIR}/${_category})
# Do not pass the generator with -G so that we use make instead of ninja
# for the test projects. This is because calling ninja several times in
# parallel for the same project will break the configuration.
- set(_command ${CMAKE_COMMAND} ${_options} ${_category_dir} > /dev/null)
+
+ set(_command ${CMAKE_COMMAND} ${_options} ${_category_dir} > "${_summary_files_prefix}_${_category}")
endif()
add_custom_target(setup_tests_${_category}
--- /dev/null
+#
+# Glob all test summary files and print them
+#
+
+if("${_summary_files_prefix}" STREQUAL "")
+ message(FATAL_ERROR "The variable _summary_files_prefix is not set.")
+endif()
+
+file(GLOB _files "${_summary_files_prefix}_*")
+foreach(_file ${_files})
+ file(STRINGS "${_file}" _summary_string REGEX "Test category ")
+ if(NOT "${_summary_string}" STREQUAL "")
+ message("${_summary_string}")
+ endif()
+endforeach()
--- /dev/null
+#
+# Glob all test summary files and remove them
+#
+
+if("${_summary_files_prefix}" STREQUAL "")
+ message(FATAL_ERROR "The variable _summary_files_prefix is not set.")
+endif()
+
+file(GLOB _files "${_summary_files_prefix}_*")
+if(NOT "${_files}" STREQUAL "")
+ file(REMOVE ${_files})
+endif()