aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArmin Kuster <akuster808@gmail.com>2019-04-22 06:32:39 -0600
committerArmin Kuster <akuster808@gmail.com>2019-06-14 07:05:34 -0700
commit8c0a03c24248bf69e9c8c0f2d949ff79efc9c71e (patch)
treebc83e7fb8db86fb4cd746ac2292770cacf732fb7
parent1ffea0c0fb3688f3cee0a5fa741e969581d01bd3 (diff)
downloadopenembedded-core-contrib-8c0a03c24248bf69e9c8c0f2d949ff79efc9c71e.tar.gz
openembedded-core-contrib-8c0a03c24248bf69e9c8c0f2d949ff79efc9c71e.tar.bz2
openembedded-core-contrib-8c0a03c24248bf69e9c8c0f2d949ff79efc9c71e.zip
logparser: Add decoding ltp logs
Signed-off-by: Armin Kuster <akuster808@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Armin Kuster <akuster808@gmail.com>
-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 18285fb544..abff8c78ae 100644
--- a/meta/lib/oeqa/utils/logparser.py
+++ b/meta/lib/oeqa/utils/logparser.py
@@ -89,3 +89,28 @@ class PtestParser(object):
status = self.results[section][test_name]
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