torture: Make parse-rcutorture.sh less RCU-specific
[deliverable/linux.git] / tools / testing / selftests / rcutorture / bin / parse-torture.sh
1 #!/bin/sh
2 #
3 # Check the console output from a torture run for goodness.
4 # The "file" is a pathname on the local system, and "title" is
5 # a text string for error-message purposes.
6 #
7 # The file must contain torture output, but can be interspersed
8 # with other dmesg text, as in console-log output.
9 #
10 # Usage:
11 # sh parse-torture.sh file title
12 #
13 # This program is free software; you can redistribute it and/or modify
14 # it under the terms of the GNU General Public License as published by
15 # the Free Software Foundation; either version 2 of the License, or
16 # (at your option) any later version.
17 #
18 # This program is distributed in the hope that it will be useful,
19 # but WITHOUT ANY WARRANTY; without even the implied warranty of
20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 # GNU General Public License for more details.
22 #
23 # You should have received a copy of the GNU General Public License
24 # along with this program; if not, you can access it online at
25 # http://www.gnu.org/licenses/gpl-2.0.html.
26 #
27 # Copyright (C) IBM Corporation, 2011
28 #
29 # Authors: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
30
31 T=/tmp/parse-torture.sh.$$
32 file="$1"
33 title="$2"
34
35 trap 'rm -f $T.seq' 0
36
37 . functions.sh
38
39 # check for presence of torture output file.
40
41 if test -f "$file" -a -r "$file"
42 then
43 :
44 else
45 echo $title unreadable torture output file: $file
46 exit 1
47 fi
48
49 # check for abject failure
50
51 if grep -q FAILURE $file || grep -q -e '-torture.*!!!' $file
52 then
53 nerrs=`grep --binary-files=text '!!!' $file | tail -1 | awk '{for (i=NF-8;i<=NF;i++) sum+=$i; } END {print sum}'`
54 print_bug $title FAILURE, $nerrs instances
55 echo " " $url
56 exit
57 fi
58
59 grep --binary-files=text 'torture:.*ver:' $file | grep --binary-files=text -v '(null)' | sed -e 's/^(initramfs)[^]]*] //' -e 's/^\[[^]]*] //' |
60 awk '
61 BEGIN {
62 ver = 0;
63 badseq = 0;
64 }
65
66 {
67 if (!badseq && ($5 + 0 != $5 || $5 <= ver)) {
68 badseqno1 = ver;
69 badseqno2 = $5;
70 badseqnr = NR;
71 badseq = 1;
72 }
73 ver = $5
74 }
75
76 END {
77 if (badseq) {
78 if (badseqno1 == badseqno2 && badseqno2 == ver)
79 print "GP HANG at " ver " torture stat " badseqnr;
80 else
81 print "BAD SEQ " badseqno1 ":" badseqno2 " last:" ver " version " badseqnr;
82 }
83 }' > $T.seq
84
85 if grep -q SUCCESS $file
86 then
87 if test -s $T.seq
88 then
89 print_warning $title $title `cat $T.seq`
90 echo " " $file
91 exit 2
92 fi
93 else
94 if grep -q "_HOTPLUG:" $file
95 then
96 print_warning HOTPLUG FAILURES $title `cat $T.seq`
97 echo " " $file
98 exit 3
99 fi
100 echo $title no success message, `grep --binary-files=text 'ver:' $file | wc -l` successful version messages
101 if test -s $T.seq
102 then
103 print_warning $title `cat $T.seq`
104 fi
105 exit 2
106 fi
This page took 0.033663 seconds and 5 git commands to generate.