]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Testsuite: Fix the issue with binary outputs and data_out_base_dx
authorMatthias Maier <tamiko@kyomu.43-1.org>
Fri, 15 Nov 2013 15:31:05 +0000 (15:31 +0000)
committerMatthias Maier <tamiko@kyomu.43-1.org>
Fri, 15 Nov 2013 15:31:05 +0000 (15:31 +0000)
git-svn-id: https://svn.dealii.org/trunk@31672 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/cmake/macros/macro_add_test.cmake
deal.II/cmake/macros/macro_pickup_tests.cmake
deal.II/cmake/scripts/run_testsuite.cmake
deal.II/cmake/setup_testsuite.cmake
deal.II/doc/developers/testsuite.html
deal.II/tests/CMakeLists.txt
tests/base/data_out_base_dx.binary.output [moved from tests/base/data_out_base_dx.output with 100% similarity]

index fc95f00172d80d1b935f5b44ca2a46e63a362e95..8c3843a2fb3955223a588511a3ff3ab912ac8e4e 100644 (file)
@@ -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
index 1e840dee4a22eb7533799d94607a1f20e5727b87..45b69eddce6171e86b21f5220efe21e7b45fd636 100644 (file)
@@ -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()
 
index f4b1444450d021a4fd24b05c0b9df14777007d0d..e952fb81cb0eb7e6732515b1c8023969da954b8c 100644 (file)
@@ -93,7 +93,6 @@
 #   TEST_TIME_LIMIT
 #   TEST_PICKUP_REGEX
 #   TEST_OVERRIDE_LOCATION
-#   NUMDIFF_DIR
 #
 # For details, consult the ./README file.
 #
index 8b8ff6b86acb42b81f54a16bb03a669e6e813f40..e40a16751700f65e930f1ed370307c5cbf864f17 100644 (file)
@@ -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)
index 85f72404a618d9afaffa81f0f1a137f9f8c8a3e2..c2691aa4492c7dd942fb502400709498907c2c0c 100644 (file)
@@ -62,6 +62,7 @@
           <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_&lt;feature&gt;=&lt;on|off&gt;.]*[mpirun=&lt;x&gt;.][expect=&lt;y&gt;.][&lt;debug|release&gt;.]output
+    category/test.[with_&lt;feature&gt;=&lt;on|off&gt;.]*[mpirun=&lt;x&gt;.][expect=&lt;y&gt;.][binary.][&lt;debug|release&gt;.]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>
index 66f634baac09f5c6cf3071413ea7cb4b48ac9ea5..74a5cfa2f5803df01ebe3dcc86b1d9d1590f5d5f 100644 (file)
@@ -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

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.