NetBSD/bin/ed/test/ckscripts.sh

36 lines
884 B
Bash
Raw Normal View History

#!/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/:."
[ X"$ED" = X ] && ED="../ed"
1993-04-10 15:46:38 +04:00
# 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
1993-04-10 15:46:38 +04:00
base=`echo $i | sed 's/\..*//'`
# base=`$ED - <<-EOF
# r !echo $i
# s/\..*
# EOF`
1993-04-10 15:46:38 +04:00
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
1993-04-10 15:46:38 +04:00
done >scripts.o 2>&1
grep -h '\*\*\*' errs.o scripts.o