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.1 cgd [ X"$ED" = X ] && ED="../ed" 8 1.1 cgd 9 1.2 cgd # Run the *-err.ed scripts first, since these don't generate output; 10 1.2 cgd # rename then to *-err.ed~; they exit with non-zero status 11 1.2 cgd for i in *-err.ed; do 12 1.2 cgd echo $i~ 13 1.2 cgd if $i; then 14 1.2 cgd echo "*** The script $i~ exited abnormally ***" 15 1.2 cgd fi 16 1.2 cgd mv $i $i~ 17 1.2 cgd done >errs.o 2>&1 18 1.2 cgd 19 1.2 cgd # Run the remainding scripts; they exit with zero status 20 1.1 cgd for i in *.ed; do 21 1.2 cgd base=`echo $i | sed 's/\..*//'` 22 1.1 cgd # base=`$ED - <<-EOF 23 1.1 cgd # r !echo $i 24 1.1 cgd # s/\..* 25 1.1 cgd # EOF` 26 1.2 cgd if $base.ed; then 27 1.1 cgd if cmp -s $base.o $base.r; then :; else 28 1.1 cgd echo "*** Output $base.o of script $i is incorrect ***" 29 1.1 cgd fi 30 1.1 cgd else 31 1.1 cgd echo "*** The script $i exited abnormally ***" 32 1.1 cgd fi 33 1.2 cgd done >scripts.o 2>&1 34 1.2 cgd 35 1.2 cgd grep -h '\*\*\*' errs.o scripts.o 36