tests: add `xmlesc` to escape XML in generated XML reports.
[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 paths=`echo /usr/lib/jvm/*/`
31 paths=($paths)
32 JAVA_HOME=${paths[0]}
33
34 paths=`echo $JAVA_HOME/jre/lib/*/{client,server}/`
35 paths=($paths)
36 JNI_LIB_PATH=${paths[0]}
37 shopt -u nullglob
38
39 outdir="out"
40 compdir=".nit_compile"
41
42 usage()
43 {
44 e=`basename "$0"`
45 cat<<END
46 Usage: $e [options] modulenames
47 -o option Pass option to the engine
48 -v Verbose (show tests steps)
49 -h This help
50 --engine Use a specific engine (default=nitg)
51 --noskip Do not skip a test even if the .skip file matches
52 --outdir Use a specific output folder (default=out/)
53 --compdir Use a specific temporary compilation folder (default=.nit_compile)
54 --node Run as a node in parallel, will not output context information
55 END
56 }
57
58 # Run a command with a timeout and a time count.
59 # Options:
60 # -o file write the user time into file (REQUIRED). see `-o` in `man time`
61 # -a append the time to the file (instead of overwriting it). see `-a` in `man time`
62 saferun()
63 {
64 local stop=false
65 local o=
66 local a=
67 while [ $stop = false ]; do
68 case "$1" in
69 -o) o="$2"; shift; shift;;
70 -a) a="-a"; shift;;
71 *) stop=true
72 esac
73 done
74 if 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 return 1
322 }
323
324 skip_exec()
325 {
326 test "$noskip" = true && return 1
327 if echo "$1" | grep -f "exec.skip" >/dev/null 2>&1; then
328 echo -n "_ "
329 return 0
330 fi
331 return 1
332 }
333
334 skip_cc()
335 {
336 test "$noskip" = true && return 1
337 if echo "$1" | grep -f "cc.skip" >/dev/null 2>&1; then
338 return 0
339 fi
340 return 1
341 }
342
343 find_nitc()
344 {
345 name="$enginebinname"
346 recent=`ls -t ../src/$name ../src/$name_[0-9] ../bin/$name ../c_src/$name 2>/dev/null | head -1`
347 if [[ "x$recent" == "x" ]]; then
348 echo "Could not find binary for engine $engine, aborting"
349 exit 1
350 fi
351 if [ "x$isnode" = "xfalse" ]; then
352 echo "Found binary for engine $engine: $recent $OPT"
353 fi
354 NITC=$recent
355 }
356
357 verbose=false
358 isnode=false
359 stop=false
360 engine=nitg
361 noskip=
362 savdirs=
363 while [ $stop = false ]; do
364 case $1 in
365 -o) OPT="$OPT $2"; shift; shift;;
366 -v) verbose=true; shift;;
367 -h) usage; exit;;
368 --engine) engine="$2"; shift; shift;;
369 --noskip) noskip=true; shift;;
370 --outdir) outdir="$2"; shift; shift;;
371 --compdir) compdir="$2"; shift; shift;;
372 --node) isnode=true; shift;;
373 *) stop=true
374 esac
375 done
376 enginebinname=$engine
377 isinterpret=
378 case $engine in
379 nitg)
380 engine=nitg-s;
381 enginebinname=nitg;
382 OPT="--separate $OPT --compile-dir $compdir"
383 ;;
384 nitg-s)
385 enginebinname=nitg;
386 OPT="--separate $OPT --compile-dir $compdir"
387 ;;
388 nitg-e)
389 enginebinname=nitg;
390 OPT="--erasure $OPT --compile-dir $compdir"
391 ;;
392 nitg-sg)
393 enginebinname=nitg;
394 OPT="--semi-global $OPT --compile-dir $compdir"
395 ;;
396 nitg-g)
397 enginebinname=nitg;
398 OPT="--global $OPT --compile-dir $compdir"
399 ;;
400 nit)
401 engine=niti
402 isinterpret=true
403 ;;
404 niti)
405 enginebinname=nit
406 isinterpret=true
407 ;;
408 nitvm)
409 isinterpret=true
410 savdirs="sav/niti/"
411 ;;
412 emscripten)
413 enginebinname=nitg
414 OPT="-m emscripten_nodejs.nit --semi-global $OPT --compile-dir $compdir"
415 savdirs="sav/nitg-sg/"
416 ;;
417 nitc)
418 echo "disabled engine $engine"
419 exit 0
420 ;;
421 *)
422 echo "unknown engine $engine"
423 exit 1
424 ;;
425 esac
426
427 savdirs="sav/$engine $savdirs sav/"
428
429 # The default nitc compiler
430 [ -z "$NITC" ] && find_nitc
431
432 # Set NIT_DIR if needed
433 [ -z "$NIT_DIR" ] && export NIT_DIR=..
434
435 # Mark to distinguish files among tests
436 # MARK=
437
438 if [ $# = 0 ]; then
439 usage;
440 exit
441 fi
442
443 # CLEAN the out directory
444 rm -rf "$outdir/" 2>/dev/null
445 mkdir "$outdir" 2>/dev/null
446
447 # File where error tests are outputed
448 # Old ERRLIST is backuped
449 ERRLIST=${ERRLIST:-errlist}
450 ERRLIST_TARGET=$ERRLIST
451
452 # Initiate new ERRLIST
453 if [ "x$ERRLIST" = "x" ]; then
454 ERRLIST=/dev/null
455 else
456 ERRLIST=$ERRLIST.tmp
457 > "$ERRLIST"
458 fi
459
460 ok=""
461 nok=""
462 todos=""
463
464 if [ "x$XMLDIR" = "x" ]; then
465 xml="tests-$engine.xml"
466 else
467 sum=`echo $@ | md5sum | cut -f1 -d " "`
468 xml="$XMLDIR/tests-$engine-$sum.xml"
469 mkdir -p "$XMLDIR"
470 fi
471
472 echo >$xml "<testsuites><testsuite>"
473
474 for ii in "$@"; do
475 if [ ! -f "$ii" ]; then
476 echo "File '$ii' does not exist."
477 continue
478 fi
479 f=`basename -- "$ii" .nit`
480
481 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|'`
482
483 # Sould we skip the file for this engine?
484 need_skip "$f" "$f" "$pack" && continue
485
486 tmp=${ii/../AA}
487 if [ "x$tmp" = "x$ii" ]; then
488 includes="-I . -I ../lib/standard -I ../lib/standard/collection -I alt"
489 else
490 includes="-I alt"
491 fi
492
493 for i in "$ii" `./alterner.pl --start '#' --altsep '_' -- "$ii"`; do
494 bf=`basename -- "$i" .nit`
495 ff="$outdir/$bf"
496
497 # Sould we skip the alternative for this engine?
498 need_skip "$bf" "$bf" "$pack" && continue
499
500 echo -n "=> $bf: "
501
502 if [ -f "$f.inputs" ]; then
503 inputs="$f.inputs"
504 export MNIT_READ_INPUT="$f.inputs"
505 else
506 inputs=/dev/null
507 export MNIT_READ_INPUT=/dev/null
508 fi
509
510 ffout="$ff.bin"
511 if [ "$engine" = "emscripten" ]; then
512 ffout="$ff.bin.js"
513 fi
514
515 if [ -n "$isinterpret" ]; then
516 cat > "$ff.bin" <<END
517 exec $NITC --no-color $OPT $includes -- $(printf '%q' "$i") "\$@"
518 END
519 chmod +x "$ff.bin"
520 > "$ff.cmp.err"
521 > "$ff.compile.log"
522 ERR=0
523 echo 0.0 > "$ff.time.out"
524 else
525 if skip_cc "$bf"; then
526 nocc="--no-cc"
527 else
528 nocc=
529 fi
530 # Compile
531 if [ "x$verbose" = "xtrue" ]; then
532 echo ""
533 echo $NITC --no-color $OPT -o "$ffout" "$includes" $nocc "$i"
534 fi
535 NIT_NO_STACK=1 JNI_LIB_PATH=$JNI_LIB_PATH JAVA_HOME=$JAVA_HOME \
536 saferun -o "$ff.time.out" $NITC --no-color $OPT -o "$ffout" $includes $nocc "$i" 2> "$ff.cmp.err" > "$ff.compile.log"
537 ERR=$?
538 if [ "x$verbose" = "xtrue" ]; then
539 cat -- "$ff.compile.log"
540 cat >&2 -- "$ff.cmp.err"
541 fi
542 fi
543 if [ "$engine" = "emscripten" ]; then
544 echo > "$ff.bin" "nodejs $ffout \"\$@\""
545 chmod +x "$ff.bin"
546 if grep "Fatal Error: more than one primitive class" "$ff.compile.log" > /dev/null; then
547 echo " [skip] do no not imports kernel"
548 echo >>$xml "<testcase classname='`xmlesc "$pack"`' name='`xmlesc "$bf"`' `timestamp`><skipped/></testcase>"
549 continue
550 fi
551 fi
552 if [ "$ERR" != 0 ]; then
553 echo -n "! "
554 cat -- "$ff.compile.log" "$ff.cmp.err" > "$ff.res"
555 process_result "$bf" "$bf" "$pack"
556 elif [ -n "$nocc" ]; then
557 # not compiled
558 echo -n "nocc "
559 > "$ff.res"
560 process_result "$bf" "$bf" "$pack"
561 elif [ -x "$ff.bin" ]; then
562 if skip_exec "$bf"; then
563 # No exec
564 > "$ff.res"
565 process_result "$bf" "$bf" "$pack"
566 break
567 fi
568 echo -n ". "
569 # Execute
570 args=""
571 if [ "x$verbose" = "xtrue" ]; then
572 echo ""
573 echo "NIT_NO_STACK=1 $ff.bin" $args
574 fi
575 NIT_NO_STACK=1 LD_LIBRARY_PATH=$JNI_LIB_PATH \
576 saferun -a -o "$ff.time.out" "$ff.bin" $args < "$inputs" > "$ff.res" 2>"$ff.err"
577 mv "$ff.time.out" "$ff.times.out"
578 awk '{ SUM += $1} END { print SUM }' "$ff.times.out" > "$ff.time.out"
579
580 if [ "x$verbose" = "xtrue" ]; then
581 cat -- "$ff.res"
582 cat >&2 -- "$ff.err"
583 fi
584 if [ -f "$ff.write" ]; then
585 cat -- "$ff.write" >> "$ff.res"
586 elif [ -d "$ff.write" ]; then
587 LANG=C /bin/ls -F "$ff.write" >> "$ff.res"
588 fi
589 cp -- "$ff.res" "$ff.res2"
590 cat -- "$ff.cmp.err" "$ff.err" "$ff.res2" > "$ff.res"
591 process_result "$bf" "$bf" "$pack"
592
593 if [ -f "$f.args" ]; then
594 fargs=$f.args
595 cptr=0
596 while read line; do
597 ((cptr=cptr+1))
598 args="$line"
599 bff=$bf"_args"$cptr
600 fff=$ff"_args"$cptr
601 name="$bf args $cptr"
602
603 # Sould we skip the input for this engine?
604 need_skip "$bff" " $name" "$pack" && continue
605
606 # use a specific inputs file, if required
607 if [ -f "$bff.inputs" ]; then
608 ffinputs="$bff.inputs"
609 else
610 ffinputs="$inputs"
611 fi
612
613 rm -rf "$fff.res" "$fff.err" "$fff.write" 2> /dev/null
614 if [ "x$verbose" = "xtrue" ]; then
615 echo ""
616 echo "NIT_NO_STACK=1 $ff.bin" $args
617 fi
618 echo -n "==> $name "
619 echo "$ff.bin $args" > "$fff.bin"
620 chmod +x "$fff.bin"
621 WRITE="$fff.write" saferun -o "$fff.time.out" sh -c "NIT_NO_STACK=1 $fff.bin < $ffinputs > $fff.res 2>$fff.err"
622 if [ "x$verbose" = "xtrue" ]; then
623 cat -- "$fff.res"
624 cat >&2 -- "$fff.err"
625 fi
626 if [ -f "$fff.write" ]; then
627 cat -- "$fff.write" >> "$fff.res"
628 elif [ -d "$fff.write" ]; then
629 LANG=C /bin/ls -F -- "$fff.write" >> "$fff.res"
630 fi
631 if [ -s "$fff.err" ]; then
632 cp -- "$fff.res" "$fff.res2"
633 cat -- "$fff.err" "$fff.res2" > "$fff.res"
634 fi
635 process_result "$bff" " $name" "$pack"
636 done < "$fargs"
637 fi
638 elif [ -f "$ff.bin" ]; then
639 #Not executable (platform?)"
640 > "$ff.res"
641 process_result "$bf" "$bf" "$pack"
642 else
643 echo -n "! "
644 cat -- "$ff.cmp.err" > "$ff.res"
645 echo "Compilation error" > "$ff.res"
646 process_result "$bf" "$bf" "$pack"
647 fi
648 done
649 done
650
651 if [ "x$isnode" = "xfalse" ]; then
652 echo "engine: $engine ($enginebinname $OPT)"
653 echo "ok: " `echo $ok | wc -w` "/" `echo $ok $nok $nos $todos | wc -w`
654
655 if [ -n "$nok" ]; then
656 echo "fail: $nok"
657 echo "There were $(echo $nok | wc -w) errors ! (see file $ERRLIST)"
658 fi
659 if [ -n "$nos" ]; then
660 echo "no sav: $nos"
661 fi
662 if [ -n "$todos" ]; then
663 echo "todo/fixme: $todos"
664 fi
665 if [ -n "$remains" ]; then
666 echo "sav that remains: $remains"
667 fi
668 fi
669
670 # write $ERRLIST
671 if [ "x$ERRLIST" != "x" ]; then
672 if [ -f "$ERRLIST_TARGET" ]; then
673 mv "$ERRLIST_TARGET" "${ERRLIST_TARGET}.bak"
674 fi
675 uniq $ERRLIST > $ERRLIST_TARGET
676 rm $ERRLIST
677 fi
678
679 echo >>$xml "</testsuite></testsuites>"
680
681 if [ -n "$nok" ]; then
682 exit 1
683 else
684 exit 0
685 fi