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
23 if grep -q ': Unknown macro ' $1 ||
grep -q ': Unknown macro ' $2
25 if grep -q ': Unknown macro ' $1
27 badname
=`grep ': Unknown macro ' $1 |
28 sed -e 's/^.*: Unknown macro //' |
29 sed -e 's/ (User error).*$//'`
30 echo 'Current LKMM version does not know "'$badname'"' $1
32 if grep -q ': Unknown macro ' $2
34 badname
=`grep ': Unknown macro ' $2 |
35 sed -e 's/^.*: Unknown macro //' |
36 sed -e 's/ (User error).*$//'`
37 echo 'Current LKMM version does not know "'$badname'"' $2
39 badmacnam
=`expr "$badmacnam" + 1`
41 elif grep -q '^Command exited with non-zero status 124' $1 ||
42 grep -q '^Command exited with non-zero status 124' $2
44 if grep -q '^Command exited with non-zero status 124' $1 &&
45 grep -q '^Command exited with non-zero status 124' $2
47 echo Both runs timed out
: $2
48 elif grep -q '^Command exited with non-zero status 124' $1
50 echo Old run timed out
: $2
51 elif grep -q '^Command exited with non-zero status 124' $2
53 echo New run timed out
: $2
55 timedout
=`expr "$timedout" + 1`
58 grep -v 'maxresident)k\|minor)pagefaults\|^Time' $1 > $T/oldout
59 grep -v 'maxresident)k\|minor)pagefaults\|^Time' $2 > $T/newout
60 if cmp -s $T/oldout
$T/newout
&& grep -q '^Observation' $1
62 echo Exact output match
: $2
63 perfect
=`expr "$perfect" + 1`
67 grep '^Observation' $1 > $T/oldout
68 grep '^Observation' $2 > $T/newout
69 if test -s $T/oldout
-o -s $T/newout
71 if cmp -s $T/oldout
$T/newout
73 echo Matching Observation result and counts
: $2
74 obsline
=`expr "$obsline" + 1`
78 echo Missing Observation line
"(e.g., syntax error)": $2
79 noobsline
=`expr "$noobsline" + 1`
83 grep '^Observation' $1 |
awk '{ print $3 }' > $T/oldout
84 grep '^Observation' $2 |
awk '{ print $3 }' > $T/newout
85 if cmp -s $T/oldout
$T/newout
87 echo Matching Observation Always
/Sometimes
/Never result
: $2
88 obsresult
=`expr "$obsresult" + 1`
91 echo ' !!!' Result changed
: $2
92 badcompare
=`expr "$badcompare" + 1`
96 sed -e 's/^.*$/comparetest &.out &.out.new/' > $T/cmpscript
97 .
$T/cmpscript
> $T/cmpscript.out
100 echo ' ---' Summary
: 1>&2
101 grep '!!!' $T/cmpscript.out
1>&2
102 if test "$perfect" -ne 0
104 echo Exact output matches
: $perfect 1>&2
106 if test "$obsline" -ne 0
108 echo Matching Observation result and counts
: $obsline 1>&2
110 if test "$noobsline" -ne 0
112 echo Missing Observation line
"(e.g., syntax error)": $noobsline 1>&2
114 if test "$obsresult" -ne 0
116 echo Matching Observation Always
/Sometimes
/Never result
: $obsresult 1>&2
118 if test "$timedout" -ne 0
120 echo "!!!" Timed out
: $timedout 1>&2
122 if test "$badmacnam" -ne 0
124 echo "!!!" Unknown primitive
: $badmacnam 1>&2
126 if test "$badcompare" -ne 0
128 echo "!!!" Result changed
: $badcompare 1>&2