SET(_define_test FALSE)
ENDIF()
- #
- # Respect compiler constraints:
- #
-
- STRING(REGEX MATCHALL
- "compiler=[a-zA-Z]*(>=|<=|=|>|<)(on|off|yes|no|true|false|[0-9]+(\\.[0-9]+)*)" _matches ${_test}
- )
-
- FOREACH(_match ${_matches})
- #
- # Extract compiler name, comparison operator, (a possible) boolean and
- # (a possible) version number from the feature constraint:
- #
- STRING(REGEX REPLACE
- "^compiler=([a-zA-Z]*)(=|>=|<=|>|<).*$" "\\1" _compiler ${_match}
- )
- STRING(REGEX REPLACE "^compiler=[a-zA-Z]*(>=|<=|=|>|<).*$" "\\1" _operator ${_match})
- STRING(REGEX MATCH "(on|off|yes|no|true|false)$" _boolean ${_match})
- STRING(REGEX MATCH "([0-9]+(\\.[0-9]+)*)$" _version ${_match})
-
- #
- # First process simple yes/no feature constraints:
- #
- IF(NOT "${_boolean}" STREQUAL "")
- IF(NOT "${_operator}" STREQUAL "=")
- MESSAGE(FATAL_ERROR "
-Invalid syntax in constraint \"${_match}\" in file
-\"${_comparison}\":
-Comparison operator \"=\" expected for boolean match.\n"
- )
- ENDIF()
-
- # This is why I hate CMake :-/
- IF( ( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "${_compiler}" AND NOT ${_boolean} ) OR
- ( NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "${_compiler}" AND ${_boolean} ) )
- SET(_define_test FALSE)
- ENDIF()
- ENDIF()
-
- #
- # Process version constraints:
- #
- IF(NOT "${_version}" STREQUAL "")
-
- IF( ( NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "${_compiler}" ) OR
- ( "${_operator}" STREQUAL "=" AND
- NOT "${CMAKE_CXX_COMPILER_VERSION}" VERSION_EQUAL "${_version}" ) OR
- ( "${_operator}" STREQUAL ">" AND
- NOT "${CMAKE_CXX_COMPILER_VERSION}" VERSION_GREATER "${_version}" ) OR
- ( "${_operator}" STREQUAL "<" AND
- NOT "${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS "${_version}" ) OR
- ( "${_operator}" STREQUAL ">=" AND
- "${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS "${_version}" ) OR
- ( "${_operator}" STREQUAL "<=" AND
- "${CMAKE_CXX_COMPILER_VERSION}" VERSION_GREATER "${_version}" ) )
- SET(_define_test FALSE)
- ENDIF()
- ENDIF()
- ENDFOREACH()
-
# 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)
ENDIF()
+
#
# Query configuration and check whether we support it. Otherwise
# set _define_test to FALSE:
<li><a href="#layout">Testsuite development</a></li>
<ol>
<li><a href="#layoutgeneral">General layout</a></li>
- <li><a href="#restrictcompiler">Restricting tests to specific compiler and compiler versions</a></li>
<li><a href="#restrictbuild">Restricting tests to build configurations</a></li>
<li><a href="#restrictfeature">Restricting tests to feature configurations</a></li>
<li><a href="#mpi">Running tests with MPI</a></li>
Comparison file can actually be named in a more complex way than
just <code>category/test.output</code>. In pseudo code:
<pre>
-category/test.[compiler=<string>(<=|>=|=|<|>)<yes|no|version>.]*
- [with_<string>(<=|>=|=|<|>)<on|off|version>.]*
+category/test.[with_<string>(<=|>=|=|<|>)<on|off|version>.]*
[mpirun=<x>.][expect=<y>.][binary.][<debug|release>.]output
</pre>
Normally, a test will be set up so that it runs twice, once in debug and
</pre>
</p>
- <a name="restrictcompiler"></a>
- <h3>Restricting tests to specific compiler and compiler versions</h3>
- <p>
- In a similar vain as for build configurations, it is possible to restrict
- tests to specific compiler versions, e.g.:
-<pre>
-category/test.compiler=GNU=yes.output, or
-category/test.compiler=GNU=no.output, or
-category/test.compiler=Intel>=15.0.3.output
-</pre>
- The first test will only be set up if the specified compiler string
- (in this case <code>GNU</code>) is equal to the string
- <code>${CMAKE_CXX_COMPILER_ID}</code>. Similarly, the second test
- will be set up if both strings are different. Common compiler names
- are <code>GNU</code>, <code>Clang</code>, or <code>Intel</code>.
- </p>
- <p>
- The third declaration is an example of how to specify a version
- constraint: This test will be set up if deal.II is configured with
- the Intel compiler version 15.0.3 or higher. The operators
- <code>=</code>, <code><</code>, <code>></code>, <code><=</code>,
- <code>></code>= are supported.
- </p>
-
<a name="restrictfeature"></a>
<h3>Restricting tests to feature configurations</h3>
<p>