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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 """Get a formatted list of commands. | 73 """Get a formatted list of commands. |
73 | 74 |
74 Args: | 75 Args: |
75 options: Options object. | 76 options: Options object. |
76 bot_config: A BotConfig named tuple. | 77 bot_config: A BotConfig named tuple. |
77 Returns: | 78 Returns: |
78 list of Command objects. | 79 list of Command objects. |
79 """ | 80 """ |
80 property_args = bb_utils.EncodeProperties(options) | 81 property_args = bb_utils.EncodeProperties(options) |
81 commands = [['build/android/buildbot/bb_host_steps.py'] + | 82 commands = [['build/android/buildbot/bb_host_steps.py'] + |
82 bot_config.host_obj.host_step_args + property_args] | 83 ['--steps=%s' % ','.join(bot_config.host_obj.host_steps)] + |
| 84 property_args + (bot_config.host_obj.extra_args or [])] |
83 | 85 |
84 test_obj = bot_config.test_obj | 86 test_obj = bot_config.test_obj |
85 if test_obj: | 87 if test_obj: |
86 run_test_cmd = [ | 88 run_test_cmd = [ |
87 'build/android/buildbot/bb_device_steps.py', '--reboot'] + property_args | 89 'build/android/buildbot/bb_device_steps.py', '--reboot'] + property_args |
88 for test in test_obj.tests: | 90 for test in test_obj.tests: |
89 run_test_cmd.extend(['-f', test]) | 91 run_test_cmd.extend(['-f', test]) |
90 if test_obj.extra_args: | 92 if test_obj.extra_args: |
91 run_test_cmd.extend(test_obj.extra_args) | 93 run_test_cmd.extend(test_obj.extra_args) |
92 commands.append(run_test_cmd) | 94 commands.append(run_test_cmd) |
93 return commands | 95 return commands |
94 | 96 |
95 | 97 |
96 def GetBotStepMap(): | 98 def GetBotStepMap(): |
97 compile_opt = ['--compile'] | 99 compile_step = ['compile'] |
98 std_host_tests = ['--host-tests=check_webview_licenses,findbugs'] | 100 std_host_tests = ['check_webview_licenses', 'findbugs'] |
99 std_build_opts = ['--compile', '--zip-build'] | 101 std_build_steps = ['compile', 'zip_build'] |
100 std_test_opts = ['--extract-build'] | 102 std_test_steps = ['extract_build'] |
101 std_tests = ['ui', 'unit'] | 103 std_tests = ['ui', 'unit'] |
102 flakiness_server = '--upload-to-flakiness-server' | 104 flakiness_server = '--upload-to-flakiness-server' |
103 | 105 |
104 def B(bot_id, host_object, test_object=None): | 106 def B(bot_id, host_object, test_object=None): |
105 return BotConfig(bot_id, host_object, test_object) | 107 return BotConfig(bot_id, host_object, test_object) |
106 | 108 |
107 def T(tests, extra_args=None): | 109 def T(tests, extra_args=None): |
108 return TestConfig(tests, extra_args) | 110 return TestConfig(tests, extra_args) |
109 | 111 |
110 def H(host_step_args, extra_gyp=None, target_arch=None): | 112 def H(host_steps, extra_args=None, extra_gyp=None, target_arch=None): |
111 return HostConfig(host_step_args, extra_gyp, target_arch) | 113 return HostConfig(host_steps, extra_args, extra_gyp, target_arch) |
112 | 114 |
113 bot_configs = [ | 115 bot_configs = [ |
114 # Main builders | 116 # Main builders |
115 B('main-builder-dbg', H(std_build_opts + std_host_tests)), | 117 B('main-builder-dbg', H(std_build_steps + std_host_tests)), |
116 B('main-builder-rel', H(std_build_opts)), | 118 B('main-builder-rel', H(std_build_steps)), |
117 B('main-clang-builder', H(compile_opt, 'clang=1')), | 119 B('main-clang-builder', H(compile_step, extra_gyp='clang=1')), |
118 B('main-clobber', H(compile_opt)), | 120 B('main-clobber', H(compile_step)), |
119 B('main-tests', H(std_test_opts), T(std_tests, [flakiness_server])), | 121 B('main-tests', H(std_test_steps), T(std_tests, [flakiness_server])), |
120 | 122 |
121 # Other waterfalls | 123 # Other waterfalls |
122 B('asan-builder-tests', H(compile_opt, 'asan=1'), | 124 B('asan-builder-tests', H(compile_step, extra_gyp='asan=1'), |
123 T(std_tests, ['--asan'])), | 125 T(std_tests, ['--asan'])), |
124 B('chromedriver-fyi-tests-dbg', H(std_test_opts), | 126 B('chromedriver-fyi-tests-dbg', H(std_test_steps), |
125 T(['chromedriver'], ['--install=ChromiumTestShell'])), | 127 T(['chromedriver'], ['--install=ChromiumTestShell'])), |
126 B('fyi-builder-dbg', | 128 B('fyi-builder-dbg', |
127 H(std_build_opts + std_host_tests + ['--experimental'])), | 129 H(std_build_steps + std_host_tests, ['--experimental'])), |
128 B('fyi-builder-rel', H(std_build_opts + ['--experimental'])), | 130 B('fyi-builder-rel', H(std_build_steps, ['--experimental'])), |
129 B('fyi-tests-dbg-ics-gn', H(compile_opt + [ '--experimental']), | 131 B('fyi-tests-dbg-ics-gn', H(compile_step, [ '--experimental']), |
130 T(std_tests, ['--experimental', flakiness_server])), | 132 T(std_tests, ['--experimental', flakiness_server])), |
131 B('fyi-tests', H(std_test_opts), | 133 B('fyi-tests', H(std_test_steps), |
132 T(std_tests, ['--experimental', flakiness_server])), | 134 T(std_tests, ['--experimental', flakiness_server])), |
133 B('fyi-component-builder-tests-dbg', | 135 B('fyi-component-builder-tests-dbg', |
134 H(compile_opt, 'component=shared_library'), | 136 H(compile_step, extra_gyp='component=shared_library'), |
135 T(std_tests, ['--experimental', flakiness_server])), | 137 T(std_tests, ['--experimental', flakiness_server])), |
136 B('perf-bisect-builder-tests-dbg', H(['--bisect-perf-regression'])), | 138 B('perf-bisect-builder-tests-dbg', H(['bisect_perf_regression'])), |
137 B('perf-tests-rel', H(std_test_opts), T([], ['--install=ContentShell'])), | 139 B('perf-tests-rel', H(std_test_steps), T([], ['--install=ContentShell'])), |
138 B('webkit-latest-webkit-tests', H(std_test_opts), | 140 B('webkit-latest-webkit-tests', H(std_test_steps), |
139 T(['webkit_layout', 'webkit'])), | 141 T(['webkit_layout', 'webkit'])), |
140 B('webkit-latest-contentshell', H(compile_opt), T(['webkit_layout'])), | 142 B('webkit-latest-contentshell', H(compile_step), T(['webkit_layout'])), |
141 B('builder-unit-tests', H(compile_opt), T(['unit'])), | 143 B('builder-unit-tests', H(compile_step), T(['unit'])), |
142 | 144 |
143 # Generic builder config (for substring match). | 145 # Generic builder config (for substring match). |
144 B('builder', H(std_build_opts)), | 146 B('builder', H(std_build_steps)), |
145 ] | 147 ] |
146 | 148 |
147 bot_map = dict((config.bot_id, config) for config in bot_configs) | 149 bot_map = dict((config.bot_id, config) for config in bot_configs) |
148 | 150 |
149 # These bots have identical configuration to ones defined earlier. | 151 # These bots have identical configuration to ones defined earlier. |
150 copy_map = [ | 152 copy_map = [ |
151 ('lkgr-clobber', 'main-clobber'), | 153 ('lkgr-clobber', 'main-clobber'), |
152 ('try-builder-dbg', 'main-builder-dbg'), | 154 ('try-builder-dbg', 'main-builder-dbg'), |
153 ('try-builder-rel', 'main-builder-rel'), | 155 ('try-builder-rel', 'main-builder-rel'), |
154 ('try-clang-builder', 'main-clang-builder'), | 156 ('try-clang-builder', 'main-clang-builder'), |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 sys.stdout.flush() | 218 sys.stdout.flush() |
217 if options.testing: | 219 if options.testing: |
218 env['BUILDBOT_TESTING'] = '1' | 220 env['BUILDBOT_TESTING'] = '1' |
219 return_code = subprocess.call(command, cwd=bb_utils.CHROME_SRC, env=env) | 221 return_code = subprocess.call(command, cwd=bb_utils.CHROME_SRC, env=env) |
220 if return_code != 0: | 222 if return_code != 0: |
221 return return_code | 223 return return_code |
222 | 224 |
223 | 225 |
224 if __name__ == '__main__': | 226 if __name__ == '__main__': |
225 sys.exit(main(sys.argv)) | 227 sys.exit(main(sys.argv)) |
OLD | NEW |