| 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 os | 8 import os |
| 8 import posixpath | 9 import posixpath |
| 9 | 10 |
| 10 from devil.android import device_errors | 11 from devil.android import device_errors |
| 11 from devil.android import device_temp_file | 12 from devil.android import device_temp_file |
| 12 from devil.android import ports | 13 from devil.android import ports |
| 13 from devil.utils import reraiser_thread | 14 from devil.utils import reraiser_thread |
| 14 from pylib import constants | 15 from pylib import constants |
| 15 from pylib.base import base_test_result | 16 from pylib.base import base_test_result |
| 16 from pylib.gtest import gtest_test_instance | 17 from pylib.gtest import gtest_test_instance |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 tests = _ExtractTestsFromFilter(self._test_instance.gtest_filter) | 305 tests = _ExtractTestsFromFilter(self._test_instance.gtest_filter) |
| 305 if tests: | 306 if tests: |
| 306 return tests | 307 return tests |
| 307 | 308 |
| 308 # Even when there's only one device, it still makes sense to retrieve the | 309 # Even when there's only one device, it still makes sense to retrieve the |
| 309 # test list so that tests can be split up and run in batches rather than all | 310 # test list so that tests can be split up and run in batches rather than all |
| 310 # at once (since test output is not streamed). | 311 # at once (since test output is not streamed). |
| 311 @local_device_test_run.handle_shard_failures_with( | 312 @local_device_test_run.handle_shard_failures_with( |
| 312 on_failure=self._env.BlacklistDevice) | 313 on_failure=self._env.BlacklistDevice) |
| 313 def list_tests(dev): | 314 def list_tests(dev): |
| 314 tests = self._delegate.Run( | 315 raw_test_list = self._delegate.Run( |
| 315 None, dev, flags='--gtest_list_tests', timeout=30) | 316 None, dev, flags='--gtest_list_tests', timeout=30) |
| 316 tests = gtest_test_instance.ParseGTestListTests(tests) | 317 tests = gtest_test_instance.ParseGTestListTests(raw_test_list) |
| 318 if not tests: |
| 319 logging.info('No tests found. Output:') |
| 320 for l in raw_test_list: |
| 321 logging.info(' %s', l) |
| 317 tests = self._test_instance.FilterTests(tests) | 322 tests = self._test_instance.FilterTests(tests) |
| 318 return tests | 323 return tests |
| 319 | 324 |
| 320 # Query all devices in case one fails. | 325 # Query all devices in case one fails. |
| 321 test_lists = self._env.parallel_devices.pMap(list_tests).pGet(None) | 326 test_lists = self._env.parallel_devices.pMap(list_tests).pGet(None) |
| 322 | 327 |
| 323 # If all devices failed to list tests, raise an exception. | 328 # If all devices failed to list tests, raise an exception. |
| 324 # Check that tl is not None and is not empty. | 329 # Check that tl is not None and is not empty. |
| 325 if all(not tl for tl in test_lists): | 330 if all(not tl for tl in test_lists): |
| 326 raise device_errors.CommandFailedError( | 331 raise device_errors.CommandFailedError( |
| (...skipping 29 matching lines...) Expand all Loading... |
| 356 def TearDown(self): | 361 def TearDown(self): |
| 357 @local_device_test_run.handle_shard_failures | 362 @local_device_test_run.handle_shard_failures |
| 358 def individual_device_tear_down(dev): | 363 def individual_device_tear_down(dev): |
| 359 for s in self._servers.get(str(dev), []): | 364 for s in self._servers.get(str(dev), []): |
| 360 s.TearDown() | 365 s.TearDown() |
| 361 | 366 |
| 362 tool = self.GetTool(dev) | 367 tool = self.GetTool(dev) |
| 363 tool.CleanUpEnvironment() | 368 tool.CleanUpEnvironment() |
| 364 | 369 |
| 365 self._env.parallel_devices.pMap(individual_device_tear_down) | 370 self._env.parallel_devices.pMap(individual_device_tear_down) |
| OLD | NEW |