diff options
Diffstat (limited to 'tests/general/Test-icon')
-rwxr-xr-x | tests/general/Test-icon | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/tests/general/Test-icon b/tests/general/Test-icon new file mode 100755 index 0000000..07ccb87 --- /dev/null +++ b/tests/general/Test-icon @@ -0,0 +1,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 + |