From: maier
Date: Fri, 15 Nov 2013 15:31:05 +0000 (+0000)
Subject: Testsuite: Fix the issue with binary outputs and data_out_base_dx
X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=912855f89b448958e1bb453d6e7faee8afbfd872;p=dealii-svn.git
Testsuite: Fix the issue with binary outputs and data_out_base_dx
git-svn-id: https://svn.dealii.org/trunk@31672 0785d39b-7218-0410-832d-ea1e28bc413d
---
diff --git a/deal.II/cmake/macros/macro_add_test.cmake b/deal.II/cmake/macros/macro_add_test.cmake
index fc95f00172..8c3843a2fb 100644
--- a/deal.II/cmake/macros/macro_add_test.cmake
+++ b/deal.II/cmake/macros/macro_add_test.cmake
@@ -62,12 +62,29 @@ MACRO(DEAL_II_ADD_TEST _category _test_name _comparison_file)
#
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:
#
@@ -191,7 +208,7 @@ MACRO(DEAL_II_ADD_TEST _category _test_name _comparison_file)
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
diff --git a/deal.II/cmake/macros/macro_pickup_tests.cmake b/deal.II/cmake/macros/macro_pickup_tests.cmake
index 1e840dee4a..45b69eddce 100644
--- a/deal.II/cmake/macros/macro_pickup_tests.cmake
+++ b/deal.II/cmake/macros/macro_pickup_tests.cmake
@@ -79,7 +79,6 @@ Invalid feature constraint \"${_match}\" in file
\"${_comparison}\":
The feature \"DEAL_II_${_feature}\" does not exist.\n"
)
- #SET(_define_test FALSE)
ENDIF()
ENDFOREACH()
diff --git a/deal.II/cmake/scripts/run_testsuite.cmake b/deal.II/cmake/scripts/run_testsuite.cmake
index f4b1444450..e952fb81cb 100644
--- a/deal.II/cmake/scripts/run_testsuite.cmake
+++ b/deal.II/cmake/scripts/run_testsuite.cmake
@@ -93,7 +93,6 @@
# TEST_TIME_LIMIT
# TEST_PICKUP_REGEX
# TEST_OVERRIDE_LOCATION
-# NUMDIFF_DIR
#
# For details, consult the ./README file.
#
diff --git a/deal.II/cmake/setup_testsuite.cmake b/deal.II/cmake/setup_testsuite.cmake
index 8b8ff6b86a..e40a167517 100644
--- a/deal.II/cmake/setup_testsuite.cmake
+++ b/deal.II/cmake/setup_testsuite.cmake
@@ -65,6 +65,7 @@ ENDFOREACH()
#
# We need deal.II and Perl as external packages:
#
+
FIND_PACKAGE(deal.II 8.0 REQUIRED
HINTS ${DEAL_II_BINARY_DIR} ${DEAL_II_DIR}
)
@@ -75,8 +76,11 @@ FIND_PACKAGE(Perl REQUIRED)
#
# We need a diff tool, preferably numdiff:
#
+
FIND_PROGRAM(DIFF_EXECUTABLE
NAMES diff
+ HINTS ${DIFF_DIR}
+ PATH_SUFFIXES bin
)
FIND_PROGRAM(NUMDIFF_EXECUTABLE
@@ -87,37 +91,38 @@ 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)
diff --git a/deal.II/doc/developers/testsuite.html b/deal.II/doc/developers/testsuite.html
index 85f72404a6..c2691aa449 100644
--- a/deal.II/doc/developers/testsuite.html
+++ b/deal.II/doc/developers/testsuite.html
@@ -62,6 +62,7 @@
Restricting tests for build configurations
Restricting tests for feature configurations
Running tests with MPI
+ Tests with binary output
Changing condition for success
Adding new tests
@@ -425,7 +426,7 @@
just category/test.output
:
- 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
Normally, a test will be set up so that it runs twice, once in debug and
once in release configuration.
@@ -501,6 +502,21 @@
files for different numbers of MPI processes.
+
+ Tests with binary output
+
+ If a test produces binary output add binary
to the
+ output file to indicate this:
+
+
+ category/test.binary.output
+
+ 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 numdiff
) might be unable to compare binary
+ files.
+
+
Changing condition for success
diff --git a/deal.II/tests/CMakeLists.txt b/deal.II/tests/CMakeLists.txt
index 66f634baac..74a5cfa2f5 100644
--- a/deal.II/tests/CMakeLists.txt
+++ b/deal.II/tests/CMakeLists.txt
@@ -59,6 +59,7 @@ SET(_options)
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
diff --git a/tests/base/data_out_base_dx.output b/tests/base/data_out_base_dx.binary.output
similarity index 100%
rename from tests/base/data_out_base_dx.output
rename to tests/base/data_out_base_dx.binary.output