diff options
author | Armin Kuster <akuster808@gmail.com> | 2019-04-22 06:32:42 -0600 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-04-29 14:16:30 +0100 |
commit | 65b50feabe2b197ebcfa98ed260e1972f0e2b042 (patch) | |
tree | bce0f864a2e7e0296868d00d21ffa00d15f209a1 /meta/lib/oeqa/utils | |
parent | 12d8f77a88598fdf95be6936e26b2f28394bf3be (diff) | |
download | poky-65b50feabe2b197ebcfa98ed260e1972f0e2b042.tar.gz |
logparser: Add LTP compliance section
(From OE-Core rev: 0e02eee4041828608bd64610538551646160fd5e)
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/utils')
-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 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 | ||
117 | class 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 | ||