summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorArmin Kuster <akuster808@gmail.com>2019-04-22 06:32:39 -0600
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-04-29 14:16:30 +0100
commit9640fa3b22eec8bc60e6e4008780feb2507bb283 (patch)
treee2f025d25f909a9cdeb0c522e941b88a4a9b482f /meta
parent9c820850369aa0d53298291d3c77526d1817becd (diff)
downloadpoky-9640fa3b22eec8bc60e6e4008780feb2507bb283.tar.gz
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>
Diffstat (limited to 'meta')
-rw-r--r--meta/lib/oeqa/utils/logparser.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/meta/lib/oeqa/utils/logparser.py b/meta/lib/oeqa/utils/logparser.py
index 32fde14a7d..76efac4d06 100644
--- a/meta/lib/oeqa/utils/logparser.py
+++ b/meta/lib/oeqa/utils/logparser.py
@@ -86,3 +86,28 @@ class PtestParser(object):
86 status = self.results[section][test_name] 86 status = self.results[section][test_name]
87 f.write(status + ": " + test_name + "\n") 87 f.write(status + ": " + test_name + "\n")
88 88
89
90# ltp log parsing
91class LtpParser(object):
92 def __init__(self):
93 self.results = {}
94 self.section = {'duration': "", 'log': ""}
95
96 def parse(self, logfile):
97 test_regex = {}
98 test_regex['PASSED'] = re.compile(r"PASS")
99 test_regex['FAILED'] = re.compile(r"FAIL")
100 test_regex['SKIPPED'] = re.compile(r"SKIP")
101
102 with open(logfile, errors='replace') as f:
103 for line in f:
104 for t in test_regex:
105 result = test_regex[t].search(line)
106 if result:
107 self.results[line.split()[0].strip()] = t
108
109 for test in self.results:
110 result = self.results[test]
111 self.section['log'] = self.section['log'] + ("%s: %s\n" % (result.strip()[:-2], test.strip()))
112
113 return self.results, self.section