]> https://gitweb.dealii.org/ - dealii.git/commitdiff
CMake: implement support for ".run_only" file extension
authorMatthias Maier <tamiko@43-1.org>
Thu, 10 Feb 2022 10:13:33 +0000 (04:13 -0600)
committerMatthias Maier <tamiko@43-1.org>
Thu, 10 Feb 2022 10:13:33 +0000 (04:13 -0600)
cmake/macros/macro_deal_ii_add_test.cmake
cmake/macros/macro_deal_ii_pickup_tests.cmake

index c44ef0cd83d1c89410284ea240d047fbc50f292b..df4319773ff4b85b2187ef696e6c881ae88d3cc2 100644 (file)
@@ -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:
index 4401839a1cee253a3a866ddb1b99845b420f9b36..be45591131e98115b90da135d1a4fc9e20d0013c 100644 (file)
@@ -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)

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.