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