Chromium Code Reviews| 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 collections | 5 import collections |
| 6 import itertools | 6 import itertools |
| 7 import os | 7 import os |
| 8 import posixpath | 8 import posixpath |
| 9 | 9 |
| 10 from devil.android import device_errors | 10 from devil.android import device_errors |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 308 on_failure=self._env.BlacklistDevice) | 308 on_failure=self._env.BlacklistDevice) |
| 309 def list_tests(dev): | 309 def list_tests(dev): |
| 310 tests = self._delegate.Run( | 310 tests = self._delegate.Run( |
| 311 None, dev, flags='--gtest_list_tests', timeout=20) | 311 None, dev, flags='--gtest_list_tests', timeout=20) |
| 312 tests = gtest_test_instance.ParseGTestListTests(tests) | 312 tests = gtest_test_instance.ParseGTestListTests(tests) |
| 313 tests = self._test_instance.FilterTests(tests) | 313 tests = self._test_instance.FilterTests(tests) |
| 314 return tests | 314 return tests |
| 315 | 315 |
| 316 # Query all devices in case one fails. | 316 # Query all devices in case one fails. |
| 317 test_lists = self._env.parallel_devices.pMap(list_tests).pGet(None) | 317 test_lists = self._env.parallel_devices.pMap(list_tests).pGet(None) |
| 318 # TODO(agrieve): Make this fail rather than return an empty list when | 318 |
| 319 # all devices fail. | 319 # If all devices failed to s/list_tests/list tests, raise an exception. |
|
mikecase (-- gone --)
2016/02/25 16:43:44
In my previous comment (I probably wrote it incorr
BigBossZhiling
2016/02/25 18:10:13
Done.
| |
| 320 if all([tl is None for tl in test_lists]): | |
| 321 raise device_errors.CommandFailedError( | |
| 322 'Failed to list tests on any device') | |
| 320 return list(sorted(set().union(*[set(tl) for tl in test_lists if tl]))) | 323 return list(sorted(set().union(*[set(tl) for tl in test_lists if tl]))) |
| 321 | 324 |
| 322 #override | 325 #override |
| 323 def _RunTest(self, device, test): | 326 def _RunTest(self, device, test): |
| 324 # Run the test. | 327 # Run the test. |
| 325 timeout = (self._test_instance.shard_timeout | 328 timeout = (self._test_instance.shard_timeout |
| 326 * self.GetTool(device).GetTimeoutScale()) | 329 * self.GetTool(device).GetTimeoutScale()) |
| 327 output = self._delegate.Run( | 330 output = self._delegate.Run( |
| 328 test, device, flags=self._test_instance.test_arguments, | 331 test, device, flags=self._test_instance.test_arguments, |
| 329 timeout=timeout, retries=0) | 332 timeout=timeout, retries=0) |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 344 def TearDown(self): | 347 def TearDown(self): |
| 345 @local_device_test_run.handle_shard_failures | 348 @local_device_test_run.handle_shard_failures |
| 346 def individual_device_tear_down(dev): | 349 def individual_device_tear_down(dev): |
| 347 for s in self._servers.get(str(dev), []): | 350 for s in self._servers.get(str(dev), []): |
| 348 s.TearDown() | 351 s.TearDown() |
| 349 | 352 |
| 350 tool = self.GetTool(dev) | 353 tool = self.GetTool(dev) |
| 351 tool.CleanUpEnvironment() | 354 tool.CleanUpEnvironment() |
| 352 | 355 |
| 353 self._env.parallel_devices.pMap(individual_device_tear_down) | 356 self._env.parallel_devices.pMap(individual_device_tear_down) |
| OLD | NEW |