OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2013 The Chromium Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 import collections | 7 import collections |
8 import copy | 8 import copy |
9 import json | 9 import json |
10 import os | 10 import os |
11 import pipes | 11 import pipes |
12 import re | 12 import re |
13 import subprocess | 13 import subprocess |
14 import sys | 14 import sys |
15 | 15 |
16 import bb_utils | 16 import bb_utils |
17 | 17 |
18 BotConfig = collections.namedtuple( | 18 BotConfig = collections.namedtuple( |
19 'BotConfig', ['bot_id', 'host_obj', 'test_obj']) | 19 'BotConfig', ['bot_id', 'host_obj', 'test_obj']) |
20 | 20 |
21 HostConfig = collections.namedtuple( | 21 HostConfig = collections.namedtuple( |
22 'HostConfig', ['host_step_args', 'extra_gyp_defines', 'target_arch']) | 22 'HostConfig', |
| 23 ['host_steps', 'extra_args', 'extra_gyp_defines', 'target_arch']) |
23 | 24 |
24 TestConfig = collections.namedtuple('Tests', ['tests', 'extra_args']) | 25 TestConfig = collections.namedtuple('Tests', ['tests', 'extra_args']) |
25 | 26 |
26 | 27 |
27 def DictDiff(d1, d2): | 28 def DictDiff(d1, d2): |
28 diff = [] | 29 diff = [] |
29 for key in sorted(set(d1.keys() + d2.keys())): | 30 for key in sorted(set(d1.keys() + d2.keys())): |
30 if key in d1 and d1[key] != d2.get(key): | 31 if key in d1 and d1[key] != d2.get(key): |
31 diff.append('- %s=%s' % (key, pipes.quote(d1[key]))) | 32 diff.append('- %s=%s' % (key, pipes.quote(d1[key]))) |
32 if key in d2 and d2[key] != d1.get(key): | 33 if key in d2 and d2[key] != d1.get(key): |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 """Get a formatted list of commands. | 78 """Get a formatted list of commands. |
78 | 79 |
79 Args: | 80 Args: |
80 options: Options object. | 81 options: Options object. |
81 bot_config: A BotConfig named tuple. | 82 bot_config: A BotConfig named tuple. |
82 Returns: | 83 Returns: |
83 list of Command objects. | 84 list of Command objects. |
84 """ | 85 """ |
85 property_args = bb_utils.EncodeProperties(options) | 86 property_args = bb_utils.EncodeProperties(options) |
86 commands = [['build/android/buildbot/bb_host_steps.py'] + | 87 commands = [['build/android/buildbot/bb_host_steps.py'] + |
87 bot_config.host_obj.host_step_args + property_args] | 88 ['--steps=%s' % ','.join(bot_config.host_obj.host_steps)] + |
| 89 property_args + (bot_config.host_obj.extra_args or [])] |
88 | 90 |
89 test_obj = bot_config.test_obj | 91 test_obj = bot_config.test_obj |
90 if test_obj: | 92 if test_obj: |
91 run_test_cmd = [ | 93 run_test_cmd = [ |
92 'build/android/buildbot/bb_device_steps.py', '--reboot'] + property_args | 94 'build/android/buildbot/bb_device_steps.py', '--reboot'] + property_args |
93 for test in test_obj.tests: | 95 for test in test_obj.tests: |
94 run_test_cmd.extend(['-f', test]) | 96 run_test_cmd.extend(['-f', test]) |
95 if test_obj.extra_args: | 97 if test_obj.extra_args: |
96 run_test_cmd.extend(test_obj.extra_args) | 98 run_test_cmd.extend(test_obj.extra_args) |
97 commands.append(run_test_cmd) | 99 commands.append(run_test_cmd) |
98 return commands | 100 return commands |
99 | 101 |
100 | 102 |
101 def GetBotStepMap(): | 103 def GetBotStepMap(): |
102 compile_opt = ['--compile'] | 104 compile_step = ['compile'] |
103 std_host_tests = ['--host-tests=check_webview_licenses,findbugs'] | 105 std_host_tests = ['check_webview_licenses', 'findbugs'] |
104 std_build_opts = ['--compile', '--zip-build'] | 106 std_build_steps = ['compile', 'zip_build'] |
105 std_test_opts = ['--extract-build'] | 107 std_test_steps = ['extract_build'] |
106 std_tests = ['ui', 'unit'] | 108 std_tests = ['ui', 'unit'] |
107 flakiness_server = '--upload-to-flakiness-server' | 109 flakiness_server = '--upload-to-flakiness-server' |
108 | 110 |
109 def B(bot_id, host_object, test_object=None): | 111 def B(bot_id, host_object, test_object=None): |
110 return BotConfig(bot_id, host_object, test_object) | 112 return BotConfig(bot_id, host_object, test_object) |
111 | 113 |
112 def T(tests, extra_args=None): | 114 def T(tests, extra_args=None): |
113 return TestConfig(tests, extra_args) | 115 return TestConfig(tests, extra_args) |
114 | 116 |
115 def H(host_step_args, extra_gyp=None, target_arch=None): | 117 def H(host_steps, extra_args=None, extra_gyp=None, target_arch=None): |
116 return HostConfig(host_step_args, extra_gyp, target_arch) | 118 return HostConfig(host_steps, extra_args, extra_gyp, target_arch) |
117 | 119 |
118 bot_configs = [ | 120 bot_configs = [ |
119 # Main builders | 121 # Main builders |
120 B('main-builder-dbg', H(std_build_opts + std_host_tests)), | 122 B('main-builder-dbg', H(std_build_steps + std_host_tests)), |
121 B('main-builder-rel', H(std_build_opts)), | 123 B('main-builder-rel', H(std_build_steps)), |
122 B('main-clang-builder', | 124 B('main-clang-builder', |
123 H(compile_opt, 'clang=1 component=shared_library')), | 125 H(compile_step, extra_gyp='clang=1 component=shared_library')), |
124 B('main-clobber', H(compile_opt)), | 126 B('main-clobber', H(compile_step)), |
125 B('main-tests', H(std_test_opts), T(std_tests, [flakiness_server])), | 127 B('main-tests', H(std_test_steps), T(std_tests, [flakiness_server])), |
126 | 128 |
127 # Other waterfalls | 129 # Other waterfalls |
128 B('asan-builder-tests', H(compile_opt, 'asan=1'), | 130 B('asan-builder-tests', H(compile_step, extra_gyp='asan=1'), |
129 T(std_tests, ['--asan'])), | 131 T(std_tests, ['--asan'])), |
130 B('chromedriver-fyi-tests-dbg', H(std_test_opts), | 132 B('chromedriver-fyi-tests-dbg', H(std_test_steps), |
131 T(['chromedriver'], ['--install=ChromiumTestShell'])), | 133 T(['chromedriver'], ['--install=ChromiumTestShell'])), |
132 B('fyi-builder-dbg', | 134 B('fyi-builder-dbg', |
133 H(std_build_opts + std_host_tests + ['--experimental'])), | 135 H(std_build_steps + std_host_tests, ['--experimental'])), |
134 B('fyi-builder-rel', H(std_build_opts + ['--experimental'])), | 136 B('fyi-builder-rel', H(std_build_steps, ['--experimental'])), |
135 B('fyi-tests-dbg-ics-gn', H(compile_opt + [ '--experimental']), | 137 B('fyi-tests-dbg-ics-gn', H(compile_step, [ '--experimental']), |
136 T(std_tests, ['--experimental', flakiness_server])), | 138 T(std_tests, ['--experimental', flakiness_server])), |
137 B('fyi-tests', H(std_test_opts), | 139 B('fyi-tests', H(std_test_steps), |
138 T(std_tests, ['--experimental', flakiness_server])), | 140 T(std_tests, ['--experimental', flakiness_server])), |
139 B('fyi-component-builder-tests-dbg', | 141 B('fyi-component-builder-tests-dbg', |
140 H(compile_opt, 'component=shared_library'), | 142 H(compile_step, extra_gyp='component=shared_library'), |
141 T(std_tests, ['--experimental', flakiness_server])), | 143 T(std_tests, ['--experimental', flakiness_server])), |
142 B('perf-bisect-builder-tests-dbg', H(['--bisect-perf-regression'])), | 144 B('perf-bisect-builder-tests-dbg', H(['bisect_perf_regression'])), |
143 B('perf-tests-rel', H(std_test_opts), T([], ['--install=ContentShell'])), | 145 B('perf-tests-rel', H(std_test_steps), T([], ['--install=ContentShell'])), |
144 B('webkit-latest-webkit-tests', H(std_test_opts), | 146 B('webkit-latest-webkit-tests', H(std_test_steps), |
145 T(['webkit_layout', 'webkit'])), | 147 T(['webkit_layout', 'webkit'])), |
146 B('webkit-latest-contentshell', H(compile_opt), T(['webkit_layout'])), | 148 B('webkit-latest-contentshell', H(compile_step), T(['webkit_layout'])), |
147 B('builder-unit-tests', H(compile_opt), T(['unit'])), | 149 B('builder-unit-tests', H(compile_step), T(['unit'])), |
148 | 150 |
149 # Generic builder config (for substring match). | 151 # Generic builder config (for substring match). |
150 B('builder', H(std_build_opts)), | 152 B('builder', H(std_build_steps)), |
151 ] | 153 ] |
152 | 154 |
153 bot_map = dict((config.bot_id, config) for config in bot_configs) | 155 bot_map = dict((config.bot_id, config) for config in bot_configs) |
154 | 156 |
155 # These bots have identical configuration to ones defined earlier. | 157 # These bots have identical configuration to ones defined earlier. |
156 copy_map = [ | 158 copy_map = [ |
157 ('lkgr-clobber', 'main-clobber'), | 159 ('lkgr-clobber', 'main-clobber'), |
158 ('try-builder-dbg', 'main-builder-dbg'), | 160 ('try-builder-dbg', 'main-builder-dbg'), |
159 ('try-builder-rel', 'main-builder-rel'), | 161 ('try-builder-rel', 'main-builder-rel'), |
160 ('try-clang-builder', 'main-clang-builder'), | 162 ('try-clang-builder', 'main-clang-builder'), |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 sys.stdout.flush() | 225 sys.stdout.flush() |
224 if options.testing: | 226 if options.testing: |
225 env['BUILDBOT_TESTING'] = '1' | 227 env['BUILDBOT_TESTING'] = '1' |
226 return_code = subprocess.call(command, cwd=bb_utils.CHROME_SRC, env=env) | 228 return_code = subprocess.call(command, cwd=bb_utils.CHROME_SRC, env=env) |
227 if return_code != 0: | 229 if return_code != 0: |
228 return return_code | 230 return return_code |
229 | 231 |
230 | 232 |
231 if __name__ == '__main__': | 233 if __name__ == '__main__': |
232 sys.exit(main(sys.argv)) | 234 sys.exit(main(sys.argv)) |
OLD | NEW |