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