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 |
# |
6 |
# $FreeBSD: stable/9/bin/ed/test/ckscripts.sh 50471 1999-08-27 23:15:48Z peter $ |
7 |
|
8 |
PATH="/bin:/usr/bin:/usr/local/bin/:." |
9 |
ED=$1 |
10 |
[ ! -x $ED ] && { echo "$ED: cannot execute"; exit 1; } |
11 |
|
12 |
# Run the *.red scripts first, since these don't generate output; |
13 |
# they exit with non-zero status |
14 |
for i in *.red; do |
15 |
echo $i |
16 |
if $i; then |
17 |
echo "*** The script $i exited abnormally ***" |
18 |
fi |
19 |
done >errs.o 2>&1 |
20 |
|
21 |
# Run the remainding scripts; they exit with zero status |
22 |
for i in *.ed; do |
23 |
# base=`expr $i : '\([^.]*\)'` |
24 |
# base=`echo $i | sed 's/\..*//'` |
25 |
base=`$ED - \!"echo $i" <<-EOF |
26 |
s/\..* |
27 |
EOF` |
28 |
if $base.ed; then |
29 |
if cmp -s $base.o $base.r; then :; else |
30 |
echo "*** Output $base.o of script $i is incorrect ***" |
31 |
fi |
32 |
else |
33 |
echo "*** The script $i exited abnormally ***" |
34 |
fi |
35 |
done >scripts.o 2>&1 |
36 |
|
37 |
grep -h '\*\*\*' errs.o scripts.o |