Home | History | Annotate | Line # | Download | only in test
      1  1.1  cgd #!/bin/sh -
      2  1.9  cgd #	$NetBSD: ckscripts.sh,v 1.9 1995/04/23 10:07:34 cgd Exp $
      3  1.9  cgd #
      4  1.1  cgd # This script runs the .ed scripts generated by mkscripts.sh
      5  1.1  cgd # and compares their output against the .r files, which contain
      6  1.1  cgd # the correct output
      7  1.1  cgd 
      8  1.1  cgd PATH="/bin:/usr/bin:/usr/local/bin/:."
      9  1.5  alm ED=$1
     10  1.5  alm [ ! -x $ED ] && { echo "$ED: cannot execute"; exit 1; }
     11  1.1  cgd 
     12  1.7  alm # Run the *.red scripts first, since these don't generate output;
     13  1.7  alm # they exit with non-zero status
     14  1.7  alm for i in *.red; do
     15  1.7  alm 	echo $i
     16  1.2  cgd 	if $i; then
     17  1.7  alm 		echo "*** The script $i exited abnormally  ***"
     18  1.2  cgd 	fi
     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.7  alm #	base=`expr $i : '\([^.]*\)'`
     24  1.4  alm #	base=`echo $i | sed 's/\..*//'`
     25  1.7  alm 	base=`$ED - \!"echo $i" <<-EOF
     26  1.7  alm 		s/\..*
     27  1.7  alm 	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