diff options
author | Ross Burton <ross.burton@arm.com> | 2023-09-23 14:04:08 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-09-26 10:25:42 +0100 |
commit | 50c637e6dc85168cefe0a6e87f39b4903e76efa4 (patch) | |
tree | 91664c5786c75d99abc36c84c1c077ae65378874 /meta | |
parent | c7957aeeb520c51e1ffb335462208b6e7519726c (diff) | |
download | poky-50c637e6dc85168cefe0a6e87f39b4903e76efa4.tar.gz |
oeqa/runtime/parselogs: don't pass around members
There's no point in passing around member fields, just access them
directly.
(From OE-Core rev: a24d6eda061363cdcfa95980cd2698a674737d23)
Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r-- | meta/lib/oeqa/runtime/cases/parselogs.py | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/meta/lib/oeqa/runtime/cases/parselogs.py b/meta/lib/oeqa/runtime/cases/parselogs.py index 93782b844b..0262f574d1 100644 --- a/meta/lib/oeqa/runtime/cases/parselogs.py +++ b/meta/lib/oeqa/runtime/cases/parselogs.py | |||
@@ -263,19 +263,19 @@ class ParseLogsTest(OERuntimeTestCase): | |||
263 | return logs | 263 | return logs |
264 | 264 | ||
265 | # Build the grep command to be used with filters and exclusions | 265 | # Build the grep command to be used with filters and exclusions |
266 | def build_grepcmd(self, errors, ignore_errors, log): | 266 | def build_grepcmd(self, log): |
267 | grepcmd = 'grep ' | 267 | grepcmd = 'grep ' |
268 | grepcmd += '-Ei "' | 268 | grepcmd += '-Ei "' |
269 | for error in errors: | 269 | for error in self.errors: |
270 | grepcmd += r'\<' + error + r'\>' + '|' | 270 | grepcmd += r'\<' + error + r'\>' + '|' |
271 | grepcmd = grepcmd[:-1] | 271 | grepcmd = grepcmd[:-1] |
272 | grepcmd += '" ' + str(log) + " | grep -Eiv \'" | 272 | grepcmd += '" ' + str(log) + " | grep -Eiv \'" |
273 | 273 | ||
274 | try: | 274 | try: |
275 | errorlist = ignore_errors[self.td.get('MACHINE')] | 275 | errorlist = self.ignore_errors[self.td.get('MACHINE')] |
276 | except KeyError: | 276 | except KeyError: |
277 | self.msg += 'No ignore list found for this machine, using default\n' | 277 | self.msg += 'No ignore list found for this machine, using default\n' |
278 | errorlist = ignore_errors['default'] | 278 | errorlist = self.ignore_errors['default'] |
279 | 279 | ||
280 | for ignore_error in errorlist: | 280 | for ignore_error in errorlist: |
281 | ignore_error = ignore_error.replace('(', r'\(') | 281 | ignore_error = ignore_error.replace('(', r'\(') |
@@ -292,17 +292,21 @@ class ParseLogsTest(OERuntimeTestCase): | |||
292 | 292 | ||
293 | return grepcmd | 293 | return grepcmd |
294 | 294 | ||
295 | # Grep only the errors so that their context could be collected. | 295 | def parse_logs(self, logs, lines_before=10, lines_after=10): |
296 | # Default context is 10 lines before and after the error itself | 296 | """ |
297 | def parse_logs(self, errors, ignore_errors, logs, | 297 | Search the log files @logs looking for error lines (marked by |
298 | lines_before = 10, lines_after = 10): | 298 | @self.errors), ignoring anything listed in @self.ignore_errors. |
299 | |||
300 | Returns a dictionary of log filenames to a dictionary of error lines to | ||
301 | the error context (controlled by @lines_before and @lines_after). | ||
302 | """ | ||
299 | results = {} | 303 | results = {} |
300 | rez = [] | 304 | rez = [] |
301 | grep_output = '' | 305 | grep_output = '' |
302 | 306 | ||
303 | for log in logs: | 307 | for log in logs: |
304 | result = None | 308 | result = None |
305 | thegrep = self.build_grepcmd(errors, ignore_errors, log) | 309 | thegrep = self.build_grepcmd(log) |
306 | 310 | ||
307 | try: | 311 | try: |
308 | result = check_output(thegrep, shell=True).decode('utf-8') | 312 | result = check_output(thegrep, shell=True).decode('utf-8') |
@@ -333,7 +337,7 @@ class ParseLogsTest(OERuntimeTestCase): | |||
333 | def test_parselogs(self): | 337 | def test_parselogs(self): |
334 | self.write_dmesg() | 338 | self.write_dmesg() |
335 | log_list = self.get_local_log_list(self.log_locations) | 339 | log_list = self.get_local_log_list(self.log_locations) |
336 | result = self.parse_logs(self.errors, self.ignore_errors, log_list) | 340 | result = self.parse_logs(log_list) |
337 | errcount = 0 | 341 | errcount = 0 |
338 | for log in result: | 342 | for log in result: |
339 | self.msg += 'Log: ' + log + '\n' | 343 | self.msg += 'Log: ' + log + '\n' |