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