OLD | NEW |
1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 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 """Dispatches tests, either sharding or replicating them. | 5 """Dispatches tests, either sharding or replicating them. |
6 | 6 |
7 To dispatch, performs the following steps: | 7 To dispatch, performs the following steps: |
8 * Create a test collection factory, using the given tests | 8 * Create a test collection factory, using the given tests |
9 - If sharding: test collection factory returns the same shared test collection | 9 - If sharding: test collection factory returns the same shared test collection |
10 to all test runners | 10 to all test runners |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 if test_device: | 323 if test_device: |
324 assert test_device in attached_devices, ( | 324 assert test_device in attached_devices, ( |
325 'Did not find device %s among attached device. Attached devices: %s' | 325 'Did not find device %s among attached device. Attached devices: %s' |
326 % (test_device, ', '.join(attached_devices))) | 326 % (test_device, ', '.join(attached_devices))) |
327 attached_devices = [test_device] | 327 attached_devices = [test_device] |
328 | 328 |
329 if len(attached_devices) > 1 and wait_for_debugger: | 329 if len(attached_devices) > 1 and wait_for_debugger: |
330 logging.warning('Debugger can not be sharded, using first available device') | 330 logging.warning('Debugger can not be sharded, using first available device') |
331 attached_devices = attached_devices[:1] | 331 attached_devices = attached_devices[:1] |
332 | 332 |
333 return attached_devices | 333 return sorted(attached_devices) |
334 | 334 |
335 | 335 |
336 def RunTests(tests, runner_factory, wait_for_debugger, test_device, | 336 def RunTests(tests, runner_factory, wait_for_debugger, test_device, |
337 shard=True, | 337 shard=True, |
338 build_type='Debug', | 338 build_type='Debug', |
339 test_timeout=DEFAULT_TIMEOUT, | 339 test_timeout=DEFAULT_TIMEOUT, |
340 setup_timeout=DEFAULT_TIMEOUT, | 340 setup_timeout=DEFAULT_TIMEOUT, |
341 num_retries=2): | 341 num_retries=2): |
342 """Run all tests on attached devices, retrying tests that don't pass. | 342 """Run all tests on attached devices, retrying tests that don't pass. |
343 | 343 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 logging.info('Will run %d tests (%s): %s', len(tests), log_string, str(tests)) | 384 logging.info('Will run %d tests (%s): %s', len(tests), log_string, str(tests)) |
385 runners = _CreateRunners(runner_factory, devices, setup_timeout) | 385 runners = _CreateRunners(runner_factory, devices, setup_timeout) |
386 try: | 386 try: |
387 return _RunAllTests(runners, test_collection_factory, | 387 return _RunAllTests(runners, test_collection_factory, |
388 num_retries, test_timeout, tag_results_with_device) | 388 num_retries, test_timeout, tag_results_with_device) |
389 finally: | 389 finally: |
390 try: | 390 try: |
391 _TearDownRunners(runners, setup_timeout) | 391 _TearDownRunners(runners, setup_timeout) |
392 except android_commands.errors.DeviceUnresponsiveError as e: | 392 except android_commands.errors.DeviceUnresponsiveError as e: |
393 logging.warning('Device unresponsive during TearDown: [%s]', e) | 393 logging.warning('Device unresponsive during TearDown: [%s]', e) |
OLD | NEW |