1 1.1 cgd #!/bin/sh - 2 1.1 cgd # This script runs the .ed scripts generated by mkscripts.sh 3 1.1 cgd # and compares their output against the .r files, which contain 4 1.1 cgd # the correct output 5 1.1 cgd 6 1.1 cgd PATH="/bin:/usr/bin:/usr/local/bin/:." 7 1.5 alm ED=$1 8 1.1 cgd [ X"$ED" = X ] && ED="../ed" 9 1.5 alm [ ! -x $ED ] && { echo "$ED: cannot execute"; exit 1; } 10 1.1 cgd 11 1.2 cgd # Run the *-err.ed scripts first, since these don't generate output; 12 1.2 cgd # rename then to *-err.ed~; they exit with non-zero status 13 1.2 cgd for i in *-err.ed; do 14 1.2 cgd echo $i~ 15 1.2 cgd if $i; then 16 1.2 cgd echo "*** The script $i~ exited abnormally ***" 17 1.2 cgd fi 18 1.2 cgd mv $i $i~ 19 1.2 cgd done >errs.o 2>&1 20 1.2 cgd 21 1.2 cgd # Run the remainding scripts; they exit with zero status 22 1.1 cgd for i in *.ed; do 23 1.4 alm base=`expr $i : '\([^.]*\)'` 24 1.4 alm # base=`echo $i | sed 's/\..*//'` 25 1.3 alm # base=`$ED - \!"echo \\\\$i" <<-EOF 26 1.3 alm # s/\..* 27 1.1 cgd # EOF` 28 1.2 cgd if $base.ed; then 29 1.1 cgd if cmp -s $base.o $base.r; then :; else 30 1.1 cgd echo "*** Output $base.o of script $i is incorrect ***" 31 1.1 cgd fi 32 1.1 cgd else 33 1.1 cgd echo "*** The script $i exited abnormally ***" 34 1.1 cgd fi 35 1.2 cgd done >scripts.o 2>&1 36 1.2 cgd 37 1.2 cgd grep -h '\*\*\*' errs.o scripts.o 38