ckscripts.sh revision 1057
1#!/bin/sh -
2# This script runs the .ed scripts generated by mkscripts.sh
3# and compares their output against the .r files, which contain
4# the correct output
5
6PATH="/bin:/usr/bin:/usr/local/bin/:."
7ED=$1
8[ ! -x $ED ] && { echo "$ED: cannot execute"; exit 1; }
9
10# Run the *.red scripts first, since these don't generate output;
11# they exit with non-zero status
12for i in *.red; do
13	echo $i
14	if $i; then
15		echo "*** The script $i exited abnormally  ***"
16	fi
17done >errs.o 2>&1
18
19# Run the remainding scripts; they exit with zero status
20for i in *.ed; do
21#	base=`expr $i : '\([^.]*\)'`
22#	base=`echo $i | sed 's/\..*//'`
23	base=`$ED - \!"echo $i" <<-EOF
24		s/\..*
25	EOF`
26	if $base.ed; then
27		if cmp -s $base.o $base.r; then :; else
28			echo "*** Output $base.o of script $i is incorrect ***"
29		fi
30	else
31		echo "*** The script $i exited abnormally ***"
32	fi
33done >scripts.o 2>&1
34
35grep -h '\*\*\*' errs.o scripts.o
36