diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-01-29 16:52:18 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-01-31 23:23:26 +0000 |
commit | 7b17274c30c6e95d87bc6a08f1311f0200c3f609 (patch) | |
tree | b8ef1660be23d5bdaf6d7ffcc59718d629bfd1b5 /meta/lib/oeqa/runtime/cases | |
parent | 54d4694f328a4ae07955aa68dcb6d3c183ed2edd (diff) | |
download | poky-7b17274c30c6e95d87bc6a08f1311f0200c3f609.tar.gz |
oeqa/logparser: Various misc cleanups
Get rid of further unneeded code complications:
* value mappings we could just direct use
* ftools when we can write files easily ourself
* test result status filtering we don't use
* variable overwriting module imports
(From OE-Core rev: d6065f136f6d353c3054cc3f440a4e259509f876)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/runtime/cases')
-rw-r--r-- | meta/lib/oeqa/runtime/cases/ptest.py | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/meta/lib/oeqa/runtime/cases/ptest.py b/meta/lib/oeqa/runtime/cases/ptest.py index 2843953b38..6ae951356d 100644 --- a/meta/lib/oeqa/runtime/cases/ptest.py +++ b/meta/lib/oeqa/runtime/cases/ptest.py | |||
@@ -1,6 +1,6 @@ | |||
1 | import unittest | 1 | import unittest |
2 | import pprint | 2 | import pprint |
3 | import re | 3 | import datetime |
4 | 4 | ||
5 | from oeqa.runtime.case import OERuntimeTestCase | 5 | from oeqa.runtime.case import OERuntimeTestCase |
6 | from oeqa.core.decorator.depends import OETestDepends | 6 | from oeqa.core.decorator.depends import OETestDepends |
@@ -21,8 +21,6 @@ class PtestRunnerTest(OERuntimeTestCase): | |||
21 | if status != 0: | 21 | if status != 0: |
22 | self.skipTest("No -ptest packages are installed in the image") | 22 | self.skipTest("No -ptest packages are installed in the image") |
23 | 23 | ||
24 | import datetime | ||
25 | |||
26 | test_log_dir = self.td.get('TEST_LOG_DIR', '') | 24 | test_log_dir = self.td.get('TEST_LOG_DIR', '') |
27 | # The TEST_LOG_DIR maybe NULL when testimage is added after | 25 | # The TEST_LOG_DIR maybe NULL when testimage is added after |
28 | # testdata.json is generated. | 26 | # testdata.json is generated. |
@@ -30,9 +28,9 @@ class PtestRunnerTest(OERuntimeTestCase): | |||
30 | test_log_dir = os.path.join(self.td.get('WORKDIR', ''), 'testimage') | 28 | test_log_dir = os.path.join(self.td.get('WORKDIR', ''), 'testimage') |
31 | # Don't use self.td.get('DATETIME'), it's from testdata.json, not | 29 | # Don't use self.td.get('DATETIME'), it's from testdata.json, not |
32 | # up-to-date, and may cause "File exists" when re-reun. | 30 | # up-to-date, and may cause "File exists" when re-reun. |
33 | datetime = datetime.datetime.now().strftime('%Y%m%d%H%M%S') | 31 | timestamp = datetime.datetime.now().strftime('%Y%m%d%H%M%S') |
34 | ptest_log_dir_link = os.path.join(test_log_dir, 'ptest_log') | 32 | ptest_log_dir_link = os.path.join(test_log_dir, 'ptest_log') |
35 | ptest_log_dir = '%s.%s' % (ptest_log_dir_link, datetime) | 33 | ptest_log_dir = '%s.%s' % (ptest_log_dir_link, timestamp) |
36 | ptest_runner_log = os.path.join(ptest_log_dir, 'ptest-runner.log') | 34 | ptest_runner_log = os.path.join(ptest_log_dir, 'ptest-runner.log') |
37 | 35 | ||
38 | status, output = self.target.run('ptest-runner', 0) | 36 | status, output = self.target.run('ptest-runner', 0) |
@@ -51,7 +49,7 @@ class PtestRunnerTest(OERuntimeTestCase): | |||
51 | # Parse and save results | 49 | # Parse and save results |
52 | parser = PtestParser() | 50 | parser = PtestParser() |
53 | results, sections = parser.parse(ptest_runner_log) | 51 | results, sections = parser.parse(ptest_runner_log) |
54 | parser.results_as_files(ptest_log_dir, test_status = ['pass','fail', 'skip']) | 52 | parser.results_as_files(ptest_log_dir) |
55 | if os.path.exists(ptest_log_dir_link): | 53 | if os.path.exists(ptest_log_dir_link): |
56 | # Remove the old link to create a new one | 54 | # Remove the old link to create a new one |
57 | os.remove(ptest_log_dir_link) | 55 | os.remove(ptest_log_dir_link) |
@@ -60,12 +58,11 @@ class PtestRunnerTest(OERuntimeTestCase): | |||
60 | extras['ptestresult.sections'] = sections | 58 | extras['ptestresult.sections'] = sections |
61 | 59 | ||
62 | trans = str.maketrans("()", "__") | 60 | trans = str.maketrans("()", "__") |
63 | resmap = {'pass': 'PASSED', 'skip': 'SKIPPED', 'fail': 'FAILED'} | ||
64 | for section in results: | 61 | for section in results: |
65 | for test in results[section]: | 62 | for test in results[section]: |
66 | result = results[section][test] | 63 | result = results[section][test] |
67 | testname = "ptestresult." + (section or "No-section") + "." + "_".join(test.translate(trans).split()) | 64 | testname = "ptestresult." + (section or "No-section") + "." + "_".join(test.translate(trans).split()) |
68 | extras[testname] = {'status': resmap[result]} | 65 | extras[testname] = {'status': result} |
69 | 66 | ||
70 | failed_tests = {} | 67 | failed_tests = {} |
71 | for section in results: | 68 | for section in results: |