| 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 imp | 6 import imp |
| 7 import logging | 7 import logging |
| 8 import posixpath | 8 import posixpath |
| 9 import signal | 9 import signal |
| 10 import thread | 10 import thread |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 # See local_device_gtest_run._ExtractTestsFromFilter() | 170 # See local_device_gtest_run._ExtractTestsFromFilter() |
| 171 if name.endswith('*'): | 171 if name.endswith('*'): |
| 172 return any(fnmatch.fnmatch(n, name) and is_failure_result(t) | 172 return any(fnmatch.fnmatch(n, name) and is_failure_result(t) |
| 173 for n, t in all_test_results.iteritems()) | 173 for n, t in all_test_results.iteritems()) |
| 174 return is_failure_result(all_test_results.get(name)) | 174 return is_failure_result(all_test_results.get(name)) |
| 175 | 175 |
| 176 failed_tests = (t for t in tests if test_failed(self._GetUniqueTestName(t))) | 176 failed_tests = (t for t in tests if test_failed(self._GetUniqueTestName(t))) |
| 177 | 177 |
| 178 return [t for t in failed_tests if self._ShouldRetry(t)] | 178 return [t for t in failed_tests if self._ShouldRetry(t)] |
| 179 | 179 |
| 180 def _ApplyExternalSharding(self, tests, shard_index, total_shards): |
| 181 return [ |
| 182 t for t in tests |
| 183 if hash(self._GetUniqueTestName(t)) % total_shards == shard_index] |
| 184 |
| 180 def GetTool(self, device): | 185 def GetTool(self, device): |
| 181 if not str(device) in self._tools: | 186 if not str(device) in self._tools: |
| 182 self._tools[str(device)] = valgrind_tools.CreateTool( | 187 self._tools[str(device)] = valgrind_tools.CreateTool( |
| 183 self._env.tool, device) | 188 self._env.tool, device) |
| 184 return self._tools[str(device)] | 189 return self._tools[str(device)] |
| 185 | 190 |
| 186 def _CreateShards(self, tests): | 191 def _CreateShards(self, tests): |
| 187 raise NotImplementedError | 192 raise NotImplementedError |
| 188 | 193 |
| 189 def _GetUniqueTestName(self, test): | 194 def _GetUniqueTestName(self, test): |
| 190 # pylint: disable=no-self-use | 195 # pylint: disable=no-self-use |
| 191 return test | 196 return test |
| 192 | 197 |
| 193 def _ShouldRetry(self, test): | 198 def _ShouldRetry(self, test): |
| 194 # pylint: disable=no-self-use,unused-argument | 199 # pylint: disable=no-self-use,unused-argument |
| 195 return True | 200 return True |
| 196 | 201 |
| 197 def _GetTests(self): | 202 def _GetTests(self): |
| 198 raise NotImplementedError | 203 raise NotImplementedError |
| 199 | 204 |
| 200 def _RunTest(self, device, test): | 205 def _RunTest(self, device, test): |
| 201 raise NotImplementedError | 206 raise NotImplementedError |
| 202 | 207 |
| 203 def _ShouldShard(self): | 208 def _ShouldShard(self): |
| 204 raise NotImplementedError | 209 raise NotImplementedError |
| 205 | 210 |
| 206 | 211 |
| 207 class NoTestsError(Exception): | 212 class NoTestsError(Exception): |
| 208 """Error for when no tests are found.""" | 213 """Error for when no tests are found.""" |
| OLD | NEW |