diff options
Diffstat (limited to 'bin/ed/test/ckscripts.sh')
-rw-r--r-- | bin/ed/test/ckscripts.sh | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/bin/ed/test/ckscripts.sh b/bin/ed/test/ckscripts.sh new file mode 100644 index 000000000000..87a7e9beb560 --- /dev/null +++ b/bin/ed/test/ckscripts.sh @@ -0,0 +1,37 @@ +#!/bin/sh - +# 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" = X -o ! -x $ED ] && ED="../ed" +[ ! -x $ED ] && { echo "$ED: cannot execute"; exit 1; } + +# Run the *-err.ed scripts first, since these don't generate output; +# rename then to *-err.ed~; they exit with non-zero status +for i in *-err.ed; do + echo $i~ + if $i; then + echo "*** The script $i~ exited abnormally ***" + fi + mv $i $i~ +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 |