diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-01-29 14:22:07 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-02-25 22:25:04 +0000 |
commit | dc49021f75ed7e82713d1c9a04e045718bb9a548 (patch) | |
tree | b533eface57639e618b95d930559c2b6bf07859c /meta/lib/oeqa/utils | |
parent | e514c34195a7e1b2b7a1916ebd8c8ef631c60a01 (diff) | |
download | openembedded-core-dc49021f75ed7e82713d1c9a04e045718bb9a548.tar.gz openembedded-core-dc49021f75ed7e82713d1c9a04e045718bb9a548.tar.bz2 openembedded-core-dc49021f75ed7e82713d1c9a04e045718bb9a548.zip |
oeqa/utils/logparser: Add in support for duration, exitcode and logs by section
Allow parsing of the ptest duration, exit code and timeout keywords
from the logs, returning data on each section.
Also include the logs broken out per section.
(From OE-Core rev: a9a67dccaa5be0f06eedcab46dcff7cbf9202850)
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 | 40 |
1 files changed, 34 insertions, 6 deletions
diff --git a/meta/lib/oeqa/utils/logparser.py b/meta/lib/oeqa/utils/logparser.py index f8d1c03630..dddea14fc9 100644 --- a/meta/lib/oeqa/utils/logparser.py +++ b/meta/lib/oeqa/utils/logparser.py @@ -9,6 +9,7 @@ from . import ftools class PtestParser(object): def __init__(self): self.results = Result() + self.sections = {} def parse(self, logfile): test_regex = {} @@ -19,28 +20,55 @@ class PtestParser(object): section_regex = {} section_regex['begin'] = re.compile(r"^BEGIN: .*/(.+)/ptest") section_regex['end'] = re.compile(r"^END: .*/(.+)/ptest") + section_regex['duration'] = re.compile(r"^DURATION: (.+)") + section_regex['exitcode'] = re.compile(r"^ERROR: Exit status is (.+)") + section_regex['timeout'] = re.compile(r"^TIMEOUT: .*/(.+)/ptest") + + def newsection(): + return { 'name': "No-section", 'log': "" } + + current_section = newsection() with open(logfile, errors='replace') as f: for line in f: result = section_regex['begin'].search(line) if result: - current_section = result.group(1) + current_section['name'] = result.group(1) continue result = section_regex['end'].search(line) if result: - if current_section != result.group(1): - bb.warn("Ptest log section mismatch %s vs. %s" % (current_section, result.group(1))) - current_section = None + if current_section['name'] != result.group(1): + bb.warn("Ptest END log section mismatch %s vs. %s" % (current_section['name'], result.group(1))) + if current_section['name'] in self.sections: + bb.warn("Ptest duplicate section for %s" % (current_section['name'])) + self.sections[current_section['name']] = current_section + del self.sections[current_section['name']]['name'] + current_section = newsection() + continue + + result = section_regex['timeout'].search(line) + if result: + if current_section['name'] != result.group(1): + bb.warn("Ptest TIMEOUT log section mismatch %s vs. %s" % (current_section['name'], result.group(1))) + current_section['timeout'] = True continue + for t in ['duration', 'exitcode']: + result = section_regex[t].search(line) + if result: + current_section[t] = result.group(1) + continue + + current_section['log'] = current_section['log'] + line + for t in test_regex: result = test_regex[t].search(line) if result: - self.results.store(current_section, result.group(1), t) + self.results.store(current_section['name'], result.group(1), t) self.results.sort_tests() - return self.results + return self.results, self.sections class Result(object): |