| OLD | NEW |
| 1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2013 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 """Implements test sharding logic.""" | 5 """Implements test sharding logic.""" |
| 6 | 6 |
| 7 import logging | 7 import logging |
| 8 import threading | 8 import threading |
| 9 | 9 |
| 10 from pylib import android_commands | 10 from pylib import android_commands |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 build_type: either 'Debug' or 'Release'. | 275 build_type: either 'Debug' or 'Release'. |
| 276 test_timeout: watchdog timeout in seconds for running tests, defaults to the | 276 test_timeout: watchdog timeout in seconds for running tests, defaults to the |
| 277 default timeout. | 277 default timeout. |
| 278 setup_timeout: watchdog timeout in seconds for creating and cleaning up | 278 setup_timeout: watchdog timeout in seconds for creating and cleaning up |
| 279 test runners, defaults to the default timeout. | 279 test runners, defaults to the default timeout. |
| 280 num_retries: number of retries for a test. | 280 num_retries: number of retries for a test. |
| 281 | 281 |
| 282 Returns: | 282 Returns: |
| 283 A base_test_result.TestRunResults object. | 283 A base_test_result.TestRunResults object. |
| 284 """ | 284 """ |
| 285 if not tests: |
| 286 logging.warning('No tests to run.') |
| 287 return base_test_result.TestRunResults() |
| 288 |
| 285 logging.info('Will run %d tests: %s', len(tests), str(tests)) | 289 logging.info('Will run %d tests: %s', len(tests), str(tests)) |
| 286 forwarder.Forwarder.KillHost(build_type) | 290 forwarder.Forwarder.KillHost(build_type) |
| 287 runners = _CreateRunners(runner_factory, devices, setup_timeout) | 291 runners = _CreateRunners(runner_factory, devices, setup_timeout) |
| 288 try: | 292 try: |
| 289 return _RunAllTests(runners, tests, num_retries, test_timeout) | 293 return _RunAllTests(runners, tests, num_retries, test_timeout) |
| 290 finally: | 294 finally: |
| 291 try: | 295 try: |
| 292 _TearDownRunners(runners, setup_timeout) | 296 _TearDownRunners(runners, setup_timeout) |
| 293 except android_commands.errors.DeviceUnresponsiveError as e: | 297 except android_commands.errors.DeviceUnresponsiveError as e: |
| 294 logging.warning('Device unresponsive during TearDown: [%s]', e) | 298 logging.warning('Device unresponsive during TearDown: [%s]', e) |
| 295 finally: | 299 finally: |
| 296 forwarder.Forwarder.KillHost(build_type) | 300 forwarder.Forwarder.KillHost(build_type) |
| OLD | NEW |