3 # This file is part of Nit ( http://nitlanguage.org ).
5 # See the NOTICE file distributed with this work for copyright information.
7 # Licensed under the Apache License, Version 2.0 (the "License");
8 # you may not use this file except in compliance with the License.
9 # You may obtain a copy of the License at
11 # http://www.apache.org/licenses/LICENSE-2.0
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
19 # This program is used to perform regression tests of nitcc.
22 NITC=../../../bin/nitc
24 mkdir alt out 2>/dev/null
28 echo usage: `basename $0` [-v] grammar-files*
35 while [ $stop = false ]; do
37 -v) verbose=true; shift;;
48 tapcount=$((tapcount + 1))
50 if test \! -f "sav/$r"
54 echo "[***no sav***] cp 'out/$r' sav/"
55 test $verbose = true && { cat "out/$r" ; echo ; }
56 echo >>"$tap" "not ok $tapcount - $name # TODO no sav"
60 echo >>"$tap" "ok $tapcount - $name"
63 elif diff "sav/$r" "out/$r" >/dev/null
66 echo >>"$tap" "ok $tapcount - $name"
69 echo "[******failed******] diff -u {sav,out}/$r"
70 test $verbose = true && { diff -u "sav/$r" "out/$r" ; echo ; }
71 echo >>"$tap" "not ok $tapcount - $name"
79 for a in "$f" `./alterner.pl $f`
84 bn=`basename "$a" .sablecc`
86 $NITCC "$a" >"out/$bn.nitcc.log" 2>&1
91 t=`grep -o '[^ ]*_test_parser' < "out/$bn.nitcc.log"`
95 $NITC "${t}.nit" >/dev/null 2>&1
102 langname="${t/_test_parser}"
107 tapcount=$((tapcount + 1))
108 echo >>"$tap" "not ok $tapcount - $a # TODO no res"
113 grep -i "error" "out/$bn.nitcc.log" > "out/$res"
119 bf=`basename "$f" .sablecc`
120 for i in "$bf".input*
122 test -f $i || { echo " - no input: $i" ; continue ; }
125 rm "$langname.ast.out" 2>/dev/null
127 ./"$cla" "$i" > "out/$bn.$ni.log"
135 cp "$langname.ast.out" "out/$resi"
137 differ "$resi" || err=1
143 echo >>"$tap" "1..$tapcount"
144 #prove --formatter=TAP::Formatter::JUnit /bin/cat :: tap.output > tap.xml