116Salm#!/bin/sh -
216Salm# This script runs the .ed scripts generated by mkscripts.sh
316Salm# and compares their output against the .r files, which contain
416Salm# the correct output
518471Swosch#
650471Speter# $FreeBSD$
716Salm
816SalmPATH="/bin:/usr/bin:/usr/local/bin/:."
916SalmED=$1
1016Salm[ ! -x $ED ] && { echo "$ED: cannot execute"; exit 1; }
1116Salm
121057Salm# Run the *.red scripts first, since these don't generate output;
131057Salm# they exit with non-zero status
141057Salmfor i in *.red; do
151057Salm	echo $i
1616Salm	if $i; then
171057Salm		echo "*** The script $i exited abnormally  ***"
1816Salm	fi
1916Salmdone >errs.o 2>&1
2016Salm
2116Salm# Run the remainding scripts; they exit with zero status
2216Salmfor i in *.ed; do
231057Salm#	base=`expr $i : '\([^.]*\)'`
2416Salm#	base=`echo $i | sed 's/\..*//'`
251057Salm	base=`$ED - \!"echo $i" <<-EOF
261057Salm		s/\..*
271057Salm	EOF`
2816Salm	if $base.ed; then
2916Salm		if cmp -s $base.o $base.r; then :; else
3016Salm			echo "*** Output $base.o of script $i is incorrect ***"
3116Salm		fi
3216Salm	else
3316Salm		echo "*** The script $i exited abnormally ***"
3416Salm	fi
3516Salmdone >scripts.o 2>&1
3616Salm
3716Salmgrep -h '\*\*\*' errs.o scripts.o
38