]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
add new script for test evaluation
authorguido <guido@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 19 Jun 2006 17:48:50 +0000 (17:48 +0000)
committerguido <guido@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 19 Jun 2006 17:48:50 +0000 (17:48 +0000)
git-svn-id: https://svn.dealii.org/trunk@13274 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/common/scripts/diffsearch [new file with mode: 0755]

diff --git a/deal.II/common/scripts/diffsearch b/deal.II/common/scripts/diffsearch
new file mode 100755 (executable)
index 0000000..2d7a0b9
--- /dev/null
@@ -0,0 +1,54 @@
+#!/bin/bash
+# $Id$
+
+######################################################################
+#
+# Compare the file $1/output with files in $1/cmp 
+#
+# Upon success, store the name of the successful file in $1/cmp
+# in the file $1/OK
+#
+######################################################################
+
+# Process command line arguments.
+# $1 is the name of the test.
+#
+# options may be
+#   -v for verbose output of diff
+
+diffout="/dev/null"
+diffopt=""
+
+for arg in $* ; do
+  if test "x$arg" = "x-v" ; then
+    diffout="/dev/stdout" ;
+  fi
+done
+
+# First, we check if $1/OK exists. If so, it hopefully contains the
+# name of the successful comparison file in $1/cmp
+
+if test -r $1/OK; then
+  okname=`cat $1/OK`
+  if test "x$okname" != "x" ; then
+    echo -n " $1/cmp/$okname"
+    if diff $diffopt $1/output $1/cmp/$okname > $diffout ; then
+      exit 0 ;
+    fi
+  fi
+fi
+
+# If this round failed, check all files in this directory
+# If successful, write the name into $1/OK
+
+for file in `cd $1/cmp ; ls` ; do
+  echo -n " $1/cmp/$file"
+  if diff $diffopt $1/output $1/cmp/$file > $diffout ; then
+    echo $file > $1/OK
+    exit 0 ;
+  fi
+done
+
+# All files failed
+exit 1
+

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.