| 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 """Generates test runner factory and tests for GTests.""" | 5 """Generates test runner factory and tests for GTests.""" |
| 6 # pylint: disable=W0212 | 6 # pylint: disable=W0212 |
| 7 | 7 |
| 8 import fnmatch | 8 import fnmatch |
| 9 import glob | 9 import glob |
| 10 import logging | 10 import logging |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 | 287 |
| 288 Args: | 288 Args: |
| 289 test_options: A GTestOptions object. | 289 test_options: A GTestOptions object. |
| 290 devices: A list of attached devices. | 290 devices: A list of attached devices. |
| 291 | 291 |
| 292 Returns: | 292 Returns: |
| 293 A tuple of (TestRunnerFactory, tests). | 293 A tuple of (TestRunnerFactory, tests). |
| 294 """ | 294 """ |
| 295 test_package = test_package_apk.TestPackageApk(test_options.suite_name) | 295 test_package = test_package_apk.TestPackageApk(test_options.suite_name) |
| 296 if not os.path.exists(test_package.suite_path): | 296 if not os.path.exists(test_package.suite_path): |
| 297 test_package = test_package_exe.TestPackageExecutable( | 297 exe_test_package = test_package_exe.TestPackageExecutable( |
| 298 test_options.suite_name) | 298 test_options.suite_name) |
| 299 if not os.path.exists(test_package.suite_path): | 299 if not os.path.exists(exe_test_package.suite_path): |
| 300 raise Exception( | 300 raise Exception( |
| 301 'Did not find %s target. Ensure it has been built.' | 301 'Did not find %s target. Ensure it has been built.\n' |
| 302 % test_options.suite_name) | 302 '(not found at %s or %s)' |
| 303 % (test_options.suite_name, |
| 304 test_package.suite_path, |
| 305 exe_test_package.suite_path)) |
| 306 test_package = exe_test_package |
| 303 logging.warning('Found target %s', test_package.suite_path) | 307 logging.warning('Found target %s', test_package.suite_path) |
| 304 | 308 |
| 305 _GenerateDepsDirUsingIsolate(test_options.suite_name, | 309 _GenerateDepsDirUsingIsolate(test_options.suite_name, |
| 306 test_options.isolate_file_path) | 310 test_options.isolate_file_path) |
| 307 | 311 |
| 308 tests = _GetTests(test_options, test_package, devices) | 312 tests = _GetTests(test_options, test_package, devices) |
| 309 | 313 |
| 310 # Constructs a new TestRunner with the current options. | 314 # Constructs a new TestRunner with the current options. |
| 311 def TestRunnerFactory(device, _shard_index): | 315 def TestRunnerFactory(device, _shard_index): |
| 312 return test_runner.TestRunner( | 316 return test_runner.TestRunner( |
| (...skipping 11 matching lines...) Expand all Loading... |
| 324 if test_options.gtest_filter: | 328 if test_options.gtest_filter: |
| 325 tests = unittest_util.FilterTestNames(tests, test_options.gtest_filter) | 329 tests = unittest_util.FilterTestNames(tests, test_options.gtest_filter) |
| 326 | 330 |
| 327 # Coalesce unit tests into a single test per device | 331 # Coalesce unit tests into a single test per device |
| 328 if test_options.suite_name != 'content_browsertests': | 332 if test_options.suite_name != 'content_browsertests': |
| 329 num_devices = len(devices) | 333 num_devices = len(devices) |
| 330 tests = [':'.join(tests[i::num_devices]) for i in xrange(num_devices)] | 334 tests = [':'.join(tests[i::num_devices]) for i in xrange(num_devices)] |
| 331 tests = [t for t in tests if t] | 335 tests = [t for t in tests if t] |
| 332 | 336 |
| 333 return (TestRunnerFactory, tests) | 337 return (TestRunnerFactory, tests) |
| OLD | NEW |