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 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 312 on_failure=self._env.BlacklistDevice) | 312 on_failure=self._env.BlacklistDevice) |
| 313 def list_tests(dev): | 313 def list_tests(dev): |
| 314 tests = self._delegate.Run( | 314 tests = self._delegate.Run( |
| 315 None, dev, flags='--gtest_list_tests', timeout=20) | 315 None, dev, flags='--gtest_list_tests', timeout=20) |
| 316 tests = gtest_test_instance.ParseGTestListTests(tests) | 316 tests = gtest_test_instance.ParseGTestListTests(tests) |
| 317 tests = self._test_instance.FilterTests(tests) | 317 tests = self._test_instance.FilterTests(tests) |
| 318 return tests | 318 return tests |
| 319 | 319 |
| 320 # Query all devices in case one fails. | 320 # Query all devices in case one fails. |
| 321 test_lists = self._env.parallel_devices.pMap(list_tests).pGet(None) | 321 test_lists = self._env.parallel_devices.pMap(list_tests).pGet(None) |
| 322 | |
| 323 # If all devices failed to list tests, raise an exception. | 322 # If all devices failed to list tests, raise an exception. |
| 324 if all([tl is None for tl in test_lists]): | 323 # Check that tl is not None and is not empty. |
| 324 if all([(tl is None or not tl) for tl in test_lists]): | |
|
BigBossZhiling
2016/04/25 20:07:15
But in this case, if a suite indeed has an empty l
jbudorick
2016/04/25 20:11:38
Yeah, I think I'm ok with this in general. However
| |
| 325 raise device_errors.CommandFailedError( | 325 raise device_errors.CommandFailedError( |
| 326 'Failed to list tests on any device') | 326 'Failed to list tests on any device') |
| 327 return list(sorted(set().union(*[set(tl) for tl in test_lists if tl]))) | 327 return list(sorted(set().union(*[set(tl) for tl in test_lists if tl]))) |
| 328 | 328 |
| 329 #override | 329 #override |
| 330 def _RunTest(self, device, test): | 330 def _RunTest(self, device, test): |
| 331 # Run the test. | 331 # Run the test. |
| 332 timeout = (self._test_instance.shard_timeout | 332 timeout = (self._test_instance.shard_timeout |
| 333 * self.GetTool(device).GetTimeoutScale()) | 333 * self.GetTool(device).GetTimeoutScale()) |
| 334 output = self._delegate.Run( | 334 output = self._delegate.Run( |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 355 def TearDown(self): | 355 def TearDown(self): |
| 356 @local_device_test_run.handle_shard_failures | 356 @local_device_test_run.handle_shard_failures |
| 357 def individual_device_tear_down(dev): | 357 def individual_device_tear_down(dev): |
| 358 for s in self._servers.get(str(dev), []): | 358 for s in self._servers.get(str(dev), []): |
| 359 s.TearDown() | 359 s.TearDown() |
| 360 | 360 |
| 361 tool = self.GetTool(dev) | 361 tool = self.GetTool(dev) |
| 362 tool.CleanUpEnvironment() | 362 tool.CleanUpEnvironment() |
| 363 | 363 |
| 364 self._env.parallel_devices.pMap(individual_device_tear_down) | 364 self._env.parallel_devices.pMap(individual_device_tear_down) |
| OLD | NEW |