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 itertools | 5 import itertools |
6 import os | 6 import os |
7 import posixpath | 7 import posixpath |
8 | 8 |
9 from devil.android import device_errors | 9 from devil.android import device_errors |
10 from devil.android import device_temp_file | 10 from devil.android import device_temp_file |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 #override | 222 #override |
223 def _GetTests(self): | 223 def _GetTests(self): |
224 @local_device_test_run.handle_shard_failures | 224 @local_device_test_run.handle_shard_failures |
225 def list_tests(dev): | 225 def list_tests(dev): |
226 tests = self._delegate.Run( | 226 tests = self._delegate.Run( |
227 None, dev, flags='--gtest_list_tests', timeout=10) | 227 None, dev, flags='--gtest_list_tests', timeout=10) |
228 tests = gtest_test_instance.ParseGTestListTests(tests) | 228 tests = gtest_test_instance.ParseGTestListTests(tests) |
229 tests = self._test_instance.FilterTests(tests) | 229 tests = self._test_instance.FilterTests(tests) |
230 return tests | 230 return tests |
231 | 231 |
| 232 # Query all devices in case one fails. |
232 test_lists = self._env.parallel_devices.pMap(list_tests).pGet(None) | 233 test_lists = self._env.parallel_devices.pMap(list_tests).pGet(None) |
233 tests = list(sorted(set().union(*[set(tl) for tl in test_lists if tl]))) | 234 return list(sorted(set().union(*[set(tl) for tl in test_lists if tl]))) |
234 return tests | |
235 | 235 |
236 #override | 236 #override |
237 def _RunTest(self, device, test): | 237 def _RunTest(self, device, test): |
238 # Run the test. | 238 # Run the test. |
239 timeout = (self._test_instance.shard_timeout | 239 timeout = (self._test_instance.shard_timeout |
240 * self.GetTool(device).GetTimeoutScale()) | 240 * self.GetTool(device).GetTimeoutScale()) |
241 output = self._delegate.Run( | 241 output = self._delegate.Run( |
242 test, device, timeout=timeout, retries=0) | 242 test, device, timeout=timeout, retries=0) |
243 for s in self._servers[str(device)]: | 243 for s in self._servers[str(device)]: |
244 s.Reset() | 244 s.Reset() |
245 if self._test_instance.app_files: | 245 if self._test_instance.app_files: |
246 self._delegate.PullAppFiles(device, self._test_instance.app_files, | 246 self._delegate.PullAppFiles(device, self._test_instance.app_files, |
247 self._test_instance.app_file_dir) | 247 self._test_instance.app_file_dir) |
248 self._delegate.Clear(device) | 248 self._delegate.Clear(device) |
249 | 249 |
250 # Parse the output. | 250 # Parse the output. |
251 # TODO(jbudorick): Transition test scripts away from parsing stdout. | 251 # TODO(jbudorick): Transition test scripts away from parsing stdout. |
252 results = self._test_instance.ParseGTestOutput(output) | 252 results = self._test_instance.ParseGTestOutput(output) |
253 return results | 253 return results |
254 | 254 |
255 #override | 255 #override |
256 def TearDown(self): | 256 def TearDown(self): |
257 @local_device_test_run.handle_shard_failures | 257 @local_device_test_run.handle_shard_failures |
258 def individual_device_tear_down(dev): | 258 def individual_device_tear_down(dev): |
259 for s in self._servers.get(str(dev), []): | 259 for s in self._servers.get(str(dev), []): |
260 s.TearDown() | 260 s.TearDown() |
261 | 261 |
262 self._env.parallel_devices.pMap(individual_device_tear_down) | 262 self._env.parallel_devices.pMap(individual_device_tear_down) |
OLD | NEW |