forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-10-22 8ac6c7a54ed1b98d142dce24b11c6de6a1e239a5
kernel/tools/testing/selftests/rcutorture/bin/parse-console.sh
....@@ -1,4 +1,5 @@
11 #!/bin/bash
2
+# SPDX-License-Identifier: GPL-2.0+
23 #
34 # Check the console output from an rcutorture run for oopses.
45 # The "file" is a pathname on the local system, and "title" is
....@@ -6,23 +7,9 @@
67 #
78 # Usage: parse-console.sh file title
89 #
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.
13
-#
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.
18
-#
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.
22
-#
2310 # Copyright (C) IBM Corporation, 2011
2411 #
25
-# Authors: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
12
+# Authors: Paul E. McKenney <paulmck@linux.ibm.com>
2613
2714 T=${TMPDIR-/tmp}/parse-console.sh.$$
2815 file="$1"
....@@ -46,8 +33,8 @@
4633 fi
4734 cat /dev/null > $file.diags
4835
49
-# Check for proper termination, except that rcuperf runs don't indicate this.
50
-if test "$TORTURE_SUITE" != rcuperf
36
+# Check for proper termination, except for rcuscale and refscale.
37
+if test "$TORTURE_SUITE" != rcuscale && test "$TORTURE_SUITE" != refscale
5138 then
5239 # check for abject failure
5340
....@@ -57,17 +44,30 @@
5744 tail -1 |
5845 awk '
5946 {
60
- for (i=NF-8;i<=NF;i++)
47
+ normalexit = 1;
48
+ for (i=NF-8;i<=NF;i++) {
49
+ if (i <= 0 || i !~ /^[0-9]*$/) {
50
+ bangstring = $0;
51
+ gsub(/^\[[^]]*] /, "", bangstring);
52
+ print bangstring;
53
+ normalexit = 0;
54
+ exit 0;
55
+ }
6156 sum+=$i;
57
+ }
6258 }
63
- END { print sum }'`
64
- print_bug $title FAILURE, $nerrs instances
59
+ END {
60
+ if (normalexit)
61
+ print sum " instances"
62
+ }'`
63
+ print_bug $title FAILURE, $nerrs
6564 exit
6665 fi
6766
6867 grep --binary-files=text 'torture:.*ver:' $file |
6968 egrep --binary-files=text -v '\(null\)|rtc: 000000000* ' |
7069 sed -e 's/^(initramfs)[^]]*] //' -e 's/^\[[^]]*] //' |
70
+ sed -e 's/^.*ver: //' |
7171 awk '
7272 BEGIN {
7373 ver = 0;
....@@ -75,13 +75,13 @@
7575 }
7676
7777 {
78
- if (!badseq && ($5 + 0 != $5 || $5 <= ver)) {
78
+ if (!badseq && ($1 + 0 != $1 || $1 <= ver)) {
7979 badseqno1 = ver;
80
- badseqno2 = $5;
80
+ badseqno2 = $1;
8181 badseqnr = NR;
8282 badseq = 1;
8383 }
84
- ver = $5
84
+ ver = $1
8585 }
8686
8787 END {
....@@ -117,9 +117,7 @@
117117 fi
118118 fi | tee -a $file.diags
119119
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 |
121
-grep -v 'ODEBUG: ' |
122
-grep -v 'Warning: unable to open an initial console' > $T.diags
120
+console-badness.sh < $file > $T.diags
123121 if test -s $T.diags
124122 then
125123 print_warning "Assertion failure in $file $title"