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 logging | 7 import logging |
8 import os | 8 import os |
9 import posixpath | 9 import posixpath |
10 import time | 10 import time |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 @local_device_environment.handle_shard_failures_with( | 352 @local_device_environment.handle_shard_failures_with( |
353 on_failure=self._env.BlacklistDevice) | 353 on_failure=self._env.BlacklistDevice) |
354 def list_tests(dev): | 354 def list_tests(dev): |
355 raw_test_list = self._delegate.Run( | 355 raw_test_list = self._delegate.Run( |
356 None, dev, flags='--gtest_list_tests', timeout=30) | 356 None, dev, flags='--gtest_list_tests', timeout=30) |
357 tests = gtest_test_instance.ParseGTestListTests(raw_test_list) | 357 tests = gtest_test_instance.ParseGTestListTests(raw_test_list) |
358 if not tests: | 358 if not tests: |
359 logging.info('No tests found. Output:') | 359 logging.info('No tests found. Output:') |
360 for l in raw_test_list: | 360 for l in raw_test_list: |
361 logging.info(' %s', l) | 361 logging.info(' %s', l) |
362 tests = self._test_instance.FilterTests(tests) | |
363 return tests | 362 return tests |
364 | 363 |
365 # Query all devices in case one fails. | 364 # Query all devices in case one fails. |
366 test_lists = self._env.parallel_devices.pMap(list_tests).pGet(None) | 365 test_lists = self._env.parallel_devices.pMap(list_tests).pGet(None) |
367 | 366 |
368 # If all devices failed to list tests, raise an exception. | 367 # If all devices failed to list tests, raise an exception. |
369 # Check that tl is not None and is not empty. | 368 # Check that tl is not None and is not empty. |
370 if all(not tl for tl in test_lists): | 369 if all(not tl for tl in test_lists): |
371 raise device_errors.CommandFailedError( | 370 raise device_errors.CommandFailedError( |
372 'Failed to list tests on any device') | 371 'Failed to list tests on any device') |
373 return list(sorted(set().union(*[set(tl) for tl in test_lists if tl]))) | 372 tests = list(sorted(set().union(*[set(tl) for tl in test_lists if tl]))) |
| 373 tests = self._test_instance.FilterTests(tests) |
| 374 tests = self._ApplyExternalSharding( |
| 375 tests, self._test_instance.external_shard_index, |
| 376 self._test_instance.total_external_shards) |
| 377 return tests |
374 | 378 |
375 #override | 379 #override |
376 def _RunTest(self, device, test): | 380 def _RunTest(self, device, test): |
377 # Run the test. | 381 # Run the test. |
378 timeout = (self._test_instance.shard_timeout | 382 timeout = (self._test_instance.shard_timeout |
379 * self.GetTool(device).GetTimeoutScale()) | 383 * self.GetTool(device).GetTimeoutScale()) |
380 if self._test_instance.store_tombstones: | 384 if self._test_instance.store_tombstones: |
381 tombstones.ClearAllTombstones(device) | 385 tombstones.ClearAllTombstones(device) |
382 with device_temp_file.DeviceTempFile( | 386 with device_temp_file.DeviceTempFile( |
383 adb=device.adb, | 387 adb=device.adb, |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 @local_device_environment.handle_shard_failures | 450 @local_device_environment.handle_shard_failures |
447 @trace_event.traced | 451 @trace_event.traced |
448 def individual_device_tear_down(dev): | 452 def individual_device_tear_down(dev): |
449 for s in self._servers.get(str(dev), []): | 453 for s in self._servers.get(str(dev), []): |
450 s.TearDown() | 454 s.TearDown() |
451 | 455 |
452 tool = self.GetTool(dev) | 456 tool = self.GetTool(dev) |
453 tool.CleanUpEnvironment() | 457 tool.CleanUpEnvironment() |
454 | 458 |
455 self._env.parallel_devices.pMap(individual_device_tear_down) | 459 self._env.parallel_devices.pMap(individual_device_tear_down) |
OLD | NEW |