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"
59 echo >>"$tap" "ok $tapcount - $name"
61 elif diff "sav/$r" "out/$r" >/dev/null
64 echo >>"$tap" "ok $tapcount - $name"
66 echo "[******failed******] diff -u {sav,out}/$r"
67 test $verbose = true && { diff -u "sav/$r" "out/$r" ; echo ; }
68 echo >>"$tap" "not ok $tapcount - $name"
74 for a in "$f" `./alterner.pl $f`
79 bn=`basename "$a" .sablecc`
81 $NITCC "$a" >"out/$bn.nitcc.log" 2>&1
86 t=`grep -o '[^ ]*_test_parser' < "out/$bn.nitcc.log"`
90 $NITC "${t}.nit" >/dev/null 2>&1
97 langname="${t/_test_parser}"
102 tapcount=$((tapcount + 1))
103 echo >>"$tap" "not ok $tapcount - $a # TODO no res"
108 grep -i "error" "out/$bn.nitcc.log" > "out/$res"
114 bf=`basename "$f" .sablecc`
115 for i in "$bf".input*
117 test -f $i || { echo " - no input: $i" ; continue ; }
120 rm "$langname.ast.out" 2>/dev/null
122 ./"$cla" "$i" > "out/$bn.$ni.log"
130 cp "$langname.ast.out" "out/$resi"
138 echo >>"$tap" "1..$tapcount"
139 #prove --formatter=TAP::Formatter::JUnit /bin/cat :: tap.output > tap.xml