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