mirror of
https://git.yoctoproject.org/poky
synced 2026-05-30 12:29:55 +00:00
logparser: Add decoding ltp logs
(From OE-Core rev: 9be041fbaab71a40a2a7422221d8bd5637d6655c) Signed-off-by: Armin Kuster <akuster808@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
9c82085036
commit
9640fa3b22
@@ -86,3 +86,28 @@ class PtestParser(object):
|
|||||||
status = self.results[section][test_name]
|
status = self.results[section][test_name]
|
||||||
f.write(status + ": " + test_name + "\n")
|
f.write(status + ": " + test_name + "\n")
|
||||||
|
|
||||||
|
|
||||||
|
# ltp log parsing
|
||||||
|
class LtpParser(object):
|
||||||
|
def __init__(self):
|
||||||
|
self.results = {}
|
||||||
|
self.section = {'duration': "", 'log': ""}
|
||||||
|
|
||||||
|
def parse(self, logfile):
|
||||||
|
test_regex = {}
|
||||||
|
test_regex['PASSED'] = re.compile(r"PASS")
|
||||||
|
test_regex['FAILED'] = re.compile(r"FAIL")
|
||||||
|
test_regex['SKIPPED'] = re.compile(r"SKIP")
|
||||||
|
|
||||||
|
with open(logfile, errors='replace') as f:
|
||||||
|
for line in f:
|
||||||
|
for t in test_regex:
|
||||||
|
result = test_regex[t].search(line)
|
||||||
|
if result:
|
||||||
|
self.results[line.split()[0].strip()] = t
|
||||||
|
|
||||||
|
for test in self.results:
|
||||||
|
result = self.results[test]
|
||||||
|
self.section['log'] = self.section['log'] + ("%s: %s\n" % (result.strip()[:-2], test.strip()))
|
||||||
|
|
||||||
|
return self.results, self.section
|
||||||
|
|||||||
Reference in New Issue
Block a user