From: Matthias Maier Date: Mon, 23 Mar 2015 13:05:11 +0000 (+0100) Subject: Testsuite: Augment feature constraints with version number X-Git-Tag: v8.3.0-rc1~363^2~3 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e97439672e1b8b5ef13ce2adb8c724c264f22615;p=dealii.git Testsuite: Augment feature constraints with version number 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]+)* --- diff --git a/tests/macro_pickup_tests.cmake b/tests/macro_pickup_tests.cmake index 7fb9248ea3..f6d6d58414 100644 --- a/tests/macro_pickup_tests.cmake +++ b/tests/macro_pickup_tests.cmake @@ -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)