.7i:
$(ICK) $<
+# For instructions on test conventions, see the header comment of regresscheck
test: $(TARGETS)
@./beer | ./regresscheck beer
@echo 'Hello, sailor!' | ./regresscheck icat
#!/bin/sh
+#
+# regresscheck - test driver for the INTERCAL regression-test suite
+#
+# This script expects to get output from an INTERCAL program to be checked
+# on its standard input. Its job is to compare that output against
+# a check file, which is presumably correct.
+#
+# If the program takes input, set up a pipeline with a cat at the beginning ,
+# the INTERCAL executable in the middle, and this script at the end.
+# The convention used by the INTERCAL test suite is that the input load for
+# a program foo is named foo.tst and the check file foo.chk.
+#
+# In normal use this script takes one argument, which is the location of the
+# check file with the trailing .chk extension omitted. The extension is
+# omitted so that the basename can be used as the name of the program for
+# purposes of reporting success or failure.
+#
+# This pattern doesn't handle well the case where one program has multiple
+# tests, so options are provided to override the test file name
-chkfile=$1
-prog=`basename $chkfile`
+chkfile=""
+while getopts cp opt
+do
+ case $opt in
+ c) chkfile=$OPTARG ;; # Override the location of the checkfile
+ p) prog=$OPTARG ;; # Override the name used in reporting
+ esac
+done
+shift $(($OPTIND - 1))
-if diff - ${chkfile}.chk
+if [ -z "$chkfile" ]
+then
+ chkfile=${1}.chk
+fi
+if [ -z "$prog" ]
+then
+ prog=`basename $chkfile`
+fi
+
+if diff - ${chkfile}
then
echo "Regression test of $prog succeeded.";
else