OLD | NEW |
---|---|
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import fnmatch | 5 import fnmatch |
6 import functools | 6 import functools |
7 import imp | 7 import imp |
8 import logging | 8 import logging |
9 import signal | 9 import signal |
10 import thread | 10 import thread |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
153 logging.info('FINISHED TRY #%d/%d', tries, self._env.max_tries) | 153 logging.info('FINISHED TRY #%d/%d', tries, self._env.max_tries) |
154 if tests: | 154 if tests: |
155 logging.info('%d failed tests remain.', len(tests)) | 155 logging.info('%d failed tests remain.', len(tests)) |
156 else: | 156 else: |
157 logging.info('All tests completed.') | 157 logging.info('All tests completed.') |
158 | 158 |
159 return results | 159 return results |
160 | 160 |
161 def _GetTestsToRetry(self, tests, try_results): | 161 def _GetTestsToRetry(self, tests, try_results): |
162 | 162 |
163 def is_failure(test_result): | 163 def is_failure_result(test_result): |
164 return ( | 164 return ( |
165 test_result is None | 165 test_result is None |
166 or test_result.GetType() not in ( | 166 or test_result.GetType() not in ( |
167 base_test_result.ResultType.PASS, | 167 base_test_result.ResultType.PASS, |
168 base_test_result.ResultType.SKIP)) | 168 base_test_result.ResultType.SKIP)) |
169 | 169 |
170 all_test_results = {r.GetName(): r for r in try_results.GetAll()} | 170 all_test_results = {r.GetName(): r for r in try_results.GetAll()} |
171 | 171 |
172 def should_retry(name): | 172 def test_failed(name): |
173 # When specifying a test filter, names can contain trailing wildcards. | 173 # When specifying a test filter, names can contain trailing wildcards. |
174 # See local_device_gtest_run._ExtractTestsFromFilter() | 174 # See local_device_gtest_run._ExtractTestsFromFilter() |
175 if name.endswith('*'): | 175 if name.endswith('*'): |
mikecase (-- gone --)
2016/07/01 19:00:37
I dont think I understand this. I get that a * can
jbudorick
2016/07/11 16:32:51
Yeah, this is a bit complicated because of an opti
| |
176 return any(fnmatch.fnmatch(n, name) and is_failure(t) | 176 return any(fnmatch.fnmatch(n, name) and is_failure_result(t) |
177 for n, t in all_test_results.iteritems()) | 177 for n, t in all_test_results.iteritems()) |
178 return is_failure(all_test_results.get(name)) | 178 return is_failure_result(all_test_results.get(name)) |
179 | 179 |
180 return [t for t in tests if should_retry(self._GetUniqueTestName(t))] | 180 failed_tests = (t for t in tests if test_failed(self._GetUniqueTestName(t))) |
181 | |
182 return [t for t in failed_tests if self._ShouldRetry(t)] | |
181 | 183 |
182 def GetTool(self, device): | 184 def GetTool(self, device): |
183 if not str(device) in self._tools: | 185 if not str(device) in self._tools: |
184 self._tools[str(device)] = valgrind_tools.CreateTool( | 186 self._tools[str(device)] = valgrind_tools.CreateTool( |
185 self._env.tool, device) | 187 self._env.tool, device) |
186 return self._tools[str(device)] | 188 return self._tools[str(device)] |
187 | 189 |
188 def _CreateShards(self, tests): | 190 def _CreateShards(self, tests): |
189 raise NotImplementedError | 191 raise NotImplementedError |
190 | 192 |
191 # pylint: disable=no-self-use | |
192 def _GetUniqueTestName(self, test): | 193 def _GetUniqueTestName(self, test): |
194 # pylint: disable=no-self-use | |
193 return test | 195 return test |
194 | 196 |
197 def _ShouldRetry(self, test): | |
198 # pylint: disable=no-self-use,unused-argument | |
199 return True | |
200 | |
195 def _GetTests(self): | 201 def _GetTests(self): |
196 raise NotImplementedError | 202 raise NotImplementedError |
197 | 203 |
198 def _RunTest(self, device, test): | 204 def _RunTest(self, device, test): |
199 raise NotImplementedError | 205 raise NotImplementedError |
200 | 206 |
201 def _ShouldShard(self): | 207 def _ShouldShard(self): |
202 raise NotImplementedError | 208 raise NotImplementedError |
OLD | NEW |