parse-console.sh 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. #!/bin/bash
  2. #
  3. # Check the console output from an rcutorture run for oopses.
  4. # The "file" is a pathname on the local system, and "title" is
  5. # a text string for error-message purposes.
  6. #
  7. # Usage: parse-console.sh file title
  8. #
  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. #
  23. # Copyright (C) IBM Corporation, 2011
  24. #
  25. # Authors: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
  26. T=${TMPDIR-/tmp}/parse-console.sh.$$
  27. file="$1"
  28. title="$2"
  29. trap 'rm -f $T.seq $T.diags' 0
  30. . functions.sh
  31. # Check for presence and readability of console output file
  32. if test -f "$file" -a -r "$file"
  33. then
  34. :
  35. else
  36. echo $title unreadable console output file: $file
  37. exit 1
  38. fi
  39. if grep -Pq '\x00' < $file
  40. then
  41. print_warning Console output contains nul bytes, old qemu still running?
  42. fi
  43. cat /dev/null > $file.diags
  44. # Check for proper termination, except that rcuperf runs don't indicate this.
  45. if test "$TORTURE_SUITE" != rcuperf
  46. then
  47. # check for abject failure
  48. if grep -q FAILURE $file || grep -q -e '-torture.*!!!' $file
  49. then
  50. nerrs=`grep --binary-files=text '!!!' $file |
  51. tail -1 |
  52. awk '
  53. {
  54. for (i=NF-8;i<=NF;i++)
  55. sum+=$i;
  56. }
  57. END { print sum }'`
  58. print_bug $title FAILURE, $nerrs instances
  59. exit
  60. fi
  61. grep --binary-files=text 'torture:.*ver:' $file |
  62. egrep --binary-files=text -v '\(null\)|rtc: 000000000* ' |
  63. sed -e 's/^(initramfs)[^]]*] //' -e 's/^\[[^]]*] //' |
  64. awk '
  65. BEGIN {
  66. ver = 0;
  67. badseq = 0;
  68. }
  69. {
  70. if (!badseq && ($5 + 0 != $5 || $5 <= ver)) {
  71. badseqno1 = ver;
  72. badseqno2 = $5;
  73. badseqnr = NR;
  74. badseq = 1;
  75. }
  76. ver = $5
  77. }
  78. END {
  79. if (badseq) {
  80. if (badseqno1 == badseqno2 && badseqno2 == ver)
  81. print "GP HANG at " ver " torture stat " badseqnr;
  82. else
  83. print "BAD SEQ " badseqno1 ":" badseqno2 " last:" ver " version " badseqnr;
  84. }
  85. }' > $T.seq
  86. if grep -q SUCCESS $file
  87. then
  88. if test -s $T.seq
  89. then
  90. print_warning $title `cat $T.seq`
  91. echo " " $file
  92. exit 2
  93. fi
  94. else
  95. if grep -q "_HOTPLUG:" $file
  96. then
  97. print_warning HOTPLUG FAILURES $title `cat $T.seq`
  98. echo " " $file
  99. exit 3
  100. fi
  101. echo $title no success message, `grep --binary-files=text 'ver:' $file | wc -l` successful version messages
  102. if test -s $T.seq
  103. then
  104. print_warning $title `cat $T.seq`
  105. fi
  106. exit 2
  107. fi
  108. fi | tee -a $file.diags
  109. 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 |
  110. grep -v 'ODEBUG: ' |
  111. grep -v 'Warning: unable to open an initial console' > $T.diags
  112. if test -s $T.diags
  113. then
  114. print_warning "Assertion failure in $file $title"
  115. # cat $T.diags
  116. summary=""
  117. n_badness=`grep -c Badness $file`
  118. if test "$n_badness" -ne 0
  119. then
  120. summary="$summary Badness: $n_badness"
  121. fi
  122. n_warn=`grep -v 'Warning: unable to open an initial console' $file | egrep -c 'WARNING:|Warn'`
  123. if test "$n_warn" -ne 0
  124. then
  125. summary="$summary Warnings: $n_warn"
  126. fi
  127. n_bugs=`egrep -c 'BUG|Oops:' $file`
  128. if test "$n_bugs" -ne 0
  129. then
  130. summary="$summary Bugs: $n_bugs"
  131. fi
  132. n_calltrace=`grep -c 'Call Trace:' $file`
  133. if test "$n_calltrace" -ne 0
  134. then
  135. summary="$summary Call Traces: $n_calltrace"
  136. fi
  137. n_lockdep=`grep -c =========== $file`
  138. if test "$n_badness" -ne 0
  139. then
  140. summary="$summary lockdep: $n_badness"
  141. fi
  142. n_stalls=`egrep -c 'detected stalls on CPUs/tasks:|self-detected stall on CPU|Stall ended before state dump start|\?\?\? Writer stall state' $file`
  143. if test "$n_stalls" -ne 0
  144. then
  145. summary="$summary Stalls: $n_stalls"
  146. fi
  147. n_starves=`grep -c 'rcu_.*kthread starved for' $file`
  148. if test "$n_starves" -ne 0
  149. then
  150. summary="$summary Starves: $n_starves"
  151. fi
  152. print_warning Summary: $summary
  153. cat $T.diags >> $file.diags
  154. fi
  155. for i in $file.*.diags
  156. do
  157. if test -f "$i"
  158. then
  159. cat $i >> $file.diags
  160. fi
  161. done
  162. if ! test -s $file.diags
  163. then
  164. rm -f $file.diags
  165. fi