2 # SPDX-License-Identifier: GPL-2.0+
4 # Check the console output from an rcutorture run for oopses.
5 # The "file" is a pathname on the local system, and "title" is
6 # a text string for error-message purposes.
8 # Usage: parse-console.sh file title
10 # Copyright (C) IBM Corporation, 2011
12 # Authors: Paul E. McKenney <paulmck@linux.ibm.com>
14 T=${TMPDIR-/tmp}/parse-console.sh.$$
18 trap 'rm -f $T.seq $T.diags' 0
22 # Check for presence and readability of console output file
23 if test -f "$file" -a -r "$file"
27 echo $title unreadable console output file: $file
30 if grep -Pq '\x00' < $file
32 print_warning Console output contains nul bytes, old qemu still running?
34 cat /dev/null > $file.diags
36 # Check for proper termination, except for rcuscale and refscale.
37 if test "$TORTURE_SUITE" != rcuscale && test "$TORTURE_SUITE" != refscale
39 # check for abject failure
41 if grep -q FAILURE $file || grep -q -e '-torture.*!!!' $file
43 nerrs=`grep --binary-files=text '!!!' $file |
48 for (i=NF-8;i<=NF;i++) {
49 if (i <= 0 || i !~ /^[0-9]*$/) {
51 gsub(/^\[[^]]*] /, "", bangstring);
61 print sum " instances"
63 print_bug $title FAILURE, $nerrs
67 grep --binary-files=text 'torture:.*ver:' $file |
68 egrep --binary-files=text -v '\(null\)|rtc: 000000000* ' |
69 sed -e 's/^(initramfs)[^]]*] //' -e 's/^\[[^]]*] //' |
70 sed -e 's/^.*ver: //' |
78 if (!badseq && ($1 + 0 != $1 || $1 <= 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 console-badness.sh < $file > $T.diags
123 print_warning "Assertion failure in $file $title"
126 n_badness=`grep -c Badness $file`
127 if test "$n_badness" -ne 0
129 summary="$summary Badness: $n_badness"
131 n_warn=`grep -v 'Warning: unable to open an initial console' $file | grep -v 'Warning: Failed to add ttynull console. No stdin, stdout, and stderr for the init process' | egrep -c 'WARNING:|Warn'`
132 if test "$n_warn" -ne 0
134 summary="$summary Warnings: $n_warn"
136 n_bugs=`egrep -c '\bBUG|Oops:' $file`
137 if test "$n_bugs" -ne 0
139 summary="$summary Bugs: $n_bugs"
141 n_calltrace=`grep -c 'Call Trace:' $file`
142 if test "$n_calltrace" -ne 0
144 summary="$summary Call Traces: $n_calltrace"
146 n_lockdep=`grep -c =========== $file`
147 if test "$n_badness" -ne 0
149 summary="$summary lockdep: $n_badness"
151 n_stalls=`egrep -c 'detected stalls on CPUs/tasks:|self-detected stall on CPU|Stall ended before state dump start|\?\?\? Writer stall state' $file`
152 if test "$n_stalls" -ne 0
154 summary="$summary Stalls: $n_stalls"
156 n_starves=`grep -c 'rcu_.*kthread starved for' $file`
157 if test "$n_starves" -ne 0
159 summary="$summary Starves: $n_starves"
161 print_warning Summary: $summary
162 cat $T.diags >> $file.diags
164 for i in $file.*.diags
168 cat $i >> $file.diags
171 if ! test -s $file.diags