check_kernel.py 897 B

12345678910111213141516171819202122232425262728293031
  1. # kernel message checker module
  2. #
  3. # Copyright (c) 2013, Intel Corporation
  4. #
  5. # Author: Johannes Berg <johannes@sipsolutions.net>
  6. #
  7. # This software may be distributed under the terms of the BSD license.
  8. # See README for more details.
  9. #
  10. """
  11. Tests for kernel messages to find if there were any issues in them.
  12. """
  13. import re
  14. lockdep_messages = [
  15. 'possible circular locking dependency',
  16. '.*-safe -> .*unsafe lock order detected',
  17. 'possible recursive locking detected',
  18. 'inconsistent lock state',
  19. 'possible irq lock inversion dependency',
  20. 'suspicious RCU usage',
  21. ]
  22. lockdep = r'(\[\s*)?(INFO|WARNING): (%s)|\*\*\* DEADLOCK \*\*\*' % ('|'.join(lockdep_messages), )
  23. issue = re.compile('(\[[0-9 .]*\] )?(WARNING:|BUG:|%s|RTNL: assertion failed).*' % lockdep)
  24. def check_kernel(logfile):
  25. for line in open(logfile, 'r'):
  26. if issue.match(line):
  27. return False
  28. return True