From ff0a227e4c3e949ab4dca31c60ec693b40b9ce28 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Tue, 29 Jan 2019 13:24:45 +0000 Subject: oeqa/logparser: Reform the ptest results parser Now we have a dedicated ptest parser, merge in the remaining ptest specific pieces to further clarify and simplify the code, moving to a point where we can consider extending/enhancing it. (From OE-Core rev: 05991bb5bc8018275d03fdeecee3d5a757840c7c) (From OE-Core rev: e514c34195a7e1b2b7a1916ebd8c8ef631c60a01) Signed-off-by: Richard Purdie Signed-off-by: Armin Kuster Signed-off-by: Richard Purdie --- meta/lib/oeqa/runtime/cases/ptest.py | 40 +++--------------------------------- 1 file changed, 3 insertions(+), 37 deletions(-) (limited to 'meta/lib/oeqa/runtime') diff --git a/meta/lib/oeqa/runtime/cases/ptest.py b/meta/lib/oeqa/runtime/cases/ptest.py index 1ce22a09e7..ae54a01669 100644 --- a/meta/lib/oeqa/runtime/cases/ptest.py +++ b/meta/lib/oeqa/runtime/cases/ptest.py @@ -1,50 +1,16 @@ import unittest import pprint +import re from oeqa.runtime.case import OERuntimeTestCase from oeqa.core.decorator.depends import OETestDepends from oeqa.core.decorator.oeid import OETestID from oeqa.core.decorator.data import skipIfNotFeature from oeqa.runtime.decorator.package import OEHasPackage -from oeqa.utils.logparser import PtestParser, Result +from oeqa.utils.logparser import PtestParser class PtestRunnerTest(OERuntimeTestCase): - # a ptest log parser - def parse_ptest(self, logfile): - parser = PtestParser() - result = Result() - - with open(logfile, errors='replace') as f: - for line in f: - result_tuple = parser.parse_line(line) - if not result_tuple: - continue - line_type, category, status, name = result_tuple - - if line_type == 'section' and status == 'begin': - current_section = name - continue - - if line_type == 'section' and status == 'end': - current_section = None - continue - - if line_type == 'test' and status == 'pass': - result.store(current_section, name, status) - continue - - if line_type == 'test' and status == 'fail': - result.store(current_section, name, status) - continue - - if line_type == 'test' and status == 'skip': - result.store(current_section, name, status) - continue - - result.sort_tests() - return result - @OETestID(1600) @skipIfNotFeature('ptest', 'Test requires ptest to be in DISTRO_FEATURES') @OETestDepends(['ssh.SSHTest.test_ssh']) @@ -83,7 +49,7 @@ class PtestRunnerTest(OERuntimeTestCase): extras['ptestresult.rawlogs'] = {'log': output} # Parse and save results - parse_result = self.parse_ptest(ptest_runner_log) + parse_result = PtestParser().parse(ptest_runner_log) parse_result.log_as_files(ptest_log_dir, test_status = ['pass','fail', 'skip']) if os.path.exists(ptest_log_dir_link): # Remove the old link to create a new one -- cgit v1.2.3-54-g00ecf