Skip to content

Commit d228243

Browse files
committed
lib: Import logic to selectively ignore warnings in boot logs
1 parent bb83595 commit d228243

2 files changed

Lines changed: 15 additions & 0 deletions

File tree

etc/filters.ini

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
[ignore]
2+
start=#@@@ ignore warnings @@@#
3+
stop=#@@@ detect warnings @@@#
4+
15
[patterns]
26
v1=detected stall(s)? on CPU
37
v2=WARNING:.*\s(un)?lock(s|ing)?\s

lib/utils.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,8 @@ def filter_log_warnings(infile, outfile):
161161

162162
parser = ConfigParser()
163163
parser.read_file(open(path))
164+
ignore_start = parser['ignore']['start']
165+
ignore_stop = parser['ignore']['stop']
164166
suppressions = [t[1] for t in parser.items('suppressions', [])]
165167
suppression_patterns = [t[1] for t in parser.items('suppression_patterns', [])]
166168
suppression_patterns = [re.compile(p) for p in suppression_patterns]
@@ -180,11 +182,20 @@ def suppress(line):
180182
return False
181183

182184
found = False
185+
ignoring = False
183186
while True:
184187
line = infile.readline()
185188
if len(line) == 0:
186189
break
187190

191+
if ignore_stop in line:
192+
ignoring = False
193+
elif not ignoring and ignore_start in line:
194+
ignoring = True
195+
196+
if ignoring:
197+
continue
198+
188199
if suppress(line):
189200
continue
190201

0 commit comments

Comments
 (0)