ckscripts.sh revision 1.4
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/:."
7[ X"$ED" = X ] && ED="../ed"
8
9# Run the *-err.ed scripts first, since these don't generate output;
10# rename then to *-err.ed~; they exit with non-zero status
11for i in *-err.ed; do
12	echo $i~
13	if $i; then
14		echo "*** The script $i~ exited abnormally  ***"
15	fi
16	mv $i $i~
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