3 # Check the console output from an rcutorture run for oopses.
4 # The "file" is a pathname on the local system, and "title" is
5 # a text string for error-message purposes.
7 # Usage: parse-console.sh file title
9 # This program is free software; you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation; either version 2 of the License, or
12 # (at your option) any later version.
14 # This program is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with this program; if not, you can access it online at
21 # http://www.gnu.org/licenses/gpl-2.0.html.
23 # Copyright (C) IBM Corporation, 2011
25 # Authors: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
27 T=${TMPDIR-/tmp}/parse-console.sh.$$
31 trap 'rm -f $T.seq $T.diags' 0
35 # Check for presence and readability of console output file
36 if test -f "$file" -a -r "$file"
40 echo $title unreadable console output file: $file
43 if grep -Pq '\x00' < $file
45 print_warning Console output contains nul bytes, old qemu still running?
47 cat /dev/null > $file.diags
49 # Check for proper termination, except that rcuperf runs don't indicate this.
50 if test "$TORTURE_SUITE" != rcuperf
52 # check for abject failure
54 if grep -q FAILURE $file || grep -q -e '-torture.*!!!' $file
56 nerrs=`grep --binary-files=text '!!!' $file |
60 for (i=NF-8;i<=NF;i++)
64 print_bug $title FAILURE, $nerrs instances
68 grep --binary-files=text 'torture:.*ver:' $file |
69 egrep --binary-files=text -v '\(null\)|rtc: 000000000* ' |
70 sed -e 's/^(initramfs)[^]]*] //' -e 's/^\[[^]]*] //' |
78 if (!badseq && ($5 + 0 != $5 || $5 <= ver)) {
89 if (badseqno1 == badseqno2 && badseqno2 == ver)
90 print "GP HANG at " ver " torture stat " badseqnr;
92 print "BAD SEQ " badseqno1 ":" badseqno2 " last:" ver " version " badseqnr;
96 if grep -q SUCCESS $file
100 print_warning $title `cat $T.seq`
105 if grep -q "_HOTPLUG:" $file
107 print_warning HOTPLUG FAILURES $title `cat $T.seq`
111 echo $title no success message, `grep --binary-files=text 'ver:' $file | wc -l` successful version messages
114 print_warning $title `cat $T.seq`
118 fi | tee -a $file.diags
120 egrep 'Badness|WARNING:|Warn|BUG|===========|Call Trace:|Oops:|detected stalls on CPUs/tasks:|self-detected stall on CPU|Stall ended before state dump start|\?\?\? Writer stall state|rcu_.*kthread starved for' < $file |
122 grep -v 'Warning: unable to open an initial console' > $T.diags
125 print_warning "Assertion failure in $file $title"
128 n_badness=`grep -c Badness $file`
129 if test "$n_badness" -ne 0
131 summary="$summary Badness: $n_badness"
133 n_warn=`grep -v 'Warning: unable to open an initial console' $file | egrep -c 'WARNING:|Warn'`
134 if test "$n_warn" -ne 0
136 summary="$summary Warnings: $n_warn"
138 n_bugs=`egrep -c 'BUG|Oops:' $file`
139 if test "$n_bugs" -ne 0
141 summary="$summary Bugs: $n_bugs"
143 n_calltrace=`grep -c 'Call Trace:' $file`
144 if test "$n_calltrace" -ne 0
146 summary="$summary Call Traces: $n_calltrace"
148 n_lockdep=`grep -c =========== $file`
149 if test "$n_badness" -ne 0
151 summary="$summary lockdep: $n_badness"
153 n_stalls=`egrep -c 'detected stalls on CPUs/tasks:|self-detected stall on CPU|Stall ended before state dump start|\?\?\? Writer stall state' $file`
154 if test "$n_stalls" -ne 0
156 summary="$summary Stalls: $n_stalls"
158 n_starves=`grep -c 'rcu_.*kthread starved for' $file`
159 if test "$n_starves" -ne 0
161 summary="$summary Starves: $n_starves"
163 print_warning Summary: $summary
164 cat $T.diags >> $file.diags
166 for i in $file.*.diags
170 cat $i >> $file.diags
173 if ! test -s $file.diags