summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArmin Kuster <akuster808@gmail.com>2019-04-11 09:31:10 -0700
committerArmin Kuster <akuster808@gmail.com>2019-04-16 21:49:16 -0700
commit3c4e2aaf7d1e19f268fc8bdd18f121e3373c565e (patch)
tree3d0e4ce0c46625385654024478500547b3b0fb6c
parentea01aace97fffc95b9ec923fa8a8b5a3772ed7f3 (diff)
downloadopenembedded-core-contrib-3c4e2aaf7d1e19f268fc8bdd18f121e3373c565e.tar.gz
openembedded-core-contrib-3c4e2aaf7d1e19f268fc8bdd18f121e3373c565e.tar.bz2
openembedded-core-contrib-3c4e2aaf7d1e19f268fc8bdd18f121e3373c565e.zip
logparser: Add decoding ltp logs
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 32fde14a7d..76efac4d06 100644
--- a/meta/lib/oeqa/utils/logparser.py
+++ b/meta/lib/oeqa/utils/logparser.py
@@ -86,3 +86,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