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 sys.path.append(os.path.join(os.path.dirname(__file__), '..')) | 18 sys.path.append(os.path.join(os.path.dirname(__file__), '..')) |
19 from pylib import constants | 19 from pylib import constants |
20 | 20 |
21 | 21 |
22 CHROMIUM_COVERAGE_BUCKET = 'chromium-code-coverage' | |
23 | |
22 _BotConfig = collections.namedtuple( | 24 _BotConfig = collections.namedtuple( |
23 'BotConfig', ['bot_id', 'host_obj', 'test_obj']) | 25 'BotConfig', ['bot_id', 'host_obj', 'test_obj']) |
24 | 26 |
25 HostConfig = collections.namedtuple( | 27 HostConfig = collections.namedtuple( |
26 'HostConfig', | 28 'HostConfig', |
27 ['script', 'host_steps', 'extra_args', 'extra_gyp_defines', 'target_arch']) | 29 ['script', 'host_steps', 'extra_args', 'extra_gyp_defines', 'target_arch']) |
28 | 30 |
29 TestConfig = collections.namedtuple('Tests', ['script', 'tests', 'extra_args']) | 31 TestConfig = collections.namedtuple('Tests', ['script', 'tests', 'extra_args']) |
30 | 32 |
31 | 33 |
32 def BotConfig(bot_id, host_object, test_object=None): | 34 def BotConfig(bot_id, host_object, test_object=None): |
33 return _BotConfig(bot_id, host_object, test_object) | 35 return _BotConfig(bot_id, host_object, test_object) |
34 | 36 |
35 | 37 |
36 def DictDiff(d1, d2): | 38 def DictDiff(d1, d2): |
37 diff = [] | 39 diff = [] |
38 for key in sorted(set(d1.keys() + d2.keys())): | 40 for key in sorted(set(d1.keys() + d2.keys())): |
39 if key in d1 and d1[key] != d2.get(key): | 41 if key in d1 and d1[key] != d2.get(key): |
40 diff.append('- %s=%s' % (key, pipes.quote(d1[key]))) | 42 diff.append('- %s=%s' % (key, pipes.quote(d1[key]))) |
41 if key in d2 and d2[key] != d1.get(key): | 43 if key in d2 and d2[key] != d1.get(key): |
42 diff.append('+ %s=%s' % (key, pipes.quote(d2[key]))) | 44 diff.append('+ %s=%s' % (key, pipes.quote(d2[key]))) |
43 return '\n'.join(diff) | 45 return '\n'.join(diff) |
44 | 46 |
45 | 47 |
46 def GetEnvironment(host_obj, testing): | 48 def GetEnvironment(host_obj, testing, bot_id): |
47 init_env = dict(os.environ) | 49 init_env = dict(os.environ) |
48 init_env['GYP_GENERATORS'] = 'ninja' | 50 init_env['GYP_GENERATORS'] = 'ninja' |
49 init_env['GOMA_DIR'] = bb_utils.GOMA_DIR | 51 init_env['GOMA_DIR'] = bb_utils.GOMA_DIR |
52 init_env['BUILDBOT_ID'] = bot_id | |
bulach
2013/08/20 17:42:34
what is this? is it the same as BUILDBOT_BUILDERNA
| |
50 envsetup_cmd = '. build/android/envsetup.sh' | 53 envsetup_cmd = '. build/android/envsetup.sh' |
51 if host_obj.target_arch: | 54 if host_obj.target_arch: |
52 envsetup_cmd += ' --target-arch=%s' % host_obj.target_arch | 55 envsetup_cmd += ' --target-arch=%s' % host_obj.target_arch |
53 if testing: | 56 if testing: |
54 # Skip envsetup to avoid presubmit dependence on android deps. | 57 # Skip envsetup to avoid presubmit dependence on android deps. |
55 print 'Testing mode - skipping "%s"' % envsetup_cmd | 58 print 'Testing mode - skipping "%s"' % envsetup_cmd |
56 envsetup_cmd = ':' | 59 envsetup_cmd = ':' |
57 else: | 60 else: |
58 print 'Running %s' % envsetup_cmd | 61 print 'Running %s' % envsetup_cmd |
59 proc = subprocess.Popen(['bash', '-exc', | 62 proc = subprocess.Popen(['bash', '-exc', |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
107 run_test_cmd.extend(test_obj.extra_args) | 110 run_test_cmd.extend(test_obj.extra_args) |
108 commands.append(run_test_cmd) | 111 commands.append(run_test_cmd) |
109 return commands | 112 return commands |
110 | 113 |
111 | 114 |
112 def GetBotStepMap(): | 115 def GetBotStepMap(): |
113 compile_step = ['compile'] | 116 compile_step = ['compile'] |
114 std_host_tests = ['check_webview_licenses', 'findbugs'] | 117 std_host_tests = ['check_webview_licenses', 'findbugs'] |
115 std_build_steps = ['compile', 'zip_build'] | 118 std_build_steps = ['compile', 'zip_build'] |
116 std_test_steps = ['extract_build'] | 119 std_test_steps = ['extract_build'] |
117 std_tests = ['ui', 'unit'] | 120 std_tests = ['ui'] |
bulach
2013/08/20 17:42:34
what about unit?
| |
118 flakiness_server = ( | 121 flakiness_server = ( |
119 '--flakiness-server=%s' % constants.UPSTREAM_FLAKINESS_SERVER) | 122 '--flakiness-server=%s' % constants.UPSTREAM_FLAKINESS_SERVER) |
120 experimental = ['--experimental'] | 123 experimental = ['--experimental'] |
121 | 124 |
122 B = BotConfig | 125 B = BotConfig |
123 H = (lambda steps, extra_args=None, extra_gyp=None, target_arch=None : | 126 H = (lambda steps, extra_args=None, extra_gyp=None, target_arch=None : |
124 HostConfig('build/android/buildbot/bb_host_steps.py', steps, extra_args, | 127 HostConfig('build/android/buildbot/bb_host_steps.py', steps, extra_args, |
125 extra_gyp, target_arch)) | 128 extra_gyp, target_arch)) |
126 T = (lambda tests, extra_args=None : | 129 T = (lambda tests, extra_args=None : |
127 TestConfig('build/android/buildbot/bb_device_steps.py', tests, | 130 TestConfig('build/android/buildbot/bb_device_steps.py', tests, |
128 extra_args)) | 131 extra_args)) |
129 | 132 |
130 bot_configs = [ | 133 bot_configs = [ |
131 # Main builders | 134 # Main builders |
132 B('main-builder-dbg', H(std_build_steps + std_host_tests)), | 135 B('main-builder-dbg', H(std_build_steps + std_host_tests)), |
133 B('main-builder-rel', H(std_build_steps)), | 136 B('main-builder-rel', H(std_build_steps)), |
134 B('main-clang-builder', | 137 B('main-clang-builder', |
135 H(compile_step, extra_gyp='clang=1 component=shared_library')), | 138 H(compile_step, extra_gyp='clang=1 component=shared_library')), |
136 B('main-clobber', H(compile_step)), | 139 B('main-clobber', H(compile_step)), |
137 B('main-tests', H(std_test_steps), T(std_tests, [flakiness_server])), | 140 B('main-tests', H(std_test_steps), T(std_tests, [flakiness_server])), |
138 | 141 |
139 # Other waterfalls | 142 # Other waterfalls |
140 B('asan-builder-tests', H(compile_step, extra_gyp='asan=1'), | 143 B('asan-builder-tests', H(compile_step, extra_gyp='asan=1'), |
141 T(std_tests, ['--asan'])), | 144 T(std_tests, ['--asan'])), |
142 B('chromedriver-fyi-tests-dbg', H(std_test_steps), | 145 B('chromedriver-fyi-tests-dbg', H(std_test_steps), |
143 T(['chromedriver'], ['--install=ChromiumTestShell'])), | 146 T(['chromedriver'], ['--install=ChromiumTestShell'])), |
144 B('fyi-x86-builder-dbg', | 147 B('fyi-x86-builder-dbg', |
145 H(compile_step + std_host_tests, experimental, target_arch='x86')), | 148 H(compile_step + std_host_tests, experimental, target_arch='x86')), |
146 B('fyi-builder-dbg', | 149 B('fyi-builder-dbg', |
147 H(std_build_steps + std_host_tests, experimental)), | 150 H(std_build_steps + std_host_tests, experimental, |
151 extra_gyp='emma_coverage=1')), | |
148 B('x86-builder-dbg', | 152 B('x86-builder-dbg', |
149 H(compile_step + std_host_tests, target_arch='x86')), | 153 H(compile_step + std_host_tests, target_arch='x86')), |
150 B('fyi-builder-rel', H(std_build_steps, experimental)), | 154 B('fyi-builder-rel', H(std_build_steps, experimental)), |
151 B('fyi-tests', H(std_test_steps), | 155 B('fyi-tests', H(std_test_steps), |
152 T(std_tests, ['--experimental', flakiness_server])), | 156 T(std_tests, ['--experimental', flakiness_server, |
157 '--coverage-bucket', CHROMIUM_COVERAGE_BUCKET])), | |
153 B('fyi-component-builder-tests-dbg', | 158 B('fyi-component-builder-tests-dbg', |
154 H(compile_step, extra_gyp='component=shared_library'), | 159 H(compile_step, extra_gyp='component=shared_library'), |
155 T(std_tests, ['--experimental', flakiness_server])), | 160 T(std_tests, ['--experimental', flakiness_server])), |
156 B('perf-bisect-builder-tests-dbg', H(['bisect_perf_regression'])), | 161 B('perf-bisect-builder-tests-dbg', H(['bisect_perf_regression'])), |
157 B('perf-tests-rel', H(std_test_steps), | 162 B('perf-tests-rel', H(std_test_steps), |
158 T([], ['--install=ChromiumTestShell'])), | 163 T([], ['--install=ChromiumTestShell'])), |
159 B('webkit-latest-webkit-tests', H(std_test_steps), | 164 B('webkit-latest-webkit-tests', H(std_test_steps), |
160 T(['webkit_layout', 'webkit'], ['--auto-reconnect'])), | 165 T(['webkit_layout', 'webkit'], ['--auto-reconnect'])), |
161 B('webkit-latest-contentshell', H(compile_step), | 166 B('webkit-latest-contentshell', H(compile_step), |
162 T(['webkit_layout'], ['--auto-reconnect'])), | 167 T(['webkit_layout'], ['--auto-reconnect'])), |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
258 if not bot_config: | 263 if not bot_config: |
259 sys.exit(1) | 264 sys.exit(1) |
260 | 265 |
261 print 'Using config:', bot_config | 266 print 'Using config:', bot_config |
262 | 267 |
263 commands = GetCommands(options, bot_config) | 268 commands = GetCommands(options, bot_config) |
264 for command in commands: | 269 for command in commands: |
265 print 'Will run: ', bb_utils.CommandToString(command) | 270 print 'Will run: ', bb_utils.CommandToString(command) |
266 print | 271 print |
267 | 272 |
268 env = GetEnvironment(bot_config.host_obj, options.testing) | 273 bot_id = options.bot_id or options.factory_properties.get('android_bot_id') |
274 env = GetEnvironment(bot_config.host_obj, options.testing, bot_id) | |
269 return RunBotCommands(options, commands, env) | 275 return RunBotCommands(options, commands, env) |
270 | 276 |
271 | 277 |
272 if __name__ == '__main__': | 278 if __name__ == '__main__': |
273 sys.exit(main(sys.argv)) | 279 sys.exit(main(sys.argv)) |
OLD | NEW |