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