kvm-find-errors.sh 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. #!/bin/sh
  2. # SPDX-License-Identifier: GPL-2.0+
  3. #
  4. # Invoke a text editor on all console.log files for all runs with diagnostics,
  5. # that is, on all such files having a console.log.diags counterpart.
  6. # Note that both console.log.diags and console.log are passed to the
  7. # editor (currently defaulting to "vi"), allowing the user to get an
  8. # idea of what to search for in the console.log file.
  9. #
  10. # Usage: kvm-find-errors.sh directory
  11. #
  12. # The "directory" above should end with the date/time directory, for example,
  13. # "tools/testing/selftests/rcutorture/res/2018.02.25-14:27:27".
  14. # Returns error status reflecting the success (or not) of the specified run.
  15. #
  16. # Copyright (C) IBM Corporation, 2018
  17. #
  18. # Author: Paul E. McKenney <paulmck@linux.ibm.com>
  19. rundir="${1}"
  20. if test -z "$rundir" -o ! -d "$rundir"
  21. then
  22. echo Directory "$rundir" not found.
  23. echo Usage: $0 directory
  24. exit 1
  25. fi
  26. editor=${EDITOR-vi}
  27. # Find builds with errors
  28. files=
  29. for i in ${rundir}/*/Make.out
  30. do
  31. scenariodir="`dirname $i`"
  32. scenariobasedir="`echo ${scenariodir} | sed -e 's/\.[0-9]*$//'`"
  33. if grep -E -q "error:|warning:|^ld: .*undefined reference to" < $i
  34. then
  35. grep -E "error:|warning:|^ld: .*undefined reference to" < $i > $i.diags
  36. files="$files $i.diags $i"
  37. elif ! test -f ${scenariobasedir}/vmlinux && ! test -f ${scenariobasedir}/vmlinux.xz && ! test -f "${rundir}/re-run"
  38. then
  39. echo No ${scenariobasedir}/vmlinux file > $i.diags
  40. files="$files $i.diags $i"
  41. fi
  42. done
  43. if test -n "$files"
  44. then
  45. $editor $files
  46. editorret=1
  47. else
  48. echo No build errors.
  49. fi
  50. if grep -q -e "--build-\?only" < ${rundir}/log && ! test -f "${rundir}/remote-log"
  51. then
  52. echo Build-only run, no console logs to check.
  53. exit $editorret
  54. fi
  55. # Find console logs with errors
  56. files=
  57. for i in ${rundir}/*/console.log
  58. do
  59. if test -r $i.diags
  60. then
  61. files="$files $i.diags $i"
  62. fi
  63. done
  64. if test -n "$files"
  65. then
  66. $editor $files
  67. exit 1
  68. else
  69. echo No errors in console logs.
  70. if test -n "$editorret"
  71. then
  72. exit $editorret
  73. else
  74. exit 0
  75. fi
  76. fi