Skip to content

Commit

Permalink
Merge pull request #13019 from bangerth/setup
Browse files Browse the repository at this point in the history
Skip a bunch of work for tests that we don't actually want.
  • Loading branch information
tamiko committed Dec 7, 2021
2 parents c87d08a + e46a3a3 commit dfe815a
Showing 1 changed file with 23 additions and 13 deletions.
36 changes: 23 additions & 13 deletions cmake/macros/macro_deal_ii_pickup_tests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@
# DEAL_II_PICKUP_TESTS()
#

# We use CONTINUE(), which is new in cmake 3.2
CMAKE_MINIMUM_REQUIRED(VERSION 3.2.0)

#
# Two very small macros that are used below:
Expand Down Expand Up @@ -206,22 +208,20 @@ MACRO(DEAL_II_PICKUP_TESTS)
# (and including) the first period ("."):
#
STRING(REGEX REPLACE "\\..*$" "" _regex_name "${_category}/${_test}")
IF( "${TEST_PICKUP_REGEX}" STREQUAL "" OR
"${_regex_name}" MATCHES "${TEST_PICKUP_REGEX}" )
SET(_define_test TRUE)
ELSE()
SET(_define_test FALSE)
IF( NOT ("${TEST_PICKUP_REGEX}" STREQUAL "" OR
"${_regex_name}" MATCHES "${TEST_PICKUP_REGEX}" ))
CONTINUE() # next test
ENDIF()

# Disable tests using mpirun if MPI is not enabled
STRING(REGEX MATCH "mpirun=" _matches ${_test})
IF (_matches AND NOT DEAL_II_WITH_MPI)
SET(_define_test FALSE)
CONTINUE() # next test
ENDIF()

#
# Query configuration and check whether we support it. Otherwise
# set _define_test to FALSE:
# skip the test.
#

SET(_op_regex "=|\\.geq\\.|\\.leq\\.|\\.ge\\.|\\.le\\.")
Expand All @@ -231,6 +231,7 @@ MACRO(DEAL_II_PICKUP_TESTS)
_matches ${_test}
)

SET(_skip_test FALSE)
FOREACH(_match ${_matches})
#
# Extract feature name, comparison operator, (a possible) boolean and
Expand All @@ -254,7 +255,8 @@ MACRO(DEAL_II_PICKUP_TESTS)
# If a variable is undefined, assume that we cannot configure a
# given test
#
SET(_define_test FALSE)
SET(_skip_test TRUE)
CONTINUE() # drop out of "FOREACH(_match ${_matches})"
ENDIF()
ENDIF()

Expand All @@ -273,7 +275,8 @@ Comparison operator \"=\" expected for boolean match.\n"
# This is why I hate CMake :-/
IF( (${_variable} AND NOT ${_boolean}) OR
(NOT ${_variable} AND ${_boolean}) )
SET(_define_test FALSE)
SET(_skip_test TRUE)
CONTINUE() # drop out of "FOREACH(_match ${_matches})"
ENDIF()
ENDIF()

Expand All @@ -293,15 +296,22 @@ Comparison operator \"=\" expected for boolean match.\n"
"${DEAL_II_${_feature}_VERSION}" VERSION_LESS "${_version}" ) OR
( "${_operator}" STREQUAL ".leq." AND
"${DEAL_II_${_feature}_VERSION}" VERSION_GREATER "${_version}" ) )
SET(_define_test FALSE)
SET(_skip_test TRUE)
CONTINUE() # drop out of "FOREACH(_match ${_matches})"
ENDIF()
ENDIF()
ENDFOREACH()

IF(_define_test)
STRING(REGEX REPLACE "\\..*" "" _test ${_test})
DEAL_II_ADD_TEST(${_category} ${_test} ${_comparison})
IF(_skip_test)
CONTINUE() # next test
ENDIF()

#
# We've made it all the way to here, which means that we actually
# want to define the test
#
STRING(REGEX REPLACE "\\..*" "" _test ${_test})
DEAL_II_ADD_TEST(${_category} ${_test} ${_comparison})

ENDFOREACH()
ENDMACRO()

0 comments on commit dfe815a

Please sign in to comment.