diff options
Diffstat (limited to 'meta/lib')
-rw-r--r-- | meta/lib/oeqa/utils/logparser.py | 37 |
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 | ||
120 | class 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 | ||