kvm-find-errors.sh 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #!/bin/sh
  2. #
  3. # Invoke a text editor on all console.log files for all runs with diagnostics,
  4. # that is, on all such files having a console.log.diags counterpart.
  5. # Note that both console.log.diags and console.log are passed to the
  6. # editor (currently defaulting to "vi"), allowing the user to get an
  7. # idea of what to search for in the console.log file.
  8. #
  9. # Usage: kvm-find-errors.sh directory
  10. #
  11. # The "directory" above should end with the date/time directory, for example,
  12. # "tools/testing/selftests/rcutorture/res/2018.02.25-14:27:27".
  13. rundir="${1}"
  14. if test -z "$rundir" -o ! -d "$rundir"
  15. then
  16. echo Usage: $0 directory
  17. fi
  18. editor=${EDITOR-vi}
  19. # Find builds with errors
  20. files=
  21. for i in ${rundir}/*/Make.out
  22. do
  23. if egrep -q "error:|warning:" < $i
  24. then
  25. egrep "error:|warning:" < $i > $i.diags
  26. files="$files $i.diags $i"
  27. fi
  28. done
  29. if test -n "$files"
  30. then
  31. $editor $files
  32. else
  33. echo No build errors.
  34. fi
  35. if grep -q -e "--buildonly" < ${rundir}/log
  36. then
  37. echo Build-only run, no console logs to check.
  38. fi
  39. # Find console logs with errors
  40. files=
  41. for i in ${rundir}/*/console.log
  42. do
  43. if test -r $i.diags
  44. then
  45. files="$files $i.diags $i"
  46. fi
  47. done
  48. if test -n "$files"
  49. then
  50. $editor $files
  51. else
  52. echo No errors in console logs.
  53. fi