From 42d831af67380384d5a77d23f0ade470b2f8f5c5 Mon Sep 17 00:00:00 2001 From: Matthias Maier Date: Sun, 2 Jul 2023 22:24:35 -0500 Subject: [PATCH] Bugfix: do not invoke diff during configure Instead, update the deal_ii_add_test() macro to allow defining a test with generated source files. --- cmake/macros/macro_deal_ii_add_test.cmake | 22 +++++++++++++++------- tests/examples/CMakeLists.txt.in | 4 ---- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/cmake/macros/macro_deal_ii_add_test.cmake b/cmake/macros/macro_deal_ii_add_test.cmake index f7f7e6d1cc..02b525109f 100644 --- a/cmake/macros/macro_deal_ii_add_test.cmake +++ b/cmake/macros/macro_deal_ii_add_test.cmake @@ -289,13 +289,21 @@ function(deal_ii_add_test _category _test_name _comparison_file) list(LENGTH _source_file _number) if(NOT _number EQUAL 1) if(_number EQUAL 0) - message(FATAL_ERROR "\n${_comparison_file}:\n" - "A comparison file (ending in .output or .run-only) has been " - "picked up but no suitable source file or parameter file was " - "found. Please provide exactly one of the following.\n" - "A source file \"${CMAKE_CURRENT_SOURCE_DIR}/${_test_name}.c[cu]\",\n" - "or a parameter file \"${CMAKE_CURRENT_SOURCE_DIR}/${_test_name}.(prm|json)[.in]\".\n" - ) + # + # None of the candidates above exist. Check whether a + # ${_test_name}.cc file gets generated during the build process: + set(_source_file "${CMAKE_CURRENT_SOURCE_DIR}/${_test_name}.cc") + get_property(_generated SOURCE "${_source_file}" PROPERTY GENERATED) + if(NOT ${_generated}) + message(FATAL_ERROR "\n${_comparison_file}:\n" + "A comparison file (ending in .output or .run-only) has been " + "picked up but no suitable source file, generated source file, or " + "parameter file was found. Please provide exactly one of the following.\n" + "A source file \"${CMAKE_CURRENT_SOURCE_DIR}/${_test_name}.c[cu]\",\n" + "or a parameter file \"${CMAKE_CURRENT_SOURCE_DIR}/${_test_name}.(prm|json)[.in]\".\n" + ) + endif() + else() string(REPLACE ";" "\n" _source_file "${_source_file}") message(FATAL_ERROR "\n${_comparison_file}:\n" diff --git a/tests/examples/CMakeLists.txt.in b/tests/examples/CMakeLists.txt.in index 1bc0c80d00..bafa43e7b8 100644 --- a/tests/examples/CMakeLists.txt.in +++ b/tests/examples/CMakeLists.txt.in @@ -20,10 +20,6 @@ foreach(_diff_file ${_diff_files}) COMMENT "Patching ${_output_file}" ) - execute_process( - COMMAND patch ${_source_file} ${_diff_file} -o ${_output_file} - ) - # Create symbolic links to the output files: file(GLOB _output_files "${_base_directory}/${_step}*.output*") foreach(_file ${_output_files}) -- 2.39.5