diff options
Diffstat (limited to 'meta/lib/oeqa/utils')
-rw-r--r-- | meta/lib/oeqa/utils/logparser.py | 25 |
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): | |||
86 | status = self.results[section][test_name] | 86 | status = self.results[section][test_name] |
87 | f.write(status + ": " + test_name + "\n") | 87 | f.write(status + ": " + test_name + "\n") |
88 | 88 | ||
89 | |||
90 | # ltp log parsing | ||
91 | class LtpParser(object): | ||
92 | def __init__(self): | ||
93 | self.results = {} | ||
94 | self.section = {'duration': "", 'log': ""} | ||
95 | |||
96 | def parse(self, logfile): | ||
97 | test_regex = {} | ||
98 | test_regex['PASSED'] = re.compile(r"PASS") | ||
99 | test_regex['FAILED'] = re.compile(r"FAIL") | ||
100 | test_regex['SKIPPED'] = re.compile(r"SKIP") | ||
101 | |||
102 | with open(logfile, errors='replace') as f: | ||
103 | for line in f: | ||
104 | for t in test_regex: | ||
105 | result = test_regex[t].search(line) | ||
106 | if result: | ||
107 | self.results[line.split()[0].strip()] = t | ||
108 | |||
109 | for test in self.results: | ||
110 | result = self.results[test] | ||
111 | self.section['log'] = self.section['log'] + ("%s: %s\n" % (result.strip()[:-2], test.strip())) | ||
112 | |||
113 | return self.results, self.section | ||