aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/rcutorture/bin/parse-torture.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tools/testing/selftests/rcutorture/bin/parse-torture.sh')
-rwxr-xr-xtools/testing/selftests/rcutorture/bin/parse-torture.sh106
1 files changed, 106 insertions, 0 deletions
diff --git a/tools/testing/selftests/rcutorture/bin/parse-torture.sh b/tools/testing/selftests/rcutorture/bin/parse-torture.sh
new file mode 100755
index 000000000000..3455560ab4e4
--- /dev/null
+++ b/tools/testing/selftests/rcutorture/bin/parse-torture.sh
@@ -0,0 +1,106 @@
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
31T=/tmp/parse-torture.sh.$$
32file="$1"
33title="$2"
34
35trap 'rm -f $T.seq' 0
36
37. functions.sh
38
39# check for presence of torture output file.
40
41if test -f "$file" -a -r "$file"
42then
43 :
44else
45 echo $title unreadable torture output file: $file
46 exit 1
47fi
48
49# check for abject failure
50
51if grep -q FAILURE $file || grep -q -e '-torture.*!!!' $file
52then
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
57fi
58
59grep --binary-files=text 'torture:.*ver:' $file | grep --binary-files=text -v '(null)' | sed -e 's/^(initramfs)[^]]*] //' -e 's/^\[[^]]*] //' |
60awk '
61BEGIN {
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
76END {
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
85if grep -q SUCCESS $file
86then
87 if test -s $T.seq
88 then
89 print_warning $title $title `cat $T.seq`
90 echo " " $file
91 exit 2
92 fi
93else
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
106fi