kvm-find-errors.sh 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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 grep -q "error:" < $i
  24. then
  25. files="$files $i"
  26. fi
  27. done
  28. if test -n "$files"
  29. then
  30. $editor $files
  31. else
  32. echo No build errors.
  33. fi
  34. if grep -q -e "--buildonly" < ${rundir}/log
  35. then
  36. echo Build-only run, no console logs to check.
  37. fi
  38. # Find console logs with errors
  39. files=
  40. for i in ${rundir}/*/console.log
  41. do
  42. if test -r $i.diags
  43. then
  44. files="$files $i.diags $i"
  45. fi
  46. done
  47. if test -n "$files"
  48. then
  49. $editor $files
  50. else
  51. echo No errors in console logs.
  52. fi