#
# A Macro to set up tests for the testsuite
#
-# This macro assumes that a source file "./tests/category/<test_name>.cc"
-# as well as the comparison file "<comparison_file>" is available in the
-# testsuite. The output of compiled source file is compared against the
-# file comparison file.
+# This macro assumes that a source file "${test_name}.cc" as well as the
+# comparison file "${comparison_file}" is available in the testsuite. The
+# output of the compiled source file is compared against the file
+# comparison file.
#
-# For every deal.II build type (given by the variable DEAL_II_BUILD_TYPES) that
-# is a (case insensitive) substring of CMAKE_BUILD_TYPE a test is defined.
+# For every deal.II build type (given by the variable DEAL_II_BUILD_TYPES)
+# that is a (case insensitive) substring of CMAKE_BUILD_TYPE a test is
+# defined.
#
# This macro gets the following options from the comparison file name (have
# a look at the testsuite documentation for details):
#
# The following variables must be set:
#
-# TEST_DIFF
-# - specifying the executable and command line of the diff command to use
+# NUMDIFF_EXECUTABLE, DIFF_EXECUTABLE
+# - pointing to valid diff executables. If NUMDIFF_EXECUTABLE is not
+# "numdiff" it will be ignored and DIFF_EXECUTABLE is used instead.
#
# TEST_TIME_LIMIT
# - specifying the maximal wall clock time in seconds a test is allowed
#
# Determine valid build configurations for this test:
#
-
SET(_configuration)
IF(_file MATCHES "\\.debug\\.")
SET(_configuration DEBUG)
# A "binary" in the output file indicates binary output. In this case we
# have to switch to plain diff instead of (possibly) numdiff, which can
# only work on plain text files.
-
+ #
IF(_file MATCHES "\\.binary\\.")
SET(_test_diff ${DIFF_EXECUTABLE})
ELSE()
#
# Determine whether the test should be run with mpirun:
#
-
STRING(REGEX MATCH "mpirun=([0-9]*)" _n_cpu ${_file})
IF("${_n_cpu}" STREQUAL "")
SET(_n_cpu 0) # 0 indicates that no mpirun should be used
#
# Determine the expected build stage of this test:
#
-
STRING(REGEX MATCH "expect=([a-z]*)" _expect ${_file})
IF("${_expect}" STREQUAL "")
SET(_expect "PASSED")
#
# Add an executable for the current test and set up compile
- # definitions and the full link interface:
+ # definitions and the full link interface. Only add the target once.
#
IF(NOT TARGET ${_target})
- # only add the target once
#
# Add a "guard file" rule: The purpose of interrupt_guard.cc is to
)
#
- # And finally add the test:
+ # And finally define the test:
#
ADD_TEST(NAME ${_test_full}
# - specifying the maximal wall clock time in seconds a test is
# allowed to run
#
+# Either numdiff (if available), or diff are used for the comparison of
+# test results. Their location can be specified with NUMDIFF_DIR and
+# DIFF_DIR.
+#
# Usage:
# DEAL_II_PICKUP_TESTS()
#
ENDIF()
#
- # We need perl:
+ # Necessary external interpreters and programs:
#
FIND_PACKAGE(Perl REQUIRED)
- #
- # We need a diff tool, preferably numdiff:
- #
-
FIND_PROGRAM(DIFF_EXECUTABLE
NAMES diff
HINTS ${DIFF_DIR}
SET_IF_EMPTY(TEST_TIME_LIMIT 600)
#
- # Enable testing...
+ # ... and finally pick up tests:
#
ENABLE_TESTING()
- #
- # ... and finally pick up tests:
- #
-
SET_IF_EMPTY(TEST_PICKUP_REGEX "$ENV{TEST_PICKUP_REGEX}")
-
-
GET_FILENAME_COMPONENT(_category ${CMAKE_CURRENT_SOURCE_DIR} NAME)
SET(DEAL_II_SOURCE_DIR) # avoid a bogus warning
ENDIF()
#
- # Respect compiler constraint:
+ # Respect compiler constraints:
#
STRING(REGEX MATCHALL
IF(_define_test)
STRING(REGEX REPLACE "\\..*" "" _test ${_test})
- DEAL_II_ADD_TEST(${_category} ${_test} ${_comparison} ${_add_output})
+ DEAL_II_ADD_TEST(${_category} ${_test} ${_comparison})
ENDIF()
ENDFOREACH()