2 # SPDX-License-Identifier: GPL-2.0+
4 # Compares .out and .out.new files for each name on standard input,
5 # one full pathname per line. Outputs comparison results followed by
10 T
=/tmp
/cmplitmushist.sh.$$
14 # comparetest oldpath newpath
21 grep -v 'maxresident)k\|minor)pagefaults\|^Time' $1 > $T/oldout
22 grep -v 'maxresident)k\|minor)pagefaults\|^Time' $2 > $T/newout
23 if cmp -s $T/oldout
$T/newout
&& grep -q '^Observation' $1
25 echo Exact output match
: $2
26 perfect
=`expr "$perfect" + 1`
30 grep '^Observation' $1 > $T/oldout
31 grep '^Observation' $2 > $T/newout
32 if test -s $T/oldout
-o -s $T/newout
34 if cmp -s $T/oldout
$T/newout
36 echo Matching Observation result and counts
: $2
37 obsline
=`expr "$obsline" + 1`
41 echo Missing Observation line
"(e.g., herd7 timeout)": $2
42 noobsline
=`expr "$noobsline" + 1`
46 grep '^Observation' $1 |
awk '{ print $3 }' > $T/oldout
47 grep '^Observation' $2 |
awk '{ print $3 }' > $T/newout
48 if cmp -s $T/oldout
$T/newout
50 echo Matching Observation Always
/Sometimes
/Never result
: $2
51 obsresult
=`expr "$obsresult" + 1`
54 echo ' !!!' Result changed
: $2
55 badcompare
=`expr "$badcompare" + 1`
59 sed -e 's/^.*$/comparetest &.out &.out.new/' > $T/cmpscript
60 .
$T/cmpscript
> $T/cmpscript.out
63 echo ' ---' Summary
: 1>&2
64 grep '!!!' $T/cmpscript.out
1>&2
65 if test "$perfect" -ne 0
67 echo Exact output matches
: $perfect 1>&2
69 if test "$obsline" -ne 0
71 echo Matching Observation result and counts
: $obsline 1>&2
73 if test "$noobsline" -ne 0
75 echo Missing Observation line
"(e.g., herd7 timeout)": $noobsline 1>&2
77 if test "$obsresult" -ne 0
79 echo Matching Observation Always
/Sometimes
/Never result
: $obsresult 1>&2
81 if test "$badcompare" -ne 0
83 echo "!!!" Result changed
: $badcompare 1>&2