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 logging | 5 import logging |
6 import os | 6 import os |
| 7 import sys |
7 | 8 |
8 from pylib import android_commands | 9 from pylib import android_commands |
9 from pylib import cmd_helper | 10 from pylib import cmd_helper |
10 from pylib import constants | 11 from pylib import constants |
11 from pylib import ports | 12 from pylib import ports |
12 from pylib.base import shard | 13 from pylib.base import shard |
13 from pylib.gtest import dispatch as gtest_dispatch | 14 from pylib.gtest import dispatch as gtest_dispatch |
14 from pylib.gtest import test_runner | 15 from pylib.gtest import test_runner |
15 from pylib.utils import report_results | 16 from pylib.utils import report_results |
16 | 17 |
| 18 sys.path.append(os.path.join(constants.DIR_SOURCE_ROOT, 'build', 'util', 'lib')) |
17 | 19 |
| 20 from common import unittest_util |
18 | 21 |
19 def Dispatch(options): | 22 def Dispatch(options): |
20 attached_devices = [] | 23 attached_devices = [] |
21 if options.test_device: | 24 if options.test_device: |
22 attached_devices = [options.test_device] | 25 attached_devices = [options.test_device] |
23 else: | 26 else: |
24 attached_devices = android_commands.GetAttachedDevices() | 27 attached_devices = android_commands.GetAttachedDevices() |
25 | 28 |
26 if not attached_devices: | 29 if not attached_devices: |
27 logging.critical('A device must be attached and online.') | 30 logging.critical('A device must be attached and online.') |
(...skipping 18 matching lines...) Expand all Loading... |
46 options.test_arguments, | 49 options.test_arguments, |
47 options.timeout, | 50 options.timeout, |
48 options.cleanup_test_files, | 51 options.cleanup_test_files, |
49 options.tool, | 52 options.tool, |
50 options.build_type, | 53 options.build_type, |
51 options.webkit, | 54 options.webkit, |
52 constants.BROWSERTEST_TEST_PACKAGE_NAME, | 55 constants.BROWSERTEST_TEST_PACKAGE_NAME, |
53 constants.BROWSERTEST_TEST_ACTIVITY_NAME, | 56 constants.BROWSERTEST_TEST_ACTIVITY_NAME, |
54 constants.BROWSERTEST_COMMAND_LINE_FILE) | 57 constants.BROWSERTEST_COMMAND_LINE_FILE) |
55 | 58 |
56 # Get tests and split them up based on the number of devices. | 59 # Get tests and split them up based on the number of devices. |
| 60 all_enabled = gtest_dispatch.GetAllEnabledTests(RunnerFactory, |
| 61 attached_devices) |
57 if options.gtest_filter: | 62 if options.gtest_filter: |
58 all_tests = [t for t in options.gtest_filter.split(':') if t] | 63 all_tests = unittest_util.FilterTestNames(all_enabled, |
| 64 options.gtest_filter) |
59 else: | 65 else: |
60 all_enabled = gtest_dispatch.GetAllEnabledTests(RunnerFactory, | |
61 attached_devices) | |
62 all_tests = _FilterTests(all_enabled) | 66 all_tests = _FilterTests(all_enabled) |
63 | 67 |
64 # Run tests. | 68 # Run tests. |
65 # TODO(nileshagrawal): remove this abnormally long setup timeout once fewer | 69 # TODO(nileshagrawal): remove this abnormally long setup timeout once fewer |
66 # files are pushed to the devices for content_browsertests: crbug.com/138275 | 70 # files are pushed to the devices for content_browsertests: crbug.com/138275 |
67 setup_timeout = 20 * 60 # 20 minutes | 71 setup_timeout = 20 * 60 # 20 minutes |
68 test_results = shard.ShardAndRunTests(RunnerFactory, attached_devices, | 72 test_results = shard.ShardAndRunTests(RunnerFactory, attached_devices, |
69 all_tests, options.build_type, | 73 all_tests, options.build_type, |
70 setup_timeout=setup_timeout, | 74 setup_timeout=setup_timeout, |
71 test_timeout=None, | 75 test_timeout=None, |
(...skipping 13 matching lines...) Expand all Loading... |
85 def _ShouldRunOnBot(test): | 89 def _ShouldRunOnBot(test): |
86 fixture, case = test.split('.', 1) | 90 fixture, case = test.split('.', 1) |
87 if _StartsWith(fixture, case, "PRE_"): | 91 if _StartsWith(fixture, case, "PRE_"): |
88 return False | 92 return False |
89 if _StartsWith(fixture, case, "MANUAL_"): | 93 if _StartsWith(fixture, case, "MANUAL_"): |
90 return False | 94 return False |
91 return True | 95 return True |
92 | 96 |
93 def _StartsWith(a, b, prefix): | 97 def _StartsWith(a, b, prefix): |
94 return a.startswith(prefix) or b.startswith(prefix) | 98 return a.startswith(prefix) or b.startswith(prefix) |
OLD | NEW |