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 list_tests, raise an exception. |
mikecase (-- gone --)
2016/02/19 23:41:53
super nit: s/list_tests/list tests
BigBossZhiling
2016/02/24 22:51:14
Done.
| |
320 if all([tests == None for tests in test_lists]): | |
mikecase (-- gone --)
2016/02/19 23:41:54
super nit: To match the variable naming below...
s
| |
321 # Now we know that all devices failed to do list_tests. | |
mikecase (-- gone --)
2016/02/19 23:41:53
super nit: Comment is probably unnecessary given y
| |
322 raise device_errors.CommandFailedError( | |
323 "Failed to list_tests on all devices") | |
mikecase (-- gone --)
2016/02/19 23:41:53
super nit: s/list_tests/list tests
super nit: sing
| |
320 return list(sorted(set().union(*[set(tl) for tl in test_lists if tl]))) | 324 return list(sorted(set().union(*[set(tl) for tl in test_lists if tl]))) |
321 | 325 |
322 #override | 326 #override |
323 def _RunTest(self, device, test): | 327 def _RunTest(self, device, test): |
324 # Run the test. | 328 # Run the test. |
325 timeout = (self._test_instance.shard_timeout | 329 timeout = (self._test_instance.shard_timeout |
326 * self.GetTool(device).GetTimeoutScale()) | 330 * self.GetTool(device).GetTimeoutScale()) |
327 output = self._delegate.Run( | 331 output = self._delegate.Run( |
328 test, device, flags=self._test_instance.test_arguments, | 332 test, device, flags=self._test_instance.test_arguments, |
329 timeout=timeout, retries=0) | 333 timeout=timeout, retries=0) |
(...skipping 14 matching lines...) Expand all Loading... | |
344 def TearDown(self): | 348 def TearDown(self): |
345 @local_device_test_run.handle_shard_failures | 349 @local_device_test_run.handle_shard_failures |
346 def individual_device_tear_down(dev): | 350 def individual_device_tear_down(dev): |
347 for s in self._servers.get(str(dev), []): | 351 for s in self._servers.get(str(dev), []): |
348 s.TearDown() | 352 s.TearDown() |
349 | 353 |
350 tool = self.GetTool(dev) | 354 tool = self.GetTool(dev) |
351 tool.CleanUpEnvironment() | 355 tool.CleanUpEnvironment() |
352 | 356 |
353 self._env.parallel_devices.pMap(individual_device_tear_down) | 357 self._env.parallel_devices.pMap(individual_device_tear_down) |
OLD | NEW |