]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Testsuite: Allow to use stdout as comparison for test outputs 705/head
authorMatthias Maier <tamiko@43-1.org>
Mon, 30 Mar 2015 09:03:35 +0000 (11:03 +0200)
committerMatthias Maier <tamiko@43-1.org>
Mon, 30 Mar 2015 09:03:35 +0000 (11:03 +0200)
This commit introduces an alternative to the current test setup:

If a test does not create a file "output" for further test comparison its
output to stdout is used to populate and output file instead. For
compatibility, if a test creates the "output" file the stdout stream is
discarded.

cmake/macros/macro_deal_ii_add_test.cmake

index f029325c41b126faf8c717b3933f39670da86391..29c7ddbf5d24088d662a147cd98633e721d1d0af 100644 (file)
@@ -204,16 +204,20 @@ MACRO(DEAL_II_ADD_TEST _category _test_name _comparison_file)
         COMMAND
           rm -f ${_test_directory}/failing_output
         COMMAND
-          touch ${_test_directory}/output
+          rm -f ${_test_directory}/output
         COMMAND
-          ${_run_command}
-          || (mv ${_test_directory}/output
-                 ${_test_directory}/failing_output
+          ${_run_command} > ${_test_directory}/stdout
+          || ((test -f ${_test_directory}/output ||
+               cp ${_test_directory}/stdout ${_test_directory}/output)
+              && mv ${_test_directory}/output ${_test_directory}/failing_output
               && echo "${_test_full}: BUILD successful."
               && echo "${_test_full}: RUN failed. ------ Result: ${_test_directory}/failing_output"
               && echo "${_test_full}: RUN failed. ------ Partial output:"
               && cat ${_test_directory}/failing_output
               && exit 1)
+        COMMAND
+          test -f ${_test_directory}/output ||
+          cp ${_test_directory}/stdout ${_test_directory}/output
         COMMAND ${PERL_EXECUTABLE}
           -pi ${DEAL_II_PATH}/${DEAL_II_SHARE_RELDIR}/scripts/normalize.pl
           ${_test_directory}/output

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.