]> matita.cs.unibo.it Git - helm.git/blob - helm/DEVEL/pxp/pxp/rtests/negative/run_negative
Initial revision
[helm.git] / helm / DEVEL / pxp / pxp / rtests / negative / run_negative
1 #! /bin/bash
2
3 # $Id$
4
5
6 t=./test_negative
7
8 init_test () {
9     # $1: Options for test_negative
10     # $2: Path to test record
11     options="$1"
12     input="$2"
13     output=`dirname $input`/`basename $input .xml`.out
14     if  [ -f "$output" ]; then
15         echo "Test $input already initialized; skipping"
16     else
17         $t $options "$input" >"$output"
18         echo Test $input initialized.
19     fi
20 }
21
22
23 check_test () {
24     # $1: Options for test_negative
25     # $2: Path to test record
26     options="$1"
27     input="$2"
28     output=`dirname $input`/`basename $input .xml`.out
29     $t $options "$input" >current.out
30     if [ -f "$output" ]; then
31         if cmp "$output" current.out; then
32             echo Test $input OK
33         else
34             echo Test $input FAILED!!!
35         fi
36     else
37         echo Test $input still uninitialized
38         echo - OUTPUT:
39         cat current.out
40     fi
41 }
42
43
44 for_directory () {
45     what="$1"
46     shift
47     options="$1"
48     shift
49     while [ $# -gt 0 ]; do
50         input="$1"
51         shift
52         if [ -f "$input" ]; then
53             $what "$options" "$input"
54         else
55             if [ -d "$input" ]; then
56                 for ent in $input/*.xml; do
57                     for_directory $what "$options" $ent
58                 done
59             else
60                 echo "Not found: $input" >&2
61             fi
62         fi
63     done
64 }
65
66
67 usage () {
68     cat <<EOF >&2
69 usage: $0 [ -init -wf ] file ... dir ...
70 EOF
71     exit 1
72 }
73
74
75 action="check_test"
76 options=""
77 while true; do
78     case "x$1" in
79         x-init)
80             action="init_test"
81             shift
82             ;;
83         x-wf)
84             options="$options -wf"
85             shift
86             ;;
87         x-*)
88             usage
89             ;;
90         *)
91             break
92             ;;
93     esac
94 done
95
96
97 if [ $# -gt 0 ]; then
98     for_directory $action "$options" "$@"
99 else
100     for_directory $action -wf \
101         data_jclark_notwf/ext-sa data_jclark_notwf/not-sa data_jclark_notwf/sa \
102         data_notwf/sa
103     for_directory $action "" \
104         data_jclark_invalid data_invalid
105 fi
106
107 # ======================================================================
108 # $Log$
109 # Revision 1.1  2000/11/17 09:57:33  lpadovan
110 # Initial revision
111 #
112 # Revision 1.2  2000/05/01 16:23:39  gerd
113 #       Added data_invalid.
114 #
115 # Revision 1.1  2000/05/01 15:58:50  gerd
116 #       Initial revision.
117 #