Debian Codegraph @

pit/regresscheck

raw
1 #!/bin/sh
2 #
3 # regresscheck - test driver for the INTERCAL regression-test suite
4 #
5 # This script expects to get output from an INTERCAL program to be checked
6 # on its standard input. Its job is to compare that output against
7 # a check file, which is presumably correct.
8 #
9 # If the program takes input, set up a pipeline with a cat at the beginning ,
10 # the INTERCAL executable in the middle, and this script at the end.
11 # The convention used by the INTERCAL test suite is that the input load for
12 # a program foo is named foo.tst and the check file foo.chk.
13 #
14 # In normal use this script takes one argument, which is the location of the
15 # check file with the trailing .chk extension omitted. The extension is
16 # omitted so that the basename can be used as the name of the program for
17 # purposes of reporting success or failure.
18 #
19 # This pattern doesn't handle well the case where one program has multiple
20 # tests, so options are provided to override the test file name
21
22 while getopts c:p: opt
23 do
24 case $opt in
25 c) checkfile=$OPTARG ;; # Override the location of the checkfile
26 p) progname=$OPTARG ;; # Override the name used in reporting
27 esac
28 done
29 shift $(($OPTIND - 1))
30 arg=$1
31
32 if [ -z "$progname" ]
33 then
34 progname=`basename ${arg}`
35 fi
36 if [ -z "$checkfile" ]
37 then
38 checkfile=${arg}.chk
39 fi
40
41 if diff - ${checkfile}
42 then
43 echo "Regression test of $progname succeeded.";
44 else
45 echo "Regression test of $progname FAILED.";
46 fi