diff options
| author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-01-29 13:24:45 +0000 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-02-25 22:27:39 +0000 |
| commit | ff0a227e4c3e949ab4dca31c60ec693b40b9ce28 (patch) | |
| tree | ee8add934f55cc826bd8c301798ca723a85075a7 /meta/lib/oeqa/runtime | |
| parent | a18ab724da3b93e0ebca6972cdfcb1145cffad5f (diff) | |
| download | poky-ff0a227e4c3e949ab4dca31c60ec693b40b9ce28.tar.gz | |
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 <richard.purdie@linuxfoundation.org>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/runtime')
| -rw-r--r-- | meta/lib/oeqa/runtime/cases/ptest.py | 40 |
1 files changed, 3 insertions, 37 deletions
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 @@ | |||
| 1 | import unittest | 1 | import unittest |
| 2 | import pprint | 2 | import pprint |
| 3 | import re | ||
| 3 | 4 | ||
| 4 | from oeqa.runtime.case import OERuntimeTestCase | 5 | from oeqa.runtime.case import OERuntimeTestCase |
| 5 | from oeqa.core.decorator.depends import OETestDepends | 6 | from oeqa.core.decorator.depends import OETestDepends |
| 6 | from oeqa.core.decorator.oeid import OETestID | 7 | from oeqa.core.decorator.oeid import OETestID |
| 7 | from oeqa.core.decorator.data import skipIfNotFeature | 8 | from oeqa.core.decorator.data import skipIfNotFeature |
| 8 | from oeqa.runtime.decorator.package import OEHasPackage | 9 | from oeqa.runtime.decorator.package import OEHasPackage |
| 9 | from oeqa.utils.logparser import PtestParser, Result | 10 | from oeqa.utils.logparser import PtestParser |
| 10 | 11 | ||
| 11 | class PtestRunnerTest(OERuntimeTestCase): | 12 | class PtestRunnerTest(OERuntimeTestCase): |
| 12 | 13 | ||
| 13 | # a ptest log parser | ||
| 14 | def parse_ptest(self, logfile): | ||
| 15 | parser = PtestParser() | ||
| 16 | result = Result() | ||
| 17 | |||
| 18 | with open(logfile, errors='replace') as f: | ||
| 19 | for line in f: | ||
| 20 | result_tuple = parser.parse_line(line) | ||
| 21 | if not result_tuple: | ||
| 22 | continue | ||
| 23 | line_type, category, status, name = result_tuple | ||
| 24 | |||
| 25 | if line_type == 'section' and status == 'begin': | ||
| 26 | current_section = name | ||
| 27 | continue | ||
| 28 | |||
| 29 | if line_type == 'section' and status == 'end': | ||
| 30 | current_section = None | ||
| 31 | continue | ||
| 32 | |||
| 33 | if line_type == 'test' and status == 'pass': | ||
| 34 | result.store(current_section, name, status) | ||
| 35 | continue | ||
| 36 | |||
| 37 | if line_type == 'test' and status == 'fail': | ||
| 38 | result.store(current_section, name, status) | ||
| 39 | continue | ||
| 40 | |||
| 41 | if line_type == 'test' and status == 'skip': | ||
| 42 | result.store(current_section, name, status) | ||
| 43 | continue | ||
| 44 | |||
| 45 | result.sort_tests() | ||
| 46 | return result | ||
| 47 | |||
| 48 | @OETestID(1600) | 14 | @OETestID(1600) |
| 49 | @skipIfNotFeature('ptest', 'Test requires ptest to be in DISTRO_FEATURES') | 15 | @skipIfNotFeature('ptest', 'Test requires ptest to be in DISTRO_FEATURES') |
| 50 | @OETestDepends(['ssh.SSHTest.test_ssh']) | 16 | @OETestDepends(['ssh.SSHTest.test_ssh']) |
| @@ -83,7 +49,7 @@ class PtestRunnerTest(OERuntimeTestCase): | |||
| 83 | extras['ptestresult.rawlogs'] = {'log': output} | 49 | extras['ptestresult.rawlogs'] = {'log': output} |
| 84 | 50 | ||
| 85 | # Parse and save results | 51 | # Parse and save results |
| 86 | parse_result = self.parse_ptest(ptest_runner_log) | 52 | parse_result = PtestParser().parse(ptest_runner_log) |
| 87 | parse_result.log_as_files(ptest_log_dir, test_status = ['pass','fail', 'skip']) | 53 | parse_result.log_as_files(ptest_log_dir, test_status = ['pass','fail', 'skip']) |
| 88 | if os.path.exists(ptest_log_dir_link): | 54 | if os.path.exists(ptest_log_dir_link): |
| 89 | # Remove the old link to create a new one | 55 | # Remove the old link to create a new one |
