]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/DEVEL/pxp/pxp/rtests/negative/run_negative
Initial revision
[helm.git] / helm / DEVEL / pxp / pxp / rtests / negative / run_negative
diff --git a/helm/DEVEL/pxp/pxp/rtests/negative/run_negative b/helm/DEVEL/pxp/pxp/rtests/negative/run_negative
new file mode 100755 (executable)
index 0000000..3c58a4e
--- /dev/null
@@ -0,0 +1,117 @@
+#! /bin/bash
+
+# $Id$
+
+
+t=./test_negative
+
+init_test () {
+    # $1: Options for test_negative
+    # $2: Path to test record
+    options="$1"
+    input="$2"
+    output=`dirname $input`/`basename $input .xml`.out
+    if  [ -f "$output" ]; then
+       echo "Test $input already initialized; skipping"
+    else
+       $t $options "$input" >"$output"
+       echo Test $input initialized.
+    fi
+}
+
+
+check_test () {
+    # $1: Options for test_negative
+    # $2: Path to test record
+    options="$1"
+    input="$2"
+    output=`dirname $input`/`basename $input .xml`.out
+    $t $options "$input" >current.out
+    if [ -f "$output" ]; then
+       if cmp "$output" current.out; then
+           echo Test $input OK
+       else
+           echo Test $input FAILED!!!
+       fi
+    else
+       echo Test $input still uninitialized
+       echo - OUTPUT:
+       cat current.out
+    fi
+}
+
+
+for_directory () {
+    what="$1"
+    shift
+    options="$1"
+    shift
+    while [ $# -gt 0 ]; do
+       input="$1"
+       shift
+       if [ -f "$input" ]; then
+           $what "$options" "$input"
+       else
+           if [ -d "$input" ]; then
+               for ent in $input/*.xml; do
+                   for_directory $what "$options" $ent
+               done
+           else
+               echo "Not found: $input" >&2
+           fi
+       fi
+    done
+}
+
+
+usage () {
+    cat <<EOF >&2
+usage: $0 [ -init -wf ] file ... dir ...
+EOF
+    exit 1
+}
+
+
+action="check_test"
+options=""
+while true; do
+    case "x$1" in
+       x-init)
+           action="init_test"
+           shift
+           ;;
+       x-wf)
+           options="$options -wf"
+           shift
+           ;;
+       x-*)
+           usage
+           ;;
+       *)
+           break
+           ;;
+    esac
+done
+
+
+if [ $# -gt 0 ]; then
+    for_directory $action "$options" "$@"
+else
+    for_directory $action -wf \
+       data_jclark_notwf/ext-sa data_jclark_notwf/not-sa data_jclark_notwf/sa \
+       data_notwf/sa
+    for_directory $action "" \
+       data_jclark_invalid data_invalid
+fi
+
+# ======================================================================
+# $Log$
+# Revision 1.1  2000/11/17 09:57:33  lpadovan
+# Initial revision
+#
+# Revision 1.2  2000/05/01 16:23:39  gerd
+#      Added data_invalid.
+#
+# Revision 1.1  2000/05/01 15:58:50  gerd
+#      Initial revision.
+#