parse-torture.sh 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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. T=/tmp/parse-torture.sh.$$
  30. file="$1"
  31. title="$2"
  32. trap 'rm -f $T.seq' 0
  33. . functions.sh
  34. # check for presence of torture output file.
  35. if test -f "$file" -a -r "$file"
  36. then
  37. :
  38. else
  39. echo $title unreadable torture output file: $file
  40. exit 1
  41. fi
  42. # check for abject failure
  43. if grep -q FAILURE $file || grep -q -e '-torture.*!!!' $file
  44. then
  45. nerrs=`grep --binary-files=text '!!!' $file | tail -1 | awk '{for (i=NF-8;i<=NF;i++) sum+=$i; } END {print sum}'`
  46. print_bug $title FAILURE, $nerrs instances
  47. echo " " $url
  48. exit
  49. fi
  50. grep --binary-files=text 'torture:.*ver:' $file | grep --binary-files=text -v '(null)' | sed -e 's/^(initramfs)[^]]*] //' -e 's/^\[[^]]*] //' |
  51. awk '
  52. BEGIN {
  53. ver = 0;
  54. badseq = 0;
  55. }
  56. {
  57. if (!badseq && ($5 + 0 != $5 || $5 <= ver)) {
  58. badseqno1 = ver;
  59. badseqno2 = $5;
  60. badseqnr = NR;
  61. badseq = 1;
  62. }
  63. ver = $5
  64. }
  65. END {
  66. if (badseq) {
  67. if (badseqno1 == badseqno2 && badseqno2 == ver)
  68. print "GP HANG at " ver " torture stat " badseqnr;
  69. else
  70. print "BAD SEQ " badseqno1 ":" badseqno2 " last:" ver " version " badseqnr;
  71. }
  72. }' > $T.seq
  73. if grep -q SUCCESS $file
  74. then
  75. if test -s $T.seq
  76. then
  77. print_warning $title $title `cat $T.seq`
  78. echo " " $file
  79. exit 2
  80. fi
  81. else
  82. if grep -q "_HOTPLUG:" $file
  83. then
  84. print_warning HOTPLUG FAILURES $title `cat $T.seq`
  85. echo " " $file
  86. exit 3
  87. fi
  88. echo $title no success message, `grep --binary-files=text 'ver:' $file | wc -l` successful version messages
  89. if test -s $T.seq
  90. then
  91. print_warning $title `cat $T.seq`
  92. fi
  93. exit 2
  94. fi