]> https://gitweb.dealii.org/ - dealii.git/commitdiff
CMake: deal_ii_add_test() count how many tests we are setting up
authorMatthias Maier <tamiko@43-1.org>
Sat, 1 Jul 2023 03:24:40 +0000 (22:24 -0500)
committerMatthias Maier <tamiko@43-1.org>
Sat, 1 Jul 2023 03:24:40 +0000 (22:24 -0500)
This sets the variables _number_of_tests _number_of_test_dependencies in
the parent scope from which deal_ii_add_test() was invoked.

cmake/macros/macro_deal_ii_add_test.cmake

index 9646eac8c09ba9baec9812182e13b4a370e13915..f7f7e6d1ccf5ab85828626e5b8c12e951d413a4c 100644 (file)
@@ -324,6 +324,14 @@ function(deal_ii_add_test _category _test_name _comparison_file)
   endif()
 
   foreach(_build ${_build_types})
+    #
+    # Increment the _number_of_tests counter by one in the parent scope.
+    # Note that the variable can be undefined initially. In this case we
+    # simply store "1" in the first iteration.
+    #
+    math(EXPR _number_of_tests "${_number_of_tests} + 1")
+    set(_number_of_tests "${_number_of_tests}" PARENT_SCOPE)
+
     #
     # Obey "debug" and "release" keywords in the output file:
     #
@@ -483,6 +491,17 @@ function(deal_ii_add_test _category _test_name _comparison_file)
       #
 
       if(_shared_target AND NOT TARGET ${_test_executable_target})
+        #
+        # Increment the _number_of_test_dependencies counter by one in the
+        # parent scope. Test dependencies are all tests where we have split
+        # out compiling and linking of an executable into a separate
+        # "test_dependency/" test. Note that the variable can be undefined
+        # initially. In this case we simply store "1" in the first
+        # iteration.
+        #
+        math(EXPR _number_of_test_dependencies "${_number_of_test_dependencies} + 1")
+        set(_number_of_test_dependencies "${_number_of_test_dependencies}" PARENT_SCOPE)
+
         add_custom_target(${_test_executable_target}
           COMMAND echo "${_test_executable_full}: BUILD successful."
           COMMAND echo "${_test_executable_full}: RUN skipped."

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.