Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(838)

Side by Side Diff: build/android/buildbot/bb_run_bot.py

Issue 15817022: [Android] Refactor bb_host_steps to prepare for downstream usage. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Do not use collections.OrderedDict as the botr might be running Python less than 2.7 Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 +
Isaac (away) 2013/06/12 19:49:05 unneeded linebreak
Siva Chandra 2013/06/12 21:21:35 Done.
85 (bot_config.host_obj.extra_args or [])]
83 86
84 test_obj = bot_config.test_obj 87 test_obj = bot_config.test_obj
85 if test_obj: 88 if test_obj:
86 run_test_cmd = [ 89 run_test_cmd = [
87 'build/android/buildbot/bb_device_steps.py', '--reboot'] + property_args 90 'build/android/buildbot/bb_device_steps.py', '--reboot'] + property_args
88 for test in test_obj.tests: 91 for test in test_obj.tests:
89 run_test_cmd.extend(['-f', test]) 92 run_test_cmd.extend(['-f', test])
90 if test_obj.extra_args: 93 if test_obj.extra_args:
91 run_test_cmd.extend(test_obj.extra_args) 94 run_test_cmd.extend(test_obj.extra_args)
92 commands.append(run_test_cmd) 95 commands.append(run_test_cmd)
93 return commands 96 return commands
94 97
95 98
96 def GetBotStepMap(): 99 def GetBotStepMap():
97 compile_opt = ['--compile'] 100 compile_step = ['runhooks', 'compile']
98 std_host_tests = ['--host-tests=check_webview_licenses,findbugs'] 101 std_host_tests = ['check_webview_licenses', 'findbugs']
99 std_build_opts = ['--compile', '--zip-build'] 102 std_build_steps = ['runhooks', 'compile', 'zip_build']
100 std_test_opts = ['--extract-build'] 103 std_test_steps = ['extract_build']
101 std_tests = ['ui', 'unit'] 104 std_tests = ['ui', 'unit']
102 flakiness_server = '--upload-to-flakiness-server' 105 flakiness_server = '--upload-to-flakiness-server'
103 106
104 def B(bot_id, host_object, test_object=None): 107 def B(bot_id, host_object, test_object=None):
105 return BotConfig(bot_id, host_object, test_object) 108 return BotConfig(bot_id, host_object, test_object)
106 109
107 def T(tests, extra_args=None): 110 def T(tests, extra_args=None):
108 return TestConfig(tests, extra_args) 111 return TestConfig(tests, extra_args)
109 112
110 def H(host_step_args, extra_gyp=None, target_arch=None): 113 def H(host_steps, extra_args=None, extra_gyp=None, target_arch=None):
111 return HostConfig(host_step_args, extra_gyp, target_arch) 114 return HostConfig(host_steps, extra_args, extra_gyp, target_arch)
112 115
113 bot_configs = [ 116 bot_configs = [
114 # Main builders 117 # Main builders
115 B('main-builder-dbg', H(std_build_opts + std_host_tests)), 118 B('main-builder-dbg', H(std_build_steps + std_host_tests)),
116 B('main-builder-rel', H(std_build_opts)), 119 B('main-builder-rel', H(std_build_steps)),
117 B('main-clang-builder', H(compile_opt, 'clang=1')), 120 B('main-clang-builder', H(compile_step, extra_gyp='clang=1')),
118 B('main-clobber', H(compile_opt)), 121 B('main-clobber', H(compile_step)),
119 B('main-tests', H(std_test_opts), T(std_tests, [flakiness_server])), 122 B('main-tests', H(std_test_steps), T(std_tests, [flakiness_server])),
120 123
121 # Other waterfalls 124 # Other waterfalls
122 B('asan-builder-tests', H(compile_opt, 'asan=1'), 125 B('asan-builder-tests', H(compile_step, extra_gyp='asan=1'),
123 T(std_tests, ['--asan'])), 126 T(std_tests, ['--asan'])),
124 B('chromedriver-fyi-tests-dbg', H(std_test_opts), 127 B('chromedriver-fyi-tests-dbg', H(std_test_steps),
125 T(['chromedriver'], ['--install=ChromiumTestShell'])), 128 T(['chromedriver'], ['--install=ChromiumTestShell'])),
126 B('fyi-builder-dbg', 129 B('fyi-builder-dbg',
127 H(std_build_opts + std_host_tests + ['--experimental'])), 130 H(std_build_steps + std_host_tests, ['--experimental'])),
128 B('fyi-builder-rel', H(std_build_opts + ['--experimental'])), 131 B('fyi-builder-rel', H(std_build_steps, ['--experimental'])),
129 B('fyi-tests-dbg-ics-gn', H(compile_opt + [ '--experimental']), 132 B('fyi-tests-dbg-ics-gn', H(compile_step, [ '--experimental']),
130 T(std_tests, ['--experimental', flakiness_server])), 133 T(std_tests, ['--experimental', flakiness_server])),
131 B('fyi-tests', H(std_test_opts), 134 B('fyi-tests', H(std_test_steps),
132 T(std_tests, ['--experimental', flakiness_server])), 135 T(std_tests, ['--experimental', flakiness_server])),
133 B('fyi-component-builder-tests-dbg', 136 B('fyi-component-builder-tests-dbg',
134 H(compile_opt, 'component=shared_library'), 137 H(compile_step, extra_gyp='component=shared_library'),
135 T(std_tests, ['--experimental', flakiness_server])), 138 T(std_tests, ['--experimental', flakiness_server])),
136 B('perf-bisect-builder-tests-dbg', H(['--bisect-perf-regression'])), 139 B('perf-bisect-builder-tests-dbg', H(['bisect_perf_regression'])),
137 B('perf-tests-rel', H(std_test_opts), T([], ['--install=ContentShell'])), 140 B('perf-tests-rel', H(std_test_steps), T([], ['--install=ContentShell'])),
138 B('webkit-latest-webkit-tests', H(std_test_opts), 141 B('webkit-latest-webkit-tests', H(std_test_steps),
139 T(['webkit_layout', 'webkit'])), 142 T(['webkit_layout', 'webkit'])),
140 B('webkit-latest-contentshell', H(compile_opt), T(['webkit_layout'])), 143 B('webkit-latest-contentshell', H(compile_step), T(['webkit_layout'])),
141 B('builder-unit-tests', H(compile_opt), T(['unit'])), 144 B('builder-unit-tests', H(compile_step), T(['unit'])),
142 145
143 # Generic builder config (for substring match). 146 # Generic builder config (for substring match).
144 B('builder', H(std_build_opts)), 147 B('builder', H(std_build_steps)),
145 ] 148 ]
146 149
147 bot_map = dict((config.bot_id, config) for config in bot_configs) 150 bot_map = dict((config.bot_id, config) for config in bot_configs)
148 151
149 # These bots have identical configuration to ones defined earlier. 152 # These bots have identical configuration to ones defined earlier.
150 copy_map = [ 153 copy_map = [
151 ('lkgr-clobber', 'main-clobber'), 154 ('lkgr-clobber', 'main-clobber'),
152 ('try-builder-dbg', 'main-builder-dbg'), 155 ('try-builder-dbg', 'main-builder-dbg'),
153 ('try-builder-rel', 'main-builder-rel'), 156 ('try-builder-rel', 'main-builder-rel'),
154 ('try-clang-builder', 'main-clang-builder'), 157 ('try-clang-builder', 'main-clang-builder'),
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 sys.stdout.flush() 219 sys.stdout.flush()
217 if options.testing: 220 if options.testing:
218 env['BUILDBOT_TESTING'] = '1' 221 env['BUILDBOT_TESTING'] = '1'
219 return_code = subprocess.call(command, cwd=bb_utils.CHROME_SRC, env=env) 222 return_code = subprocess.call(command, cwd=bb_utils.CHROME_SRC, env=env)
220 if return_code != 0: 223 if return_code != 0:
221 return return_code 224 return return_code
222 225
223 226
224 if __name__ == '__main__': 227 if __name__ == '__main__':
225 sys.exit(main(sys.argv)) 228 sys.exit(main(sys.argv))
OLDNEW
« build/android/buildbot/bb_host_steps.py ('K') | « build/android/buildbot/bb_host_steps.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698