summaryrefslogtreecommitdiff
path: root/bin/ed/test/ckscripts.sh
blob: 86a19b18d89f89199aea96691a89e135c80806df (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/sh -
#	$NetBSD: ckscripts.sh,v 1.9 1995/04/23 10:07:34 cgd Exp $
#
# This script runs the .ed scripts generated by mkscripts.sh
# and compares their output against the .r files, which contain
# the correct output

PATH="/bin:/usr/bin:/usr/local/bin/:."
ED=$1
[ ! -x $ED ] && { echo "$ED: cannot execute"; exit 1; }

# Run the *.red scripts first, since these don't generate output;
# they exit with non-zero status
for i in *.red; do
	echo $i
	if $i; then
		echo "*** The script $i exited abnormally  ***"
	fi
done >errs.o 2>&1

# Run the remainding scripts; they exit with zero status
for i in *.ed; do
#	base=`expr $i : '\([^.]*\)'`
#	base=`echo $i | sed 's/\..*//'`
	base=`$ED - \!"echo $i" <<-EOF
		s/\..*
	EOF`
	if $base.ed; then
		if cmp -s $base.o $base.r; then :; else
			echo "*** Output $base.o of script $i is incorrect ***"
		fi
	else
		echo "*** The script $i exited abnormally ***"
	fi
done >scripts.o 2>&1

grep -h '\*\*\*' errs.o scripts.o