| 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 | 6 |
| 7 import fnmatch | 7 import fnmatch |
| 8 import glob | 8 import glob |
| 9 import logging | 9 import logging |
| 10 import os | 10 import os |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 'system_wrappers_unittests': | 54 'system_wrappers_unittests': |
| 55 'system_wrappers/source/system_wrappers_unittests.isolate', | 55 'system_wrappers/source/system_wrappers_unittests.isolate', |
| 56 'test_support_unittests': 'test/test_support_unittests.isolate', | 56 'test_support_unittests': 'test/test_support_unittests.isolate', |
| 57 'tools_unittests': 'tools/tools_unittests.isolate', | 57 'tools_unittests': 'tools/tools_unittests.isolate', |
| 58 'video_engine_core_unittests': | 58 'video_engine_core_unittests': |
| 59 'video_engine/video_engine_core_unittests.isolate', | 59 'video_engine/video_engine_core_unittests.isolate', |
| 60 'voice_engine_unittests': 'voice_engine/voice_engine_unittests.isolate', | 60 'voice_engine_unittests': 'voice_engine/voice_engine_unittests.isolate', |
| 61 } | 61 } |
| 62 | 62 |
| 63 # Append the WebRTC tests with the full path from Chromium's src/ root. | 63 # Append the WebRTC tests with the full path from Chromium's src/ root. |
| 64 for test,isolate_path in _WEBRTC_ISOLATE_FILE_PATHS.items(): | 64 for test, isolate_path in _WEBRTC_ISOLATE_FILE_PATHS.items(): |
| 65 _ISOLATE_FILE_PATHS[test] = 'third_party/webrtc/%s' % isolate_path | 65 _ISOLATE_FILE_PATHS[test] = 'third_party/webrtc/%s' % isolate_path |
| 66 | 66 |
| 67 # Used for filtering large data deps at a finer grain than what's allowed in | 67 # Used for filtering large data deps at a finer grain than what's allowed in |
| 68 # isolate files since pushing deps to devices is expensive. | 68 # isolate files since pushing deps to devices is expensive. |
| 69 # Wildcards are allowed. | 69 # Wildcards are allowed. |
| 70 _DEPS_EXCLUSION_LIST = [ | 70 _DEPS_EXCLUSION_LIST = [ |
| 71 'chrome/test/data/extensions/api_test', | 71 'chrome/test/data/extensions/api_test', |
| 72 'chrome/test/data/extensions/secure_shell', | 72 'chrome/test/data/extensions/secure_shell', |
| 73 'chrome/test/data/firefox*', | 73 'chrome/test/data/firefox*', |
| 74 'chrome/test/data/gpu', | 74 'chrome/test/data/gpu', |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 | 204 |
| 205 Returns: | 205 Returns: |
| 206 All the tests in the test suite. | 206 All the tests in the test suite. |
| 207 """ | 207 """ |
| 208 for device in devices: | 208 for device in devices: |
| 209 try: | 209 try: |
| 210 logging.info('Obtaining tests from %s', device) | 210 logging.info('Obtaining tests from %s', device) |
| 211 return runner_factory(device, 0).GetAllTests() | 211 return runner_factory(device, 0).GetAllTests() |
| 212 except (android_commands.errors.WaitForResponseTimedOutError, | 212 except (android_commands.errors.WaitForResponseTimedOutError, |
| 213 android_commands.errors.DeviceUnresponsiveError), e: | 213 android_commands.errors.DeviceUnresponsiveError), e: |
| 214 logging.warning('Failed obtaining tests from %s with exception: %s', | 214 logging.warning('Failed obtaining test list from %s with exception: %s', |
| 215 device, e) | 215 device, e) |
| 216 raise Exception('No device available to get the list of tests.') | 216 raise Exception('Failed to obtain test list from devices.') |
| 217 | 217 |
| 218 | 218 |
| 219 def _FilterTestsUsingPrefixes(all_tests, pre=False, manual=False): | 219 def _FilterTestsUsingPrefixes(all_tests, pre=False, manual=False): |
| 220 """Removes tests with disabled prefixes. | 220 """Removes tests with disabled prefixes. |
| 221 | 221 |
| 222 Args: | 222 Args: |
| 223 all_tests: List of tests to filter. | 223 all_tests: List of tests to filter. |
| 224 pre: If True, include tests with PRE_ prefix. | 224 pre: If True, include tests with PRE_ prefix. |
| 225 manual: If True, include tests with MANUAL_ prefix. | 225 manual: If True, include tests with MANUAL_ prefix. |
| 226 | 226 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 if test_options.gtest_filter: | 311 if test_options.gtest_filter: |
| 312 tests = unittest_util.FilterTestNames(tests, test_options.gtest_filter) | 312 tests = unittest_util.FilterTestNames(tests, test_options.gtest_filter) |
| 313 | 313 |
| 314 # Coalesce unit tests into a single test per device | 314 # Coalesce unit tests into a single test per device |
| 315 if test_options.suite_name != 'content_browsertests': | 315 if test_options.suite_name != 'content_browsertests': |
| 316 num_devices = len(devices) | 316 num_devices = len(devices) |
| 317 tests = [':'.join(tests[i::num_devices]) for i in xrange(num_devices)] | 317 tests = [':'.join(tests[i::num_devices]) for i in xrange(num_devices)] |
| 318 tests = [t for t in tests if t] | 318 tests = [t for t in tests if t] |
| 319 | 319 |
| 320 return (TestRunnerFactory, tests) | 320 return (TestRunnerFactory, tests) |
| OLD | NEW |