From 54febd1c8e0dd918c0465715949ddd935d00141b Mon Sep 17 00:00:00 2001
From: Wolfgang Bangerth <bangerth@math.tamu.edu>
Date: Wed, 23 Apr 2014 12:11:32 +0000
Subject: [PATCH] Output only the first few lines of numdiff output if a test
 fails. Then output the first 50 lines of regular diff since it's so much more
 readable.

git-svn-id: https://svn.dealii.org/trunk@32815 0785d39b-7218-0410-832d-ea1e28bc413d
---
 deal.II/cmake/macros/macro_add_test.cmake | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/deal.II/cmake/macros/macro_add_test.cmake b/deal.II/cmake/macros/macro_add_test.cmake
index ecbf75ec95..d2569ddde7 100644
--- a/deal.II/cmake/macros/macro_add_test.cmake
+++ b/deal.II/cmake/macros/macro_add_test.cmake
@@ -1,7 +1,7 @@
 ## ---------------------------------------------------------------------
 ## $Id$
 ##
-## Copyright (C) 2013 by the deal.II authors
+## Copyright (C) 2013, 2014 by the deal.II authors
 ##
 ## This file is part of the deal.II library.
 ##
@@ -205,7 +205,12 @@ 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_variable}} # see comment in line 72
+	  # run diff or numdiff (if available) to determine
+	  # whether files are the same. if they are not, output
+          # the first few lines of the output of numdiff, followed
+          # by the results of regular diff since the latter is just
+          # more readable
+          ${${_test_diff_variable}} # see comment above about redirection
             ${_comparison_file}
             ${_test_directory}/output
             > ${_test_directory}/diff
@@ -216,8 +221,10 @@ MACRO(DEAL_II_ADD_TEST _category _test_name _comparison_file)
               && echo "${_test_full}: DIFF failed. ------ Source: ${_comparison_file}"
               && echo "${_test_full}: DIFF failed. ------ Result: ${_test_directory}/output"
               && echo "${_test_full}: DIFF failed. ------ Diff:   ${_test_directory}/failing_diff"
-              && echo "${_test_full}: DIFF failed. ------ Diffs as follows:"
-              && cat ${_test_directory}/failing_diff
+              && echo "${_test_full}: DIFF failed. ------ First 8 lines of numdiff/diff output:"
+              && cat ${_test_directory}/failing_diff | head -n 8
+              && echo "${_test_full}: DIFF failed. ------ First 50 lines diff output:"
+              && ${DIFF_EXECUTABLE} -c ${_comparison_file} ${_test_directory}/output | head -n 50
               && exit 1)
         WORKING_DIRECTORY
           ${_test_directory}
-- 
2.39.5