#
SET(_configuration)
- IF(_file MATCHES "debug")
+ IF(_file MATCHES "\\.debug\\.")
SET(_configuration DEBUG)
- ELSEIF(_file MATCHES "release")
+ ELSEIF(_file MATCHES "\\.release\\.")
SET(_configuration RELEASE)
ENDIF()
+ #
+ # 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.
+ #
+ # TODO: The indirection with ${${_test_diff_variable}} is necessary to
+ # avoid quoting issues with the command line :-/ - come up with a fix for
+ # that
+ #
+
+ SET(_test_diff_variable TEST_DIFF)
+ IF(_file MATCHES "\\.binary\\.")
+ IF(NOT DIFF_EXECUTABLE MATCHES "-NOTFOUND")
+ SET(_test_diff_variable DIFF_EXECUTABLE)
+ ENDIF()
+ ENDIF()
+
#
# Determine whether the test should be run with mpirun:
#
COMMAND rm -f ${_test_directory}/failing_diff
COMMAND touch ${_test_directory}/diff
COMMAND
- ${TEST_DIFF}
+ ${${_test_diff_variable}} # see comment in line 72
${_test_directory}/output
${_comparison_file}
> ${_test_directory}/diff
\"${_comparison}\":
The feature \"DEAL_II_${_feature}\" does not exist.\n"
)
- #SET(_define_test FALSE)
ENDIF()
ENDFOREACH()
# TEST_TIME_LIMIT
# TEST_PICKUP_REGEX
# TEST_OVERRIDE_LOCATION
-# NUMDIFF_DIR
#
# For details, consult the ./README file.
#
#
# We need deal.II and Perl as external packages:
#
+
FIND_PACKAGE(deal.II 8.0 REQUIRED
HINTS ${DEAL_II_BINARY_DIR} ${DEAL_II_DIR}
)
#
# We need a diff tool, preferably numdiff:
#
+
FIND_PROGRAM(DIFF_EXECUTABLE
NAMES diff
+ HINTS ${DIFF_DIR}
+ PATH_SUFFIXES bin
)
FIND_PROGRAM(NUMDIFF_EXECUTABLE
MARK_AS_ADVANCED(DIFF_EXECUTABLE NUMDIFF_EXECUTABLE)
-IF( NUMDIFF_EXECUTABLE MATCHES "-NOTFOUND"
- AND DIFF_EXECUTABLE MATCHES "-NOTFOUND" )
- MESSAGE(FATAL_ERROR
- "Could not find diff or numdiff. One of those are required for running the testsuite."
- )
-ENDIF()
-
IF("${TEST_DIFF}" STREQUAL "")
+ #
+ # No TEST_DIFF is set, specify one:
+ #
+
IF(NOT NUMDIFF_EXECUTABLE MATCHES "-NOTFOUND")
- SET(TEST_DIFF ${NUMDIFF_EXECUTABLE} -a 1e-6 -r 1e-8 -s ' \\t\\n:')
+ SET(TEST_DIFF ${NUMDIFF_EXECUTABLE} -a 1e-6 -r 1e-8 -s ' \\t\\n:')
+ ELSEIF(NOT DIFF_EXECUTABLE MATCHES "-NOTFOUND")
+ SET(TEST_DIFF ${DIFF_EXECUTABLE})
ELSE()
- SET(TEST_DIFF ${DIFF_EXECUTABLE})
+ MESSAGE(FATAL_ERROR
+ "Could not find diff or numdiff. One of those are required for running the testsuite.\n"
+ "Please specify TEST_DIFF by hand."
+ )
ENDIF()
-ELSE()
- # TODO: I have no idea how to prepare a custom string comming possibly
- # through two layers of command line into a list...
- SEPARATE_ARGUMENTS(TEST_DIFF ${TEST_DIFF})
ENDIF()
#
# Set a default time limit of 600 seconds:
#
+
SET_IF_EMPTY(TEST_TIME_LIMIT 600)
#
# And finally, enable testing:
#
+
ENABLE_TESTING()
#
# A custom target that does absolutely nothing. It is used in the main
# project to trigger a "make rebuild_cache" if necessary.
#
+
ADD_CUSTOM_TARGET(regenerate)
<li><a href="#restrictbuild">Restricting tests for build configurations</a></li>
<li><a href="#restrictfeature">Restricting tests for feature configurations</a></li>
<li><a href="#mpi">Running tests with MPI</a></li>
+ <li><a href="#binary">Tests with binary output</a></li>
<li><a href="#expect">Changing condition for success</a></li>
<li><a href="#layoutaddtests">Adding new tests</a></li>
</ol>
just <code>category/test.output</code>:
<pre>
- category/test.[with_<feature>=<on|off>.]*[mpirun=<x>.][expect=<y>.][<debug|release>.]output
+ category/test.[with_<feature>=<on|off>.]*[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
once in release configuration.
files for different numbers of MPI processes.
</p>
+ <a name="binary"></a>
+ <h3>Tests with binary output</h3>
+ <p>
+ If a test produces binary output add <code>binary</code> to the
+ output file to indicate this:
+ <pre>
+
+ category/test.binary.output
+ </pre>
+ The testsuite ensures that a diff tool suitable for comparing binary
+ output files is used instead of the default diff tool, which (as in
+ the case of <code>numdiff</code>) might be unable to compare binary
+ files.
+ </p>
+
<a name="expect"></a>
<h3>Changing condition for success</h3>
<p>
LIST(APPEND _options -DDEAL_II_SOURCE_DIR=${CMAKE_SOURCE_DIR})
LIST(APPEND _options -DDEAL_II_BINARY_DIR=${CMAKE_BINARY_DIR})
FOREACH(_var
+ DIFF_DIR
NUMDIFF_DIR
TEST_DIFF
TEST_OVERRIDE_LOCATION