From 74b371ad1d556f7269e29005942f24403730d73c Mon Sep 17 00:00:00 2001 From: Matthias Maier Date: Thu, 10 Feb 2022 04:13:33 -0600 Subject: [PATCH] CMake: implement support for ".run_only" file extension --- cmake/macros/macro_deal_ii_add_test.cmake | 59 +++++++++++++------ cmake/macros/macro_deal_ii_pickup_tests.cmake | 2 +- 2 files changed, 41 insertions(+), 20 deletions(-) diff --git a/cmake/macros/macro_deal_ii_add_test.cmake b/cmake/macros/macro_deal_ii_add_test.cmake index c44ef0cd83..df4319773f 100644 --- a/cmake/macros/macro_deal_ii_add_test.cmake +++ b/cmake/macros/macro_deal_ii_add_test.cmake @@ -189,6 +189,14 @@ FUNCTION(DEAL_II_ADD_TEST _category _test_name _comparison_file) STRING(TOUPPER ${_expect} _expect) ENDIF() + # + # Determine whether the .run_only keyword is present: + # + SET(_run_only FALSE) + IF(_file MATCHES "\\.run_only$") + SET(_run_only TRUE) + ENDIF() + # # Determine for which build types a test should be defined. # @@ -393,27 +401,40 @@ FUNCTION(DEAL_II_ADD_TEST _category _test_name _comparison_file) VERBATIM ) - FILE(GLOB _comparison_files ${_comparison_file} ${_comparison_file}.*) + IF(_run_only) + ADD_CUSTOM_TARGET(${_test_target} + COMMAND echo "${_test_full}: BUILD successful." + COMMAND echo "${_test_full}: RUN successful." + COMMAND echo "${_test_full}: DIFF skipped." + COMMAND echo "${_test_full}: PASSED." + DEPENDS ${_test_directory}/output + ) - ADD_CUSTOM_COMMAND(OUTPUT ${_test_directory}/diff - COMMAND sh ${DEAL_II_PATH}/${DEAL_II_SHARE_RELDIR}/scripts/run_test.sh - diff "${_test_full}" "${NUMDIFF_EXECUTABLE}" - "${_comparison_file}" ${_run_args} - WORKING_DIRECTORY - ${_test_directory} - DEPENDS - ${_test_directory}/output - ${_comparison_files} - VERBATIM - ) + ELSE() - ADD_CUSTOM_TARGET(${_test_target} - COMMAND echo "${_test_full}: BUILD successful." - COMMAND echo "${_test_full}: RUN successful." - COMMAND echo "${_test_full}: DIFF successful." - COMMAND echo "${_test_full}: PASSED." - DEPENDS ${_test_directory}/diff - ) + FILE(GLOB _comparison_files ${_comparison_file} ${_comparison_file}.*) + + ADD_CUSTOM_COMMAND(OUTPUT ${_test_directory}/diff + COMMAND sh ${DEAL_II_PATH}/${DEAL_II_SHARE_RELDIR}/scripts/run_test.sh + diff "${_test_full}" "${NUMDIFF_EXECUTABLE}" + "${_comparison_file}" ${_run_args} + WORKING_DIRECTORY + ${_test_directory} + DEPENDS + ${_test_directory}/output + ${_comparison_files} + VERBATIM + ) + + ADD_CUSTOM_TARGET(${_test_target} + COMMAND echo "${_test_full}: BUILD successful." + COMMAND echo "${_test_full}: RUN successful." + COMMAND echo "${_test_full}: DIFF successful." + COMMAND echo "${_test_full}: PASSED." + DEPENDS ${_test_directory}/diff + ) + + ENDIF() # # And finally define the test: diff --git a/cmake/macros/macro_deal_ii_pickup_tests.cmake b/cmake/macros/macro_deal_ii_pickup_tests.cmake index 4401839a1c..be45591131 100644 --- a/cmake/macros/macro_deal_ii_pickup_tests.cmake +++ b/cmake/macros/macro_deal_ii_pickup_tests.cmake @@ -212,7 +212,7 @@ MACRO(DEAL_II_PICKUP_TESTS) SET(DEAL_II_SOURCE_DIR) # avoid a bogus warning - FILE(GLOB _tests "*.output") + FILE(GLOB _tests "*.output" "*.run_only") FOREACH(_test ${_tests}) SET(_comparison ${_test}) GET_FILENAME_COMPONENT(_test ${_test} NAME) -- 2.39.5