| 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 import copy | 5 import copy |
| 6 import fnmatch | 6 import fnmatch |
| 7 import logging | 7 import logging |
| 8 import os | 8 import os |
| 9 | 9 |
| 10 from pylib import android_commands | 10 from pylib import android_commands |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 devices: list of devices. | 84 devices: list of devices. |
| 85 | 85 |
| 86 Returns: | 86 Returns: |
| 87 List of all enabled tests. | 87 List of all enabled tests. |
| 88 | 88 |
| 89 Raises Exception if all devices failed. | 89 Raises Exception if all devices failed. |
| 90 """ | 90 """ |
| 91 for device in devices: | 91 for device in devices: |
| 92 try: | 92 try: |
| 93 logging.info('Obtaining tests from %s', device) | 93 logging.info('Obtaining tests from %s', device) |
| 94 runner = runner_factory(device) | 94 runner = runner_factory(device, 0) |
| 95 return GetTestsFromDevice(runner) | 95 return GetTestsFromDevice(runner) |
| 96 except Exception as e: | 96 except Exception as e: |
| 97 logging.warning('Failed obtaining tests from %s with exception: %s', | 97 logging.warning('Failed obtaining tests from %s with exception: %s', |
| 98 device, e) | 98 device, e) |
| 99 raise Exception('No device available to get the list of tests.') | 99 raise Exception('No device available to get the list of tests.') |
| 100 | 100 |
| 101 | 101 |
| 102 def _RunATestSuite(options, suite_name): | 102 def _RunATestSuite(options, suite_name): |
| 103 """Run a single test suite. | 103 """Run a single test suite. |
| 104 | 104 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 129 if not attached_devices: | 129 if not attached_devices: |
| 130 logging.critical('A device must be attached and online.') | 130 logging.critical('A device must be attached and online.') |
| 131 return 1 | 131 return 1 |
| 132 | 132 |
| 133 # Reset the test port allocation. It's important to do it before starting | 133 # Reset the test port allocation. It's important to do it before starting |
| 134 # to dispatch any tests. | 134 # to dispatch any tests. |
| 135 if not ports.ResetTestServerPortAllocation(): | 135 if not ports.ResetTestServerPortAllocation(): |
| 136 raise Exception('Failed to reset test server port.') | 136 raise Exception('Failed to reset test server port.') |
| 137 | 137 |
| 138 # Constructs a new TestRunner with the current options. | 138 # Constructs a new TestRunner with the current options. |
| 139 def RunnerFactory(device): | 139 def RunnerFactory(device, shard_index): |
| 140 return test_runner.TestRunner( | 140 return test_runner.TestRunner( |
| 141 device, | 141 device, |
| 142 options.test_suite, | 142 options.test_suite, |
| 143 options.test_arguments, | 143 options.test_arguments, |
| 144 options.timeout, | 144 options.timeout, |
| 145 options.cleanup_test_files, | 145 options.cleanup_test_files, |
| 146 options.tool, | 146 options.tool, |
| 147 options.build_type, | 147 options.build_type, |
| 148 options.webkit, | 148 options.webkit, |
| 149 constants.GTEST_TEST_PACKAGE_NAME, | 149 constants.GTEST_TEST_PACKAGE_NAME, |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 failures = 0 | 208 failures = 0 |
| 209 for suite_name, suite_path in all_test_suites: | 209 for suite_name, suite_path in all_test_suites: |
| 210 # Give each test suite its own copy of options. | 210 # Give each test suite its own copy of options. |
| 211 test_options = copy.deepcopy(options) | 211 test_options = copy.deepcopy(options) |
| 212 test_options.test_suite = suite_path | 212 test_options.test_suite = suite_path |
| 213 failures += _RunATestSuite(test_options, suite_name) | 213 failures += _RunATestSuite(test_options, suite_name) |
| 214 | 214 |
| 215 if options.use_xvfb: | 215 if options.use_xvfb: |
| 216 framebuffer.Stop() | 216 framebuffer.Stop() |
| 217 return failures | 217 return failures |
| OLD | NEW |