diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-01-29 16:52:18 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-02-25 22:25:04 +0000 |
commit | ba944a72302fa088c31c7b1eee4ad9f64f9769e4 (patch) | |
tree | 150d7bdb9fe298c32a362585dc88806fbf6f8ad3 /meta/lib/oeqa/utils | |
parent | 966ffaada3e9f43a25b1361c53d4b16a521aa517 (diff) | |
download | openembedded-core-ba944a72302fa088c31c7b1eee4ad9f64f9769e4.tar.gz openembedded-core-ba944a72302fa088c31c7b1eee4ad9f64f9769e4.tar.bz2 openembedded-core-ba944a72302fa088c31c7b1eee4ad9f64f9769e4.zip |
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>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Diffstat (limited to 'meta/lib/oeqa/utils')
-rw-r--r-- | meta/lib/oeqa/utils/logparser.py | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/meta/lib/oeqa/utils/logparser.py b/meta/lib/oeqa/utils/logparser.py index 8585c195c4..32fde14a7d 100644 --- a/meta/lib/oeqa/utils/logparser.py +++ b/meta/lib/oeqa/utils/logparser.py @@ -3,7 +3,6 @@ import sys import os import re -from . import ftools # A parser that can be used to identify weather a line is a test result or a section statement. class PtestParser(object): @@ -13,9 +12,9 @@ class PtestParser(object): def parse(self, logfile): test_regex = {} - test_regex['pass'] = re.compile(r"^PASS:(.+)") - test_regex['fail'] = re.compile(r"^FAIL:(.+)") - test_regex['skip'] = re.compile(r"^SKIP:(.+)") + test_regex['PASSED'] = re.compile(r"^PASS:(.+)") + test_regex['FAILED'] = re.compile(r"^FAIL:(.+)") + test_regex['SKIPPED'] = re.compile(r"^SKIP:(.+)") section_regex = {} section_regex['begin'] = re.compile(r"^BEGIN: .*/(.+)/ptest") @@ -72,9 +71,7 @@ class PtestParser(object): return self.results, self.sections # Log the results as files. The file name is the section name and the contents are the tests in that section. - def results_as_files(self, target_dir, test_status): - if not type(test_status) == type([]): - raise Exception("test_status should be a list. Got " + str(test_status) + " instead.") + def results_as_files(self, target_dir): if not os.path.exists(target_dir): raise Exception("Target directory does not exist: %s" % target_dir) @@ -84,10 +81,8 @@ class PtestParser(object): prefix = section section_file = os.path.join(target_dir, prefix) # purge the file contents if it exists - open(section_file, 'w').close() - for test_name in sorted(self.results[section]): - status = self.results[section][test_name] - # we log only the tests with status in the test_status list - if status in test_status: - ftools.append_file(section_file, status + ": " + test_name) + with open(section_file, 'w') as f: + for test_name in sorted(self.results[section]): + status = self.results[section][test_name] + f.write(status + ": " + test_name + "\n") |