Updated through tag hostap_2_5 from git://w1.fi/hostap.git
[mech_eap.git] / libeap / tests / hwsim / check_kernel.py
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
14 import re
15
16 lockdep_messages = [
17   'possible circular locking dependency',
18   '.*-safe -> .*unsafe lock order detected',
19   'possible recursive locking detected',
20   'inconsistent lock state',
21   'possible irq lock inversion dependency',
22   'suspicious RCU usage',
23 ]
24 lockdep = r'(\[\s*)?INFO: (%s)' % ('|'.join(lockdep_messages), )
25 issue = re.compile('(\[[0-9 .]*\] )?(WARNING:|BUG:|%s|RTNL: assertion failed).*' % lockdep)
26
27 def check_kernel(logfile):
28     for line in open(logfile, 'r'):
29         if issue.match(line):
30             return False
31     return True