Blame view

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