2 # This file is part of NIT ( http://www.nitlanguage.org ).
4 # Copyright 2009 Jean-Sebastien Gelinas <calestar@gmail.com>
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
10 # http://www.apache.org/licenses/LICENSE-2.0
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
28 recent
=`ls -t ../src/nitc ../src/nitc_[0-9] ../bin/nitc ../c_src/nitc 2>/dev/null | head -1`
29 if [[ "x$recent" == "x" ]]; then
30 echo 'Could not find nitc, aborting'
33 echo 'Using nitc from: '$recent
37 # The default nitc compiler
38 [ -z
"$NITC" ] && find_nitc
50 echo "File '$ii' does not exist."
55 if [ "x$tmp" = "x$ii" ]; then
56 oincludes
="-I . -I ../lib/standard -I ../lib/standard/collection"
61 for alt
in "" `sed -n 's/.*#!*\(alt[0-9]*\)#.*/\1/p' "$ii" | sort -u`; do
62 f
=`basename "$ii" .nit`
68 if [ "x$alt" != "x" ]; then
69 test -d alt || mkdir
-p alt
72 sed "s/#$alt#//g;/#!$alt#/d" "$ii" > "$i"
73 includes
="$includes -I alt"
79 # Clean-up before compile and tests
80 rm -rf .nit_compile
2> /dev
/null
83 # The point of ICode testing is to validate analysis/optimizations
84 # Force '--global' option !
85 $NITC $OPT --global
--output
-format icode
"$i" $includes 2> "$ff.cmp.err" > "$ff.compile.log"
87 if [ "$ERR" != 0 ]; then
88 echo "! [======= fail: Compilation error =======]"
91 TEST_FILE
=$d/$ff.tests
92 if [ ! -f
$TEST_FILE ]; then
93 echo ". [======= fail: Cannot open test file =======]"
101 while IFS
=, read CLASS METHOD TYPE ATTR
103 ICODE_FILE
=$d/.nit_compile
/$CLASS.icode
105 echo -n
'==> Test #'$cptr' ...... '
107 if [ -f
$ICODE_FILE ]; then
108 if [ "x$METHOD" = "xno-file" ]; then
132 if [ $awkstatus -ne
0 ] ; then
134 if [ "x$TYPE" = "xno" ]; then
135 # Should not have beed found
138 elif [ "x$TYPE" = "xhas" ]; then
139 # Should have been found
143 echo "Test file format error !!!"
148 if [ "x$TYPE" = "xno" ]; then
149 # Should not have beed found
152 elif [ "x$TYPE" = "xhas" ]; then
153 # Should have been found
157 echo "Test file format error !!!"
162 # The class file was not found
163 if [ "x$METHOD" = "xno-file" ]; then
168 # Should have been found
178 echo "ok: " `echo $ok | wc -w` "/" `echo $ok $nok $nos | wc -w`
180 if [ -n
"$nok" ]; then
182 echo "There were $(echo $nok | wc -w) errors !"
184 if [ -n
"$nos" ]; then
188 if [ -n
"$nok" ]; then