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 | |
319 # If all devices failed to list_tests, raise an exception. | |
320 check_one_device_failed = lambda result: result == None | |
321 check_both_devices_failed = lambda device_x_failed, device_y_failed: device_ x_failed and device_y_failed | |
322 if reduce(check_both_devices_failed, map(check_one_device_failed, test_lists )): | |
mikecase (-- gone --)
2016/02/19 19:03:42
You could just do "if all(map(check_one_device_fai
BigBossZhiling
2016/02/19 22:13:47
Done.
| |
323 # Now we know that all devices failed to do list_tests. | |
324 raise Exception('Failed to list tests on all devices') | |
mikecase (-- gone --)
2016/02/19 19:03:42
Look around in devil/android/device_errors.py for
BigBossZhiling
2016/02/19 22:13:47
Done.
| |
325 | |
318 # TODO(agrieve): Make this fail rather than return an empty list when | 326 # TODO(agrieve): Make this fail rather than return an empty list when |
319 # all devices fail. | 327 # all devices fail. |
mikecase (-- gone --)
2016/02/19 19:03:42
nit: Remove this TODO.
| |
320 return list(sorted(set().union(*[set(tl) for tl in test_lists if tl]))) | 328 return list(sorted(set().union(*[set(tl) for tl in test_lists if tl]))) |
321 | 329 |
322 #override | 330 #override |
323 def _RunTest(self, device, test): | 331 def _RunTest(self, device, test): |
324 # Run the test. | 332 # Run the test. |
325 timeout = (self._test_instance.shard_timeout | 333 timeout = (self._test_instance.shard_timeout |
326 * self.GetTool(device).GetTimeoutScale()) | 334 * self.GetTool(device).GetTimeoutScale()) |
327 output = self._delegate.Run( | 335 output = self._delegate.Run( |
328 test, device, flags=self._test_instance.test_arguments, | 336 test, device, flags=self._test_instance.test_arguments, |
329 timeout=timeout, retries=0) | 337 timeout=timeout, retries=0) |
(...skipping 14 matching lines...) Expand all Loading... | |
344 def TearDown(self): | 352 def TearDown(self): |
345 @local_device_test_run.handle_shard_failures | 353 @local_device_test_run.handle_shard_failures |
346 def individual_device_tear_down(dev): | 354 def individual_device_tear_down(dev): |
347 for s in self._servers.get(str(dev), []): | 355 for s in self._servers.get(str(dev), []): |
348 s.TearDown() | 356 s.TearDown() |
349 | 357 |
350 tool = self.GetTool(dev) | 358 tool = self.GetTool(dev) |
351 tool.CleanUpEnvironment() | 359 tool.CleanUpEnvironment() |
352 | 360 |
353 self._env.parallel_devices.pMap(individual_device_tear_down) | 361 self._env.parallel_devices.pMap(individual_device_tear_down) |
OLD | NEW |