~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/tools/memory-model/scripts/cmplitmushist.sh

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 #!/bin/sh
  2 # SPDX-License-Identifier: GPL-2.0+
  3 #
  4 # Compares .out and .out.new files for each name on standard input,
  5 # one full pathname per line.  Outputs comparison results followed by
  6 # a summary.
  7 #
  8 # sh cmplitmushist.sh
  9 
 10 T=/tmp/cmplitmushist.sh.$$
 11 trap 'rm -rf $T' 0
 12 mkdir $T
 13 
 14 # comparetest oldpath newpath
 15 badmacnam=0
 16 timedout=0
 17 perfect=0
 18 obsline=0
 19 noobsline=0
 20 obsresult=0
 21 badcompare=0
 22 comparetest () {
 23         if grep -q ': Unknown macro ' $1 || grep -q ': Unknown macro ' $2
 24         then
 25                 if grep -q ': Unknown macro ' $1
 26                 then
 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
 31                 fi
 32                 if grep -q ': Unknown macro ' $2
 33                 then
 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
 38                 fi
 39                 badmacnam=`expr "$badmacnam" + 1`
 40                 return 0
 41         elif grep -q '^Command exited with non-zero status 124' $1 ||
 42              grep -q '^Command exited with non-zero status 124' $2
 43         then
 44                 if grep -q '^Command exited with non-zero status 124' $1 &&
 45                    grep -q '^Command exited with non-zero status 124' $2
 46                 then
 47                         echo Both runs timed out: $2
 48                 elif grep -q '^Command exited with non-zero status 124' $1
 49                 then
 50                         echo Old run timed out: $2
 51                 elif grep -q '^Command exited with non-zero status 124' $2
 52                 then
 53                         echo New run timed out: $2
 54                 fi
 55                 timedout=`expr "$timedout" + 1`
 56                 return 0
 57         fi
 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
 61         then
 62                 echo Exact output match: $2
 63                 perfect=`expr "$perfect" + 1`
 64                 return 0
 65         fi
 66 
 67         grep '^Observation' $1 > $T/oldout
 68         grep '^Observation' $2 > $T/newout
 69         if test -s $T/oldout -o -s $T/newout
 70         then
 71                 if cmp -s $T/oldout $T/newout
 72                 then
 73                         echo Matching Observation result and counts: $2
 74                         obsline=`expr "$obsline" + 1`
 75                         return 0
 76                 fi
 77         else
 78                 echo Missing Observation line "(e.g., syntax error)": $2
 79                 noobsline=`expr "$noobsline" + 1`
 80                 return 0
 81         fi
 82 
 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
 86         then
 87                 echo Matching Observation Always/Sometimes/Never result: $2
 88                 obsresult=`expr "$obsresult" + 1`
 89                 return 0
 90         fi
 91         echo ' !!!' Result changed: $2
 92         badcompare=`expr "$badcompare" + 1`
 93         return 1
 94 }
 95 
 96 sed -e 's/^.*$/comparetest &.out &.out.new/' > $T/cmpscript
 97 . $T/cmpscript > $T/cmpscript.out
 98 cat $T/cmpscript.out
 99 
100 echo ' ---' Summary: 1>&2
101 grep '!!!' $T/cmpscript.out 1>&2
102 if test "$perfect" -ne 0
103 then
104         echo Exact output matches: $perfect 1>&2
105 fi
106 if test "$obsline" -ne 0
107 then
108         echo Matching Observation result and counts: $obsline 1>&2
109 fi
110 if test "$noobsline" -ne 0
111 then
112         echo Missing Observation line "(e.g., syntax error)": $noobsline 1>&2
113 fi
114 if test "$obsresult" -ne 0
115 then
116         echo Matching Observation Always/Sometimes/Never result: $obsresult 1>&2
117 fi
118 if test "$timedout" -ne 0
119 then
120         echo "!!!" Timed out: $timedout 1>&2
121 fi
122 if test "$badmacnam" -ne 0
123 then
124         echo "!!!" Unknown primitive: $badmacnam 1>&2
125 fi
126 if test "$badcompare" -ne 0
127 then
128         echo "!!!" Result changed: $badcompare 1>&2
129         exit 1
130 fi
131 
132 exit 0

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php