summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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):
111 self.section['log'] = self.section['log'] + ("%s: %s\n" % (result.strip()[:-2], test.strip())) 111 self.section['log'] = self.section['log'] + ("%s: %s\n" % (result.strip()[:-2], test.strip()))
112 112
113 return self.results, self.section 113 return self.results, self.section
114
115
116# ltp Compliance log parsing
117class LtpComplianceParser(object):
118 def __init__(self):
119 self.results = {}
120 self.section = {'duration': "", 'log': ""}
121
122 def parse(self, logfile):
123 test_regex = {}
124 test_regex['PASSED'] = re.compile(r"^PASS")
125 test_regex['FAILED'] = re.compile(r"^FAIL")
126 test_regex['SKIPPED'] = re.compile(r"(?:UNTESTED)|(?:UNSUPPORTED)")
127
128 section_regex = {}
129 section_regex['test'] = re.compile(r"^Testing")
130
131 with open(logfile, errors='replace') as f:
132 for line in f:
133 result = section_regex['test'].search(line)
134 if result:
135 self.name = ""
136 self.name = line.split()[1].strip()
137 self.results[self.name] = "PASSED"
138 failed = 0
139
140 failed_result = test_regex['FAILED'].search(line)
141 if failed_result:
142 failed = line.split()[1].strip()
143 if int(failed) > 0:
144 self.results[self.name] = "FAILED"
145
146 for test in self.results:
147 result = self.results[test]
148 self.section['log'] = self.section['log'] + ("%s: %s\n" % (result.strip()[:-2], test.strip()))
149
150 return self.results, self.section