summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArmin Kuster <akuster808@gmail.com>2019-04-21 05:31:37 -0600
committerArmin Kuster <akuster808@gmail.com>2019-04-21 05:31:37 -0600
commit31180fb6a7392dde48b6c8d1493b6ea208dfa9ac (patch)
treed82ce1dddc75d15bbb0ab16ecf8d94d061074e27
parent39068ffab49db9f5cd0cb687f0e059ac2fbc1cc2 (diff)
downloadopenembedded-core-contrib-31180fb6a7392dde48b6c8d1493b6ea208dfa9ac.tar.gz
openembedded-core-contrib-31180fb6a7392dde48b6c8d1493b6ea208dfa9ac.tar.bz2
openembedded-core-contrib-31180fb6a7392dde48b6c8d1493b6ea208dfa9ac.zip
logparser: Add LTP compliance section
Signed-off-by: Armin Kuster <akuster808@gmail.com>
-rw-r--r--meta/lib/oeqa/utils/logparser.py37
1 files changed, 37 insertions, 0 deletions
diff --git a/meta/lib/oeqa/utils/logparser.py b/meta/lib/oeqa/utils/logparser.py
index 76efac4d06..584ad4f263 100644
--- a/meta/lib/oeqa/utils/logparser.py
+++ b/meta/lib/oeqa/utils/logparser.py
@@ -111,3 +111,40 @@ class LtpParser(object):
self.section['log'] = self.section['log'] + ("%s: %s\n" % (result.strip()[:-2], test.strip()))
return self.results, self.section
+
+
+# ltp Compliance log parsing
+class LtpComplianceParser(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"(?:UNTESTED)|(?:UNSUPPORTED)")
+
+ section_regex = {}
+ section_regex['test'] = re.compile(r"^Testing")
+
+ with open(logfile, errors='replace') as f:
+ for line in f:
+ result = section_regex['test'].search(line)
+ if result:
+ self.name = ""
+ self.name = line.split()[1].strip()
+ self.results[self.name] = "PASSED"
+ failed = 0
+
+ failed_result = test_regex['FAILED'].search(line)
+ if failed_result:
+ failed = line.split()[1].strip()
+ if int(failed) > 0:
+ self.results[self.name] = "FAILED"
+
+ 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