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