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