summaryrefslogtreecommitdiffstats
path: root/meta/lib
diff options
context:
space:
mode:
authorArmin Kuster <akuster808@gmail.com>2019-04-22 06:32:42 -0600
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-06-18 11:28:58 +0100
commit51cd0fdd08c87d71cb9dd09b89f38c3bb1aa254e (patch)
tree57b6b2291637d0a62b5f90cfbb526c1e87158886 /meta/lib
parent2b408be15757749d9aa41b7c8082316489f79772 (diff)
downloadpoky-51cd0fdd08c87d71cb9dd09b89f38c3bb1aa254e.tar.gz
logparser: Add LTP compliance section
(From OE-Core rev: 386795d14c23d2e4084563c6234779b90e4d400f) 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> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-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 abff8c78ae..cc6d18d94a 100644
--- a/meta/lib/oeqa/utils/logparser.py
+++ b/meta/lib/oeqa/utils/logparser.py
@@ -114,3 +114,40 @@ class LtpParser(object):
114 self.section['log'] = self.section['log'] + ("%s: %s\n" % (result.strip()[:-2], test.strip())) 114 self.section['log'] = self.section['log'] + ("%s: %s\n" % (result.strip()[:-2], test.strip()))
115 115
116 return self.results, self.section 116 return self.results, self.section
117
118
119# ltp Compliance log parsing
120class LtpComplianceParser(object):
121 def __init__(self):
122 self.results = {}
123 self.section = {'duration': "", 'log': ""}
124
125 def parse(self, logfile):
126 test_regex = {}
127 test_regex['PASSED'] = re.compile(r"^PASS")
128 test_regex['FAILED'] = re.compile(r"^FAIL")
129 test_regex['SKIPPED'] = re.compile(r"(?:UNTESTED)|(?:UNSUPPORTED)")
130
131 section_regex = {}
132 section_regex['test'] = re.compile(r"^Testing")
133
134 with open(logfile, errors='replace') as f:
135 for line in f:
136 result = section_regex['test'].search(line)
137 if result:
138 self.name = ""
139 self.name = line.split()[1].strip()
140 self.results[self.name] = "PASSED"
141 failed = 0
142
143 failed_result = test_regex['FAILED'].search(line)
144 if failed_result:
145 failed = line.split()[1].strip()
146 if int(failed) > 0:
147 self.results[self.name] = "FAILED"
148
149 for test in self.results:
150 result = self.results[test]
151 self.section['log'] = self.section['log'] + ("%s: %s\n" % (result.strip()[:-2], test.strip()))
152
153 return self.results, self.section