summaryrefslogtreecommitdiff
path: root/tests/general/Test-icon
blob: 07ccb877932b940975a35dddcc7feba5b8c62689 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/bin/sh
#
#  Test-icont -- test the Icon translator and interpreter.
#
#  usage:  Test-icont [file...]
#
#  If $IC is set to iconc, the compiler will be used instead.

IC=${IC-icont}
IC=../../bin/$IC
ICONX=../../bin/iconx

unset IPATH LPATH FPATH
unset BLKSIZE STRSIZE MSTKSIZE COEXPSIZE QLSIZE

# may be needed with Icon is built with BinaryHeader defined
export ICONX

# echo system environment
echo ""
uname -a

# check that we have what we need
case $IC in
   *icont)
      ls ../../bin/icont ../../bin/iconx >/dev/null || exit 0
      echo "icont:  `$IC -V 2>&1`"
      echo "iconx:  `$ICONX -V 2>&1`"
      ;;
   *iconc)
      ls -l ../../bin/iconc ../../bin/rt.* || exit 0
      ;;
esac

#  if no test files specified, run them all
if [ $# = 0 ]; then
   set - *.std
fi

#  loop through the chosen tests
echo ""
FAILED=
for F in $*; do
   F=`basename $F .std`
   F=`basename $F .icn`
   rm -f $F.out
   echo "Testing $F"
   if $IC -s $F.icn; then
      if test -x $F.exe; then
         EXE=$F.exe
      else
         EXE=$F
      fi
      if test -r $F.dat; then
         ./$EXE <$F.dat >$F.out 2>&1
      else
         ./$EXE </dev/null >$F.out 2>&1
      fi
      diff $F.std $F.out || FAILED="$FAILED $F"
   else
      FAILED="$FAILED $F"
   fi
   rm -f $EXE
done

echo ""
if [ "x$FAILED" = "x" ]; then
   echo "All tests passed."
   echo ""
   exit 0
else
   echo "Tests failed: $FAILED"
   echo ""
   exit 1
fi