]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Testsuite: Augment feature constraints with version number
authorMatthias Maier <tamiko@43-1.org>
Mon, 23 Mar 2015 13:05:11 +0000 (14:05 +0100)
committerMatthias Maier <tamiko@43-1.org>
Mon, 23 Mar 2015 13:11:23 +0000 (14:11 +0100)
Beside the already introduced constraints

  with_feature=(yes|true|on)
  with_feature=(no|false|off)

it is now also possible to specify a version number:

  with_feature=x.y.z

A test with this constraint will be picked up if

 a) deal.II is configured with "feature"

 b) DEAL_II_FEATURE_VERSION is defined (in deal.IIConfig.cmake) and
    DEAL_II_FEATURE_VERSION is "version greater or equal" than "x.y.z"

A version number "x.y.z" must satisfy the regular expression [0-9]+(\.[0-9]+)*

tests/macro_pickup_tests.cmake

index 7fb9248ea3c6b12b71ab80a9cc8f4bc79a888a00..f6d6d584145d0b5a699a56eb85985959d18b2f20 100644 (file)
@@ -76,29 +76,46 @@ MACRO(DEAL_II_PICKUP_TESTS)
     #
 
     STRING(REGEX MATCHALL
-      "with_([0-9]|[a-z]|_)*=(on|off|yes|no|true|false)" _matches ${_test}
+      "with_([0-9]|[a-z]|_)*=(on|off|yes|no|true|false|[0-9]+(\\.[0-9]+)*)"
+      _matches ${_test}
       )
+
     FOREACH(_match ${_matches})
-      STRING(REGEX REPLACE
-        "^(with_([0-9]|[a-z]|_)*)=(on|off|yes|no|true|false)$" "\\1"
-        _feature ${_match}
-        )
+      STRING(REGEX REPLACE "^with_(([0-9]|[a-z]|_)*)=.*" "\\1" _feature ${_match})
       STRING(TOUPPER ${_feature} _feature)
 
-      # Make sure that _match is a valid feature constraint:
-      IF(DEFINED DEAL_II_${_feature})
-        STRING(REGEX MATCH "(on|off|yes|no|true|false)$" _boolean ${_match})
-        IF( (DEAL_II_${_feature} AND NOT ${_boolean}) OR
-            (NOT DEAL_II_${_feature} AND ${_boolean}) )
-          SET(_define_test FALSE)
-        ENDIF()
-      ELSE()
+      IF(NOT DEFINED DEAL_II_WITH_${_feature})
         MESSAGE(FATAL_ERROR "
 Invalid feature constraint \"${_match}\" in file
 \"${_comparison}\":
 The feature \"DEAL_II_${_feature}\" does not exist.\n"
           )
       ENDIF()
+
+      #
+      # First process simple yes/no feature constraints:
+      #
+      STRING(REGEX MATCH "(on|off|yes|no|true|false)$" _boolean ${_match})
+      IF(NOT "${_boolean}" STREQUAL "")
+        IF( (DEAL_II_WITH_${_feature} AND NOT ${_boolean}) OR
+            (NOT DEAL_II_WITH_${_feature} AND ${_boolean}) )
+          SET(_define_test FALSE)
+        ENDIF()
+      ENDIF()
+
+      #
+      # Process version constraints:
+      #
+      STRING(REGEX MATCH "([0-9]+(\\.[0-9]+)*)$" _version ${_match})
+      IF(NOT "${_version}" STREQUAL "")
+
+        SET(_define_test ${DEAL_II_WITH_${_feature}})
+
+        IF("${DEAL_II_${_feature}_VERSION}" VERSION_LESS "${_version}")
+          SET(_define_test FALSE)
+        ENDIF()
+      ENDIF()
+
     ENDFOREACH()
 
     IF(_define_test)

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.