tests: tests.sh detects directories before trying to execute them
[nit.git] / tests / tests.sh
1 #!/bin/bash
2 # This file is part of NIT ( http://www.nitlanguage.org ).
3 #
4 # Copyright 2004-2008 Jean Privat <jean@pryen.org>
5 #
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
9 #
10 # http://www.apache.org/licenses/LICENSE-2.0
11 #
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.
17
18 # This shell script compile, run and verify Nit program files
19
20 # Set lang do default to avoid failed tests because of locale
21 export LANG=C
22 export LC_ALL=C
23 export NIT_TESTING=true
24 export MNIT_SRAND=0
25
26 unset NIT_DIR
27
28 # Get the first Java lib available
29 shopt -s nullglob
30 JAVA_HOME=$(dirname $(dirname $(readlink -f $(which javac))))
31
32 paths=`echo $JAVA_HOME/jre/lib/*/{client,server}/libjvm.so`
33 paths=($paths)
34 JNI_LIB_PATH=`dirname ${paths[0]}`
35 shopt -u nullglob
36
37 outdir="out"
38 compdir=".nit_compile"
39
40 usage()
41 {
42 e=`basename "$0"`
43 cat<<END
44 Usage: $e [options] modulenames
45 -o option Pass option to the engine
46 -v Verbose (show tests steps)
47 -h This help
48 --engine Use a specific engine (default=nitc)
49 --noskip Do not skip a test even if the .skip file matches
50 --outdir Use a specific output folder (default=out/)
51 --compdir Use a specific temporary compilation folder (default=.nit_compile)
52 --node Run as a node in parallel, will not output context information
53 END
54 }
55
56 # Run a command with a timeout and a time count.
57 # Options:
58 # -o file write the user time into file (REQUIRED). see `-o` in `man time`
59 # -a append the time to the file (instead of overwriting it). see `-a` in `man time`
60 saferun()
61 {
62 local stop=false
63 local o=
64 local a=
65 while [ $stop = false ]; do
66 case "$1" in
67 -o) o="$2"; shift; shift;;
68 -a) a="-a"; shift;;
69 *) stop=true
70 esac
71 done
72 if test -d "$1"; then
73 find $1 | sort
74 elif test -n "$TIME"; then
75 $TIME -o "$o" $a $TIMEOUT "$@"
76 else
77 if test -n "$a"; then echo 0 >> "$o"; else echo 0 > "$o"; fi
78 $TIMEOUT "$@"
79 fi
80 }
81
82 # Output a timestamp attribute for XML, or an empty line
83 timestamp()
84 {
85 if test -n "$TIMESTAMP"; then
86 echo "timestamp='`$TIMESTAMP`'"
87 else
88 echo ""
89 fi
90
91 }
92
93 # Get platform specific commands ##########################
94
95 # Detect a working timeout
96 if sh -c "timelimit echo" 1>/dev/null 2>&1; then
97 TIMEOUT="timelimit -t 600"
98 elif sh -c "timeout 1 echo" 1>/dev/null 2>&1; then
99 TIMEOUT="timeout 600s"
100 else
101 echo "No timelimit or timeout command detected. Tests may hang :("
102 fi
103
104 # Detect a working time command
105 if env time --quiet -f%U true 2>/dev/null; then
106 TIME="env time --quiet -f%U"
107 elif env time -f%U true 2>/dev/null; then
108 TIME="env time -f%U"
109 else
110 TIME=
111 fi
112
113 # Detect a working date command
114 if date -Iseconds >/dev/null 2>&1; then
115 TIMESTAMP="date -Iseconds"
116 else
117 TIMESTAMP=
118 fi
119
120 # $1 is the pattern of the test
121 # $2 is the file to compare to
122 # the result is:
123 # 0: if the file to compare to do not exists
124 # 1: if the file match
125 # 2: if the file match with soso
126 # 3: if the file do not match
127 function compare_to_result()
128 {
129 local pattern="$1"
130 local sav="$2"
131 if [ ! -r "$sav" ]; then return 0; fi
132 test "`cat -- "$sav"`" = "UNDEFINED" && return 1
133 diff -u -- "$sav" "$outdir/$pattern.res" > "$outdir/$pattern.diff.sav.log"
134 if [ "$?" == 0 ]; then
135 return 1
136 fi
137 sed '/[Ww]arning/d;/[Ee]rror/d' "$outdir/$pattern.res" > "$outdir/$pattern.res2"
138 sed '/[Ww]arning/d;/[Ee]rror/d' "$sav" > "$outdir/$pattern.sav2"
139 grep '[Ee]rror' "$outdir/$pattern.res" >/dev/null && echo "Error" >> "$outdir/$pattern.res2"
140 grep '[Ee]rror' "$sav" >/dev/null && echo "Error" >> "$outdir/$pattern.sav2"
141 diff -u "$outdir/$pattern.sav2" "$outdir/$pattern.res2" > "$outdir/$pattern.diff.sav.log2"
142 if [ "$?" == 0 ]; then
143 return 2
144 else
145 return 3
146 fi
147 }
148
149 function xmlesc()
150 {
151 sed 's/&/\&amp;/g; s/</\&lt;/g; s/>/\&gt;/g; s/"/\&quot;/g; s/'"'"'/\&#39;/g'<<EOF
152 $*
153 EOF
154 }
155
156 # As argument: the pattern used for the file
157 function process_result()
158 {
159 # Result
160 pattern=$1
161 description=$2
162 pack=$3
163 SAV=""
164 NSAV=""
165 FIXME=""
166 NFIXME=""
167 SOSO=""
168 NSOSO=""
169 SOSOF=""
170 NSOSOF=""
171 OLD=""
172 LIST=""
173 FIRST=""
174 echo >>$xml "<testcase classname='`xmlesc "$pack"`' name='`xmlesc "$description"`' time='`cat -- "$outdir/$pattern.time.out"`' `timestamp`>"
175 #for sav in "sav/$engine/fixme/$pattern.res" "sav/$engine/$pattern.res" "sav/fixme/$pattern.res" "sav/$pattern.res" "sav/$pattern.sav"; do
176 for savdir in $savdirs; do
177 sav=$savdir/fixme/$pattern.res
178 compare_to_result "$pattern" "$sav"
179 case "$?" in
180 0)
181 ;; # no file
182 1)
183 OLD="$LIST"
184 FIXME="$sav"
185 LIST="$LIST $sav"
186 ;;
187 2)
188 if [ -z "$FIRST" ]; then
189 SOSOF="$sav"
190 FIRST="$sav"
191 fi
192 LIST="$LIST $sav"
193 ;;
194 3)
195 if [ -z "$FIRST" ]; then
196 NFIXME="$sav"
197 FIRST="$sav"
198 fi
199 LIST="$LIST $sav"
200 ;;
201 esac
202
203 sav=$savdir/$pattern.res
204 compare_to_result "$pattern" "$sav"
205 case "$?" in
206 0)
207 ;; # no file
208 1)
209 OLD="$LIST"
210 SAV="$sav"
211 LIST="$LIST $sav"
212 ;;
213 2)
214 if [ -z "$FIRST" ]; then
215 SOSO="$sav"
216 FIRST="$sav"
217 fi
218 LIST="$LIST $sav"
219 ;;
220 3)
221 if [ -z "$FIRST" ]; then
222 NSAV="$sav"
223 FIRST="$sav"
224 fi
225 LIST="$LIST $sav"
226 ;;
227 esac
228 done
229 OLD=`echo "$OLD" | sed -e 's/ */ /g' -e 's/^ //' -e 's/ $//'`
230 grep 'NOT YET IMPLEMENTED' "$outdir/$pattern.res" >/dev/null
231 NYI="$?"
232 if [ -n "$SAV" ]; then
233 if [ -n "$OLD" ]; then
234 echo "[*ok*] $outdir/$pattern.res $SAV - but $OLD remains!"
235 echo >>$xml "<error message='`xmlesc "ok $outdir/$pattern.res - but $OLD remains"`'/>"
236 remains="$remains $OLD"
237 else
238 echo "[ok] $outdir/$pattern.res $SAV"
239 fi
240 ok="$ok $pattern"
241 elif [ -n "$FIXME" ]; then
242 if [ -n "$OLD" ]; then
243 echo "[*fixme*] $outdir/$pattern.res $FIXME - but $OLD remains!"
244 echo >>$xml "<error message='`xmlesc "ok $outdir/$pattern.res - but $OLD remains"`'/>"
245 remains="$remains $OLD"
246 else
247 echo "[fixme] $outdir/$pattern.res $FIXME"
248 echo >>$xml "<skipped/>"
249 fi
250 todos="$todos $pattern"
251 elif [ "x$NYI" = "x0" ]; then
252 echo "[todo] $outdir/$pattern.res -> not yet implemented"
253 echo >>$xml "<skipped/>"
254 todos="$todos $pattern"
255 elif [ -n "$SOSO" ]; then
256 echo "[======= soso $outdir/$pattern.res $SOSO =======]"
257 echo >>$xml "<error message='`xmlesc "soso $outdir/$pattern.res $SOSO"`'/>"
258 echo >>$xml "<system-out><![CDATA["
259 cat -v -- "$outdir/$pattern.diff.sav.log" | head >>$xml -n 50
260 echo >>$xml "]]></system-out>"
261 nok="$nok $pattern"
262 echo "$ii" >> "$ERRLIST"
263 elif [ -n "$SOSOF" ]; then
264 echo "[======= fixme soso $outdir/$pattern.res $SOSOF =======]"
265 echo >>$xml "<error message='`xmlesc "soso $outdir/$pattern.res $SOSO"`'/>"
266 echo >>$xml "<system-out><![CDATA["
267 cat -v -- "$outdir/$pattern.diff.sav.log" | head >>$xml -n 50
268 echo >>$xml "]]></system-out>"
269 nok="$nok $pattern"
270 echo "$ii" >> "$ERRLIST"
271 elif [ -n "$NSAV" ]; then
272 echo "[======= fail $outdir/$pattern.res $NSAV =======]"
273 echo >>$xml "<error message='`xmlesc "fail $outdir/$pattern.res $NSAV"`'/>"
274 echo >>$xml "<system-out><![CDATA["
275 cat -v -- "$outdir/$pattern.diff.sav.log" | head >>$xml -n 50
276 echo >>$xml "]]></system-out>"
277 nok="$nok $pattern"
278 echo "$ii" >> "$ERRLIST"
279 elif [ -n "$NFIXME" ]; then
280 echo "[======= changed $outdir/$pattern.res $NFIXME ======]"
281 echo >>$xml "<error message='`xmlesc "changed $outdir/$pattern.res $NFIXME"`'/>"
282 echo >>$xml "<system-out><![CDATA["
283 cat -v -- "$outdir/$pattern.diff.sav.log" | head >>$xml -n 50
284 echo >>$xml "]]></system-out>"
285 nok="$nok $pattern"
286 echo "$ii" >> "$ERRLIST"
287 elif [ -s "$outdir/$pattern.res" ]; then
288 echo "[=== no sav ===] $outdir/$pattern.res is not empty"
289 echo >>$xml "<error message='no sav and not empty'/>"
290 echo >>$xml "<system-out><![CDATA["
291 cat -v >>$xml -- "$outdir/$pattern.res"
292 echo >>$xml "]]></system-out>"
293 nos="$nos $pattern"
294 echo "$ii" >> "$ERRLIST"
295 else
296 # no sav but empty res
297 echo "[0k] $outdir/$pattern.res is empty"
298 ok="$ok $pattern"
299 fi
300 if test -s "$outdir/$pattern.cmp.err"; then
301 echo >>$xml "<system-err><![CDATA["
302 cat -v >>$xml -- "$outdir/$pattern.cmp.err"
303 echo >>$xml "]]></system-err>"
304 fi
305 echo >>$xml "</testcase>"
306 }
307
308 need_skip()
309 {
310 test "$noskip" = true && return 1
311 if echo "$1" | grep -f "$engine.skip" >/dev/null 2>&1; then
312 echo "=> $2: [skip]"
313 echo >>$xml "<testcase classname='`xmlesc "$3"`' name='`xmlesc "$2"`' `timestamp`><skipped/></testcase>"
314 return 0
315 fi
316 if test -n "$isinterpret" && echo "$1" | grep -f "exec.skip" >/dev/null 2>&1; then
317 echo "=> $2: [skip exec]"
318 echo >>$xml "<testcase classname='`xmlesc "$3"`' name='`xmlesc "$2"`' `timestamp`><skipped/></testcase>"
319 return 0
320 fi
321
322 # Skip by OS
323 os_skip_file=`uname`.skip
324 if test -e $os_skip_file && echo "$1" | grep -f "$os_skip_file" >/dev/null 2>&1; then
325 echo "=> $2: [skip os]"
326 echo >>$xml "<testcase classname='`xmlesc "$3"`' name='`xmlesc "$2"`' `timestamp`><skipped/></testcase>"
327 return 0
328 fi
329 return 1
330 }
331
332 skip_exec()
333 {
334 test "$noskip" = true && return 1
335 if echo "$1" | grep -f "exec.skip" >/dev/null 2>&1; then
336 echo -n "_ "
337 return 0
338 fi
339 return 1
340 }
341
342 skip_cc()
343 {
344 test "$noskip" = true && return 1
345 if echo "$1" | grep -f "cc.skip" >/dev/null 2>&1; then
346 return 0
347 fi
348 return 1
349 }
350
351 find_nitc()
352 {
353 name="$enginebinname"
354 recent=`ls -t ../src/$name ../src/$name_[0-9] ../bin/$name ../c_src/$name 2>/dev/null | head -1`
355 if [[ "x$recent" == "x" ]]; then
356 echo "Could not find binary for engine $engine, aborting"
357 exit 1
358 fi
359 if [ "x$isnode" = "xfalse" ]; then
360 echo "Found binary for engine $engine: $recent $OPT"
361 fi
362 NITC=$recent
363 }
364
365 verbose=false
366 isnode=false
367 stop=false
368 engine=nitc
369 noskip=
370 savdirs=
371 while [ $stop = false ]; do
372 case $1 in
373 -o) OPT="$OPT $2"; shift; shift;;
374 -v) verbose=true; shift;;
375 -h) usage; exit;;
376 --engine) engine="$2"; shift; shift;;
377 --noskip) noskip=true; shift;;
378 --outdir) outdir="$2"; shift; shift;;
379 --compdir) compdir="$2"; shift; shift;;
380 --node) isnode=true; shift;;
381 *) stop=true
382 esac
383 done
384 enginebinname=$engine
385 isinterpret=
386 case $engine in
387 nitc|nitg)
388 engine=nitg-s;
389 enginebinname=nitc;
390 OPT="--separate $OPT --compile-dir $compdir"
391 savdirs="sav/nitg-common/"
392 ;;
393 nitcs|nitg-s)
394 enginebinname=nitc;
395 OPT="--separate $OPT --compile-dir $compdir"
396 savdirs="sav/nitg-common/"
397 ;;
398 nitce|nitg-e)
399 enginebinname=nitc;
400 OPT="--erasure $OPT --compile-dir $compdir"
401 savdirs="sav/nitg-common/"
402 ;;
403 nitcsg|nitg-sg)
404 enginebinname=nitc;
405 OPT="--semi-global $OPT --compile-dir $compdir"
406 savdirs="sav/nitg-common/"
407 ;;
408 nitcg|nitg-g)
409 enginebinname=nitc;
410 OPT="--global $OPT --compile-dir $compdir"
411 savdirs="sav/nitg-common/"
412 ;;
413 nit)
414 engine=niti
415 isinterpret=true
416 ;;
417 niti)
418 enginebinname=nit
419 isinterpret=true
420 ;;
421 nitvm)
422 isinterpret=true
423 enginebinname=nit
424 OPT="--vm $OPT"
425 savdirs="sav/niti/"
426 ;;
427 emscripten)
428 enginebinname=nitc
429 OPT="-m emscripten_nodejs.nit --semi-global $OPT --compile-dir $compdir"
430 savdirs="sav/nitg-sg/"
431 ;;
432 nitc)
433 echo "disabled engine $engine"
434 exit 0
435 ;;
436 *)
437 echo "unknown engine $engine"
438 exit 1
439 ;;
440 esac
441
442 savdirs="sav/$engine $savdirs sav/"
443
444 # The default nitc compiler
445 [ -z "$NITC" ] && find_nitc
446
447 # Set NIT_DIR if needed
448 [ -z "$NIT_DIR" ] && export NIT_DIR=..
449
450 # Mark to distinguish files among tests
451 # MARK=
452
453 if [ $# = 0 ]; then
454 usage;
455 exit
456 fi
457
458 # CLEAN the out directory
459 rm -rf "$outdir/" 2>/dev/null
460 mkdir "$outdir" 2>/dev/null
461
462 # File where error tests are outputed
463 # Old ERRLIST is backuped
464 ERRLIST=${ERRLIST:-errlist}
465 ERRLIST_TARGET=$ERRLIST
466
467 # Initiate new ERRLIST
468 if [ "x$ERRLIST" = "x" ]; then
469 ERRLIST=/dev/null
470 else
471 ERRLIST=$ERRLIST.tmp
472 > "$ERRLIST"
473 fi
474
475 ok=""
476 nok=""
477 todos=""
478
479 if [ "x$XMLDIR" = "x" ]; then
480 xml="tests-$engine.xml"
481 else
482 sum=`echo $@ | md5sum | cut -f1 -d " "`
483 xml="$XMLDIR/tests-$engine-$sum.xml"
484 mkdir -p "$XMLDIR"
485 fi
486
487 echo >$xml "<testsuites><testsuite>"
488
489 for ii in "$@"; do
490 if [ ! -f "$ii" ]; then
491 echo "File '$ii' does not exist."
492 continue
493 fi
494 f=`basename -- "$ii" .nit`
495
496 pack="tests.${engine}".`echo $ii | perl -p -e 's|^../([^/]*)/([a-zA-Z_]*).*|\1.\2| || s|^([a-zA-Z]*)[^_]*_([a-zA-Z]*).*|\1.\2| || s|\W*([a-zA-Z_]*).*|\1|'`
497
498 # Sould we skip the file for this engine?
499 need_skip "$f" "$f" "$pack" && continue
500
501 tmp=${ii/../AA}
502 if [ "x$tmp" = "x$ii" ]; then
503 includes="-I . -I ../lib/standard -I ../lib/standard/collection -I alt"
504 else
505 includes="-I alt"
506 fi
507
508 for i in "$ii" `./alterner.pl --start '#' --altsep '_' -- "$ii"`; do
509 bf=`basename -- "$i" .nit`
510 ff="$outdir/$bf"
511
512 # Sould we skip the alternative for this engine?
513 need_skip "$bf" "$bf" "$pack" && continue
514
515 echo -n "=> $bf: "
516
517 if [ -f "$f.inputs" ]; then
518 inputs="$f.inputs"
519 export MNIT_READ_INPUT="$f.inputs"
520 else
521 inputs=/dev/null
522 export MNIT_READ_INPUT=/dev/null
523 fi
524
525 ffout="$ff.bin"
526 if [ "$engine" = "emscripten" ]; then
527 ffout="$ff.bin.js"
528 fi
529
530 if [ -n "$isinterpret" ]; then
531 cat > "$ff.bin" <<END
532 exec $NITC --no-color $OPT $includes -- $(printf '%q' "$i") "\$@"
533 END
534 chmod +x "$ff.bin"
535 > "$ff.cmp.err"
536 > "$ff.compile.log"
537 ERR=0
538 echo 0.0 > "$ff.time.out"
539 else
540 if skip_cc "$bf"; then
541 nocc="--no-cc"
542 else
543 nocc=
544 fi
545 # Compile
546 if [ "x$verbose" = "xtrue" ]; then
547 echo ""
548 echo $NITC --no-color $OPT -o "$ffout" "$includes" $nocc "$i"
549 fi
550 NIT_NO_STACK=1 JNI_LIB_PATH=$JNI_LIB_PATH JAVA_HOME=$JAVA_HOME \
551 saferun -o "$ff.time.out" $NITC --no-color $OPT -o "$ffout" $includes $nocc "$i" 2> "$ff.cmp.err" > "$ff.compile.log"
552 ERR=$?
553 if [ "x$verbose" = "xtrue" ]; then
554 cat -- "$ff.compile.log"
555 cat >&2 -- "$ff.cmp.err"
556 fi
557 fi
558 if [ "$engine" = "emscripten" ]; then
559 echo > "$ff.bin" "nodejs $ffout \"\$@\""
560 chmod +x "$ff.bin"
561 if grep "Fatal Error: more than one primitive class" "$ff.compile.log" > /dev/null; then
562 echo " [skip] do no not imports kernel"
563 echo >>$xml "<testcase classname='`xmlesc "$pack"`' name='`xmlesc "$bf"`' `timestamp`><skipped/></testcase>"
564 continue
565 fi
566 fi
567 if [ "$ERR" != 0 ]; then
568 echo -n "! "
569 cat -- "$ff.compile.log" "$ff.cmp.err" > "$ff.res"
570 process_result "$bf" "$bf" "$pack"
571 elif [ -n "$nocc" ]; then
572 # not compiled
573 echo -n "nocc "
574 > "$ff.res"
575 process_result "$bf" "$bf" "$pack"
576 elif [ -x "$ff.bin" ]; then
577 if skip_exec "$bf"; then
578 # No exec
579 > "$ff.res"
580 process_result "$bf" "$bf" "$pack"
581 break
582 fi
583 echo -n ". "
584 # Execute
585 args=""
586 if [ "x$verbose" = "xtrue" ]; then
587 echo ""
588 echo "NIT_NO_STACK=1 $ff.bin" $args
589 fi
590 NIT_NO_STACK=1 LD_LIBRARY_PATH=$JNI_LIB_PATH \
591 saferun -a -o "$ff.time.out" "$ff.bin" $args < "$inputs" > "$ff.res" 2>"$ff.err"
592 mv "$ff.time.out" "$ff.times.out"
593 awk '{ SUM += $1} END { print SUM }' "$ff.times.out" > "$ff.time.out"
594
595 if [ "x$verbose" = "xtrue" ]; then
596 cat -- "$ff.res"
597 cat >&2 -- "$ff.err"
598 fi
599 if [ -f "$ff.write" ]; then
600 cat -- "$ff.write" >> "$ff.res"
601 elif [ -d "$ff.write" ]; then
602 LANG=C /bin/ls -F "$ff.write" >> "$ff.res"
603 fi
604 cp -- "$ff.res" "$ff.res2"
605 cat -- "$ff.cmp.err" "$ff.err" "$ff.res2" > "$ff.res"
606 process_result "$bf" "$bf" "$pack"
607
608 if [ -f "$f.args" ]; then
609 fargs=$f.args
610 cptr=0
611 while read line; do
612 ((cptr=cptr+1))
613 args="$line"
614 bff=$bf"_args"$cptr
615 fff=$ff"_args"$cptr
616 name="$bf args $cptr"
617
618 # Sould we skip the input for this engine?
619 need_skip "$bff" " $name" "$pack" && continue
620
621 # use a specific inputs file, if required
622 if [ -f "$bff.inputs" ]; then
623 ffinputs="$bff.inputs"
624 else
625 ffinputs="$inputs"
626 fi
627
628 rm -rf "$fff.res" "$fff.err" "$fff.write" 2> /dev/null
629 if [ "x$verbose" = "xtrue" ]; then
630 echo ""
631 echo "NIT_NO_STACK=1 $ff.bin" $args
632 fi
633 echo -n "==> $name "
634 echo "$ff.bin $args" > "$fff.bin"
635 chmod +x "$fff.bin"
636 WRITE="$fff.write" saferun -o "$fff.time.out" sh -c "NIT_NO_STACK=1 $fff.bin < $ffinputs > $fff.res 2>$fff.err"
637 if [ "x$verbose" = "xtrue" ]; then
638 cat -- "$fff.res"
639 cat >&2 -- "$fff.err"
640 fi
641 if [ -f "$fff.write" ]; then
642 cat -- "$fff.write" >> "$fff.res"
643 elif [ -d "$fff.write" ]; then
644 LANG=C /bin/ls -F -- "$fff.write" >> "$fff.res"
645 fi
646 if [ -s "$fff.err" ]; then
647 cp -- "$fff.res" "$fff.res2"
648 cat -- "$fff.err" "$fff.res2" > "$fff.res"
649 fi
650 process_result "$bff" " $name" "$pack"
651 done < "$fargs"
652 fi
653 elif [ -f "$ff.bin" ]; then
654 #Not executable (platform?)"
655 > "$ff.res"
656 process_result "$bf" "$bf" "$pack"
657 else
658 echo -n "! "
659 cat -- "$ff.cmp.err" > "$ff.res"
660 echo "Compilation error" > "$ff.res"
661 process_result "$bf" "$bf" "$pack"
662 fi
663 done
664 done
665
666 if [ "x$isnode" = "xfalse" ]; then
667 echo "engine: $engine ($enginebinname $OPT)"
668 echo "ok: " `echo $ok | wc -w` "/" `echo $ok $nok $nos $todos | wc -w`
669
670 if [ -n "$nok" ]; then
671 echo "fail: $nok"
672 echo "There were $(echo $nok | wc -w) errors ! (see file $ERRLIST)"
673 fi
674 if [ -n "$nos" ]; then
675 echo "no sav: $nos"
676 fi
677 if [ -n "$todos" ]; then
678 echo "todo/fixme: $todos"
679 fi
680 if [ -n "$remains" ]; then
681 echo "sav that remains: $remains"
682 fi
683 fi
684
685 # write $ERRLIST
686 if [ "x$ERRLIST" != "x" ]; then
687 if [ -f "$ERRLIST_TARGET" ]; then
688 mv "$ERRLIST_TARGET" "${ERRLIST_TARGET}.bak"
689 fi
690 uniq $ERRLIST > $ERRLIST_TARGET
691 rm $ERRLIST
692 fi
693
694 echo >>$xml "</testsuite></testsuites>"
695
696 if [ -n "$nok" ]; then
697 exit 1
698 else
699 exit 0
700 fi