Debian Codegraph @

tests/general/Test-icon

raw ◀ ▶
1 Debian patch touch this file
1 #!/bin/sh
2 #
3 # Test-icon -- test the Icon translator and interpreter.
4 #
5 # usage: Test-icon [BLKSIZE [STRSIZE]] [file...]
6
7 IC=../../bin/icont
8 ICONX=../../bin/iconx
9
10 unset IPATH LPATH FPATH
11 unset BLKSIZE STRSIZE MSTKSIZE COEXPSIZE QLSIZE
12
13 # may be needed if Icon is built with BinaryHeader defined
14 export ICONX
15
16 # check for BKLSIZE / STRSIZE arguments
17 case X$1 in
18 X[0-9]*) export BLKSIZE=$1; echo BLKSIZE=$1; shift;;
19 esac
20 case X$1 in
21 X[0-9]*) export STRSIZE=$1; echo STRSIZE=$1; shift;;
22 esac
23
24 # echo system environment
25 echo ""
26 uname -a
27
28 # check that we have what we need
29 ls ../../bin/icont ../../bin/iconx >/dev/null || exit 0
30 echo "icont: `$IC -V 2>&1`"
31 echo "iconx: `$ICONX -V 2>&1`"
32
33 # report enabled features
34 $IC -s features.icn -x
35
36 # if no test files specified, run them all
37 if [ $# = 0 ]; then
38 set - *.std
39 fi
40
41 # loop through the chosen tests
42 echo ""
43 FAILED=
44 for F in $*; do
45 F=`basename $F .std`
46 F=`basename $F .icn`
47 rm -f $F.out
48 echo "Testing $F"
•49 if IPATH=../../lib $IC -s $F.icn; then
50 if test -x $F.exe; then
51 EXE=$F.exe
52 else
53 EXE=$F
54 fi
55 if test -r $F.dat; then
56 ./$EXE <$F.dat >$F.out 2>&1
57 else
58 ./$EXE </dev/null >$F.out 2>&1
59 fi
60 diff $F.std $F.out || FAILED="$FAILED $F"
61 else
62 FAILED="$FAILED $F"
63 fi
64 rm -f $EXE
65 done
66
67 echo ""
68 if [ "x$FAILED" = "x" ]; then
69 echo "All tests passed."
70 echo ""
71 exit 0
72 else
73 echo "Tests failed: $FAILED"
74 echo ""
75 exit 1
76 fi
77