Chromium Code Reviews| 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 |
| 11 import os | 11 import os |
| 12 import shutil | 12 import shutil |
| 13 import sys | 13 import sys |
| 14 | 14 |
| 15 from pylib import android_commands | |
| 16 from pylib import cmd_helper | 15 from pylib import cmd_helper |
| 17 from pylib import constants | 16 from pylib import constants |
| 18 | 17 from pylib.device import adb_wrapper |
| 19 from pylib.gtest import test_package_apk | 18 from pylib.gtest import test_package_apk |
| 20 from pylib.gtest import test_package_exe | 19 from pylib.gtest import test_package_exe |
| 21 from pylib.gtest import test_runner | 20 from pylib.gtest import test_runner |
| 22 | 21 |
| 23 sys.path.insert(0, | 22 sys.path.insert(0, |
| 24 os.path.join(constants.DIR_SOURCE_ROOT, 'build', 'util', 'lib', | 23 os.path.join(constants.DIR_SOURCE_ROOT, 'build', 'util', 'lib', |
| 25 'common')) | 24 'common')) |
| 26 import unittest_util # pylint: disable=F0401 | 25 import unittest_util # pylint: disable=F0401 |
| 27 | 26 |
| 28 | 27 |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 212 a TestRunner. | 211 a TestRunner. |
| 213 devices: A list of device ids. | 212 devices: A list of device ids. |
| 214 | 213 |
| 215 Returns: | 214 Returns: |
| 216 All the tests in the test suite. | 215 All the tests in the test suite. |
| 217 """ | 216 """ |
| 218 for device in devices: | 217 for device in devices: |
| 219 try: | 218 try: |
| 220 logging.info('Obtaining tests from %s', device) | 219 logging.info('Obtaining tests from %s', device) |
| 221 return runner_factory(device, 0).GetAllTests() | 220 return runner_factory(device, 0).GetAllTests() |
| 222 except (android_commands.errors.WaitForResponseTimedOutError, | 221 except (adb_wrapper.CommandTimeoutError, |
|
craigdh
2014/04/09 15:55:02
doesn't this need rebasing? I thought you changed
| |
| 223 android_commands.errors.DeviceUnresponsiveError), e: | 222 adb_wrapper.DeviceUnreachableError), e: |
| 224 logging.warning('Failed obtaining test list from %s with exception: %s', | 223 logging.warning('Failed obtaining test list from %s with exception: %s', |
| 225 device, e) | 224 device, e) |
| 226 raise Exception('Failed to obtain test list from devices.') | 225 raise Exception('Failed to obtain test list from devices.') |
| 227 | 226 |
| 228 | 227 |
| 229 def _FilterTestsUsingPrefixes(all_tests, pre=False, manual=False): | 228 def _FilterTestsUsingPrefixes(all_tests, pre=False, manual=False): |
| 230 """Removes tests with disabled prefixes. | 229 """Removes tests with disabled prefixes. |
| 231 | 230 |
| 232 Args: | 231 Args: |
| 233 all_tests: List of tests to filter. | 232 all_tests: List of tests to filter. |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 317 if test_options.gtest_filter: | 316 if test_options.gtest_filter: |
| 318 tests = unittest_util.FilterTestNames(tests, test_options.gtest_filter) | 317 tests = unittest_util.FilterTestNames(tests, test_options.gtest_filter) |
| 319 | 318 |
| 320 # Coalesce unit tests into a single test per device | 319 # Coalesce unit tests into a single test per device |
| 321 if test_options.suite_name != 'content_browsertests': | 320 if test_options.suite_name != 'content_browsertests': |
| 322 num_devices = len(devices) | 321 num_devices = len(devices) |
| 323 tests = [':'.join(tests[i::num_devices]) for i in xrange(num_devices)] | 322 tests = [':'.join(tests[i::num_devices]) for i in xrange(num_devices)] |
| 324 tests = [t for t in tests if t] | 323 tests = [t for t in tests if t] |
| 325 | 324 |
| 326 return (TestRunnerFactory, tests) | 325 return (TestRunnerFactory, tests) |
| OLD | NEW |