kvm-recheck.sh 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. #!/bin/bash
  2. # SPDX-License-Identifier: GPL-2.0+
  3. #
  4. # Given the results directories for previous KVM-based torture runs,
  5. # check the build and console output for errors. Given a directory
  6. # containing results directories, this recursively checks them all.
  7. #
  8. # Usage: kvm-recheck.sh resdir ...
  9. #
  10. # Returns status reflecting the success or not of the last run specified.
  11. #
  12. # Copyright (C) IBM Corporation, 2011
  13. #
  14. # Authors: Paul E. McKenney <paulmck@linux.ibm.com>
  15. T="`mktemp ${TMPDIR-/tmp}/kvm-recheck.sh.XXXXXX`"
  16. trap 'rm -f $T' 0 2
  17. configerrors=0
  18. PATH=`pwd`/tools/testing/selftests/rcutorture/bin:$PATH; export PATH
  19. . functions.sh
  20. for rd in "$@"
  21. do
  22. firsttime=1
  23. dirs=`find $rd -name Make.defconfig.out -print | sort | sed -e 's,/[^/]*$,,' | sort -u`
  24. for i in $dirs
  25. do
  26. if test -n "$firsttime"
  27. then
  28. firsttime=""
  29. resdir=`echo $i | sed -e 's,/$,,' -e 's,/[^/]*$,,'`
  30. head -1 $resdir/log
  31. fi
  32. TORTURE_SUITE="`cat $i/../torture_suite`" ; export TORTURE_SUITE
  33. configfile=`echo $i | sed -e 's,^.*/,,'`
  34. rm -f $i/console.log.*.diags $i/ConfigFragment.diags
  35. case "${TORTURE_SUITE}" in
  36. X*)
  37. ;;
  38. *)
  39. kvm-recheck-${TORTURE_SUITE}.sh $i
  40. esac
  41. if test -f "$i/qemu-retval" && test "`cat $i/qemu-retval`" -ne 0 && test "`cat $i/qemu-retval`" -ne 137
  42. then
  43. echo QEMU error, output:
  44. cat $i/qemu-output
  45. elif test -f "$i/console.log"
  46. then
  47. if test -f "$i/qemu-retval" && test "`cat $i/qemu-retval`" -eq 137
  48. then
  49. echo QEMU killed
  50. fi
  51. configcheck.sh $i/.config $i/ConfigFragment > $i/ConfigFragment.diags 2>&1
  52. if grep -q '^CONFIG_KCSAN=y$' $i/ConfigFragment.input
  53. then
  54. # KCSAN forces a number of Kconfig options, so remove
  55. # complaints about those Kconfig options in KCSAN runs.
  56. mv $i/ConfigFragment.diags $i/ConfigFragment.diags.kcsan
  57. grep -v -E 'CONFIG_PROVE_RCU|CONFIG_PREEMPT_COUNT' $i/ConfigFragment.diags.kcsan > $i/ConfigFragment.diags
  58. fi
  59. if test -s $i/ConfigFragment.diags
  60. then
  61. cat $i/ConfigFragment.diags
  62. configerrors=$((configerrors+1))
  63. else
  64. rm $i/ConfigFragment.diags
  65. fi
  66. if test -r $i/Make.oldconfig.err
  67. then
  68. cat $i/Make.oldconfig.err
  69. fi
  70. parse-build.sh $i/Make.out $configfile
  71. parse-console.sh $i/console.log $configfile
  72. if test -r $i/Warnings
  73. then
  74. cat $i/Warnings
  75. fi
  76. else
  77. if test -f "$i/buildonly"
  78. then
  79. echo Build-only run, no boot/test
  80. configcheck.sh $i/.config $i/ConfigFragment > $i/ConfigFragment.diags 2>&1
  81. if test -s $i/ConfigFragment.diags
  82. then
  83. cat $i/ConfigFragment.diags
  84. configerrors=$((configerrors+1))
  85. else
  86. rm $i/ConfigFragment.diags
  87. fi
  88. parse-build.sh $i/Make.out $configfile
  89. elif test -f "$i/qemu-cmd"
  90. then
  91. print_bug qemu failed
  92. echo " $i"
  93. else
  94. print_bug Build failed
  95. echo " $i"
  96. fi
  97. fi
  98. done
  99. if test -f "$rd/kcsan.sum"
  100. then
  101. if ! test -f $i/ConfigFragment.diags
  102. then
  103. :
  104. elif grep -q CONFIG_KCSAN=y $i/ConfigFragment.diags
  105. then
  106. echo "Compiler or architecture does not support KCSAN!"
  107. echo Did you forget to switch your compiler with '--kmake-arg CC=<cc-that-supports-kcsan>'?
  108. elif test -s "$rd/kcsan.sum"
  109. then
  110. echo KCSAN summary in $rd/kcsan.sum
  111. else
  112. echo Clean KCSAN run in $rd
  113. fi
  114. fi
  115. done
  116. if test "$configerrors" -gt 0
  117. then
  118. echo $configerrors runs with .config errors.
  119. ret=1
  120. fi
  121. EDITOR=echo kvm-find-errors.sh "${@: -1}" > $T 2>&1
  122. builderrors="`tr ' ' '\012' < $T | grep -c '/Make.out.diags'`"
  123. if test "$builderrors" -gt 0
  124. then
  125. echo $builderrors runs with build errors.
  126. ret=2
  127. fi
  128. runerrors="`tr ' ' '\012' < $T | grep -c '/console.log.diags'`"
  129. if test "$runerrors" -gt 0
  130. then
  131. echo $runerrors runs with runtime errors.
  132. ret=3
  133. fi
  134. exit $ret