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

Side by Side Diff: tools/buildbot_spec.py

Issue 1258083006: Cherry-pick m45 fixes onto m44 (Closed) Base URL: https://skia.googlesource.com/skia.git@m44
Patch Set: All the fixes Created 5 years, 4 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
« no previous file with comments | « tools/buildbot_spec.json ('k') | tools/builder_name_schema.json » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #
2 # Copyright 2015 Google Inc.
3 #
4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file.
6 #
7
8 #!/usr/bin/env python
9
10 usage = '''
11 Write buildbot spec to outfile based on the bot name:
12 $ python buildbot_spec.py outfile Test-Ubuntu-GCC-GCE-CPU-AVX2-x86-Debug
13 Or run self-tests:
14 $ python buildbot_spec.py test
15 '''
16
17 import inspect
18 import json
19 import os
20 import sys
21
22 import builder_name_schema
23 import dm_flags
24 import nanobench_flags
25
26
27 CONFIG_DEBUG = 'Debug'
28 CONFIG_RELEASE = 'Release'
29
30
31 def lineno():
32 caller = inspect.stack()[1] # Up one level to our caller.
33 return inspect.getframeinfo(caller[0]).lineno
34
35 # Since we don't actually start coverage until we're in the self-test,
36 # some function def lines aren't reported as covered. Add them to this
37 # list so that we can ignore them.
38 cov_skip = []
39
40 cov_start = lineno()+1 # We care about coverage starting just past this def.
41 def gyp_defines(builder_dict):
42 gyp_defs = {}
43
44 # skia_arch_width.
45 if builder_dict['role'] == builder_name_schema.BUILDER_ROLE_BUILD:
46 arch = builder_dict['target_arch']
47 elif builder_dict['role'] == builder_name_schema.BUILDER_ROLE_HOUSEKEEPER:
48 arch = None
49 else:
50 arch = builder_dict['arch']
51
52 #TODO(scroggo + mtklein): when safe, only set skia_arch_type.
53 arch_widths_and_types = {
54 'x86': ('32', 'x86'),
55 'x86_64': ('64', 'x86_64'),
56 'Arm7': ('32', 'arm'),
57 'Arm64': ('64', 'arm64'),
58 'Mips': ('32', 'mips'),
59 'Mips64': ('64', 'mips'),
60 'MipsDSP2': ('32', 'mips'),
61 }
62 if arch in arch_widths_and_types:
63 skia_arch_width, skia_arch_type = arch_widths_and_types[arch]
64 gyp_defs['skia_arch_width'] = skia_arch_width
65 gyp_defs['skia_arch_type'] = skia_arch_type
66
67 # housekeeper: build shared lib.
68 if builder_dict['role'] == builder_name_schema.BUILDER_ROLE_HOUSEKEEPER:
69 gyp_defs['skia_shared_lib'] = '1'
70
71 # skia_gpu.
72 if builder_dict.get('cpu_or_gpu') == 'CPU':
73 gyp_defs['skia_gpu'] = '0'
74
75 # skia_warnings_as_errors.
76 werr = False
77 if builder_dict['role'] == builder_name_schema.BUILDER_ROLE_BUILD:
78 if 'Win' in builder_dict.get('os', ''):
79 if not ('GDI' in builder_dict.get('extra_config', '') or
80 'Exceptions' in builder_dict.get('extra_config', '')):
81 werr = True
82 elif ('Mac' in builder_dict.get('os', '') and
83 'Android' in builder_dict.get('extra_config', '')):
84 werr = False
85 else:
86 werr = True
87 gyp_defs['skia_warnings_as_errors'] = str(int(werr)) # True/False -> '1'/'0'
88
89 # Win debugger.
90 if 'Win' in builder_dict.get('os', ''):
91 gyp_defs['skia_win_debuggers_path'] = 'c:/DbgHelp'
92
93 # Qt SDK (Win).
94 if 'Win' in builder_dict.get('os', ''):
95 if builder_dict.get('os') == 'Win8':
96 gyp_defs['qt_sdk'] = 'C:/Qt/Qt5.1.0/5.1.0/msvc2012_64/'
97 else:
98 gyp_defs['qt_sdk'] = 'C:/Qt/4.8.5/'
99
100 # ANGLE.
101 if builder_dict.get('extra_config') == 'ANGLE':
102 gyp_defs['skia_angle'] = '1'
103
104 # GDI.
105 if builder_dict.get('extra_config') == 'GDI':
106 gyp_defs['skia_gdi'] = '1'
107
108 # Build with Exceptions on Windows.
109 if ('Win' in builder_dict.get('os', '') and
110 builder_dict.get('extra_config') == 'Exceptions'):
111 gyp_defs['skia_win_exceptions'] = '1'
112
113 # iOS.
114 if (builder_dict.get('os') == 'iOS' or
115 builder_dict.get('extra_config') == 'iOS'):
116 gyp_defs['skia_os'] = 'ios'
117
118 # Shared library build.
119 if builder_dict.get('extra_config') == 'Shared':
120 gyp_defs['skia_shared_lib'] = '1'
121
122 # PDF viewer in GM.
123 if (builder_dict.get('os') == 'Mac10.8' and
124 builder_dict.get('arch') == 'x86_64' and
125 builder_dict.get('configuration') == 'Release'):
126 gyp_defs['skia_run_pdfviewer_in_gm'] = '1'
127
128 # Clang.
129 if builder_dict.get('compiler') == 'Clang':
130 gyp_defs['skia_clang_build'] = '1'
131
132 # Valgrind.
133 if 'Valgrind' in builder_dict.get('extra_config', ''):
134 gyp_defs['skia_release_optimization_level'] = '1'
135
136 # Link-time code generation just wastes time on compile-only bots.
137 if (builder_dict.get('role') == builder_name_schema.BUILDER_ROLE_BUILD and
138 builder_dict.get('compiler') == 'MSVC'):
139 gyp_defs['skia_win_ltcg'] = '0'
140
141 # Mesa.
142 if (builder_dict.get('extra_config') == 'Mesa' or
143 builder_dict.get('cpu_or_gpu_value') == 'Mesa'):
144 gyp_defs['skia_mesa'] = '1'
145
146 # SKNX_NO_SIMD
147 if builder_dict.get('extra_config') == 'SKNX_NO_SIMD':
148 gyp_defs['sknx_no_simd'] = '1'
149
150 # skia_use_android_framework_defines.
151 if builder_dict.get('extra_config') == 'Android_FrameworkDefs':
152 gyp_defs['skia_use_android_framework_defines'] = '1'
153
154 return gyp_defs
155
156
157 cov_skip.extend([lineno(), lineno() + 1])
158 def get_extra_env_vars(builder_dict):
159 env = {}
160 if builder_dict.get('configuration') == 'Coverage':
161 # We have to use Clang 3.6 because earlier versions do not support the
162 # compile flags we use and 3.7 and 3.8 hit asserts during compilation.
163 env['CC'] = '/usr/bin/clang-3.6'
164 env['CXX'] = '/usr/bin/clang++-3.6'
165 elif builder_dict.get('compiler') == 'Clang':
166 env['CC'] = '/usr/bin/clang'
167 env['CXX'] = '/usr/bin/clang++'
168 return env
169
170
171 cov_skip.extend([lineno(), lineno() + 1])
172 def build_targets_from_builder_dict(builder_dict):
173 """Return a list of targets to build, depending on the builder type."""
174 if builder_dict['role'] in ('Test', 'Perf') and builder_dict['os'] == 'iOS':
175 return ['iOSShell']
176 elif builder_dict['role'] == builder_name_schema.BUILDER_ROLE_TEST:
177 t = ['dm']
178 if builder_dict.get('configuration') == 'Debug':
179 t.append('nanobench')
180 return t
181 elif builder_dict['role'] == builder_name_schema.BUILDER_ROLE_PERF:
182 return ['nanobench']
183 else:
184 return ['most']
185
186
187 cov_skip.extend([lineno(), lineno() + 1])
188 def device_cfg(builder_dict):
189 # Android.
190 if 'Android' in builder_dict.get('extra_config', ''):
191 if 'NoNeon' in builder_dict['extra_config']:
192 return 'arm_v7'
193 return {
194 'Arm64': 'arm64',
195 'x86': 'x86',
196 'x86_64': 'x86_64',
197 'Mips': 'mips',
198 'Mips64': 'mips64',
199 'MipsDSP2': 'mips_dsp2',
200 }.get(builder_dict['target_arch'], 'arm_v7_neon')
201 elif builder_dict.get('os') == 'Android':
202 return {
203 'GalaxyS3': 'arm_v7_neon',
204 'GalaxyS4': 'arm_v7_neon',
205 'Nexus5': 'arm_v7', # This'd be 'nexus_5', but we simulate no-NEON Clank.
206 'Nexus6': 'arm_v7_neon',
207 'Nexus7': 'nexus_7',
208 'Nexus9': 'nexus_9',
209 'Nexus10': 'nexus_10',
210 'NexusPlayer': 'x86',
211 'NVIDIA_Shield': 'arm64',
212 }[builder_dict['model']]
213
214 # ChromeOS.
215 if 'CrOS' in builder_dict.get('extra_config', ''):
216 if 'Link' in builder_dict['extra_config']:
217 return 'link'
218 if 'Daisy' in builder_dict['extra_config']:
219 return 'daisy'
220 elif builder_dict.get('os') == 'ChromeOS':
221 return {
222 'Link': 'link',
223 'Daisy': 'daisy',
224 }[builder_dict['model']]
225
226 return None
227
228
229 cov_skip.extend([lineno(), lineno() + 1])
230 def get_builder_spec(builder_name):
231 builder_dict = builder_name_schema.DictForBuilderName(builder_name)
232 env = get_extra_env_vars(builder_dict)
233 gyp_defs = gyp_defines(builder_dict)
234 gyp_defs_list = ['%s=%s' % (k, v) for k, v in gyp_defs.iteritems()]
235 gyp_defs_list.sort()
236 env['GYP_DEFINES'] = ' '.join(gyp_defs_list)
237 rv = {
238 'build_targets': build_targets_from_builder_dict(builder_dict),
239 'builder_cfg': builder_dict,
240 'dm_flags': dm_flags.get_args(builder_name),
241 'env': env,
242 'nanobench_flags': nanobench_flags.get_args(builder_name),
243 }
244 device = device_cfg(builder_dict)
245 if device:
246 rv['device_cfg'] = device
247
248 role = builder_dict['role']
249 if role == builder_name_schema.BUILDER_ROLE_HOUSEKEEPER:
250 configuration = CONFIG_RELEASE
251 else:
252 configuration = builder_dict.get(
253 'configuration', CONFIG_DEBUG)
254 arch = (builder_dict.get('arch') or builder_dict.get('target_arch'))
255 if ('Win' in builder_dict.get('os', '') and arch == 'x86_64'):
256 configuration += '_x64'
257 rv['configuration'] = configuration
258 rv['do_test_steps'] = role == builder_name_schema.BUILDER_ROLE_TEST
259 rv['do_perf_steps'] = (role == builder_name_schema.BUILDER_ROLE_PERF or
260 (role == builder_name_schema.BUILDER_ROLE_TEST and
261 configuration == CONFIG_DEBUG) or
262 'Valgrind' in builder_name)
263
264 # Do we upload perf results?
265 upload_perf_results = False
266 if role == builder_name_schema.BUILDER_ROLE_PERF:
267 upload_perf_results = True
268 rv['upload_perf_results'] = upload_perf_results
269
270 # Do we upload correctness results?
271 skip_upload_bots = [
272 'ASAN',
273 'Coverage',
274 'TSAN',
275 'UBSAN',
276 'Valgrind',
277 ]
278 upload_dm_results = True
279 for s in skip_upload_bots:
280 if s in builder_name:
281 upload_dm_results = False
282 break
283 rv['upload_dm_results'] = upload_dm_results
284
285 return rv
286
287
288 cov_end = lineno() # Don't care about code coverage past here.
289
290
291 def self_test():
292 import coverage # This way the bots don't need coverage.py to be installed.
293 args = {}
294 cases = [
295 'Build-Mac10.8-Clang-Arm7-Debug-Android',
296 'Build-Win-MSVC-x86-Debug',
297 'Build-Win-MSVC-x86-Debug-GDI',
298 'Build-Win-MSVC-x86-Debug-Exceptions',
299 'Build-Ubuntu-GCC-Arm7-Debug-Android_FrameworkDefs',
300 'Build-Ubuntu-GCC-Arm7-Debug-Android_NoNeon',
301 'Build-Ubuntu-GCC-Arm7-Debug-CrOS_Daisy',
302 'Build-Ubuntu-GCC-x86_64-Debug-CrOS_Link',
303 'Build-Ubuntu-GCC-x86_64-Release-Mesa',
304 'Housekeeper-PerCommit',
305 'Perf-Win8-MSVC-ShuttleB-GPU-HD4600-x86_64-Release-Trybot',
306 'Test-Android-GCC-Nexus6-GPU-Adreno420-Arm7-Debug',
307 'Test-ChromeOS-GCC-Link-CPU-AVX-x86_64-Debug',
308 'Test-iOS-Clang-iPad4-GPU-SGX554-Arm7-Debug',
309 'Test-Mac10.8-Clang-MacMini4.1-GPU-GeForce320M-x86_64-Release',
310 'Test-Ubuntu-Clang-GCE-CPU-AVX2-x86_64-Coverage',
311 'Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD',
312 'Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-Shared',
313 'Test-Ubuntu-GCC-ShuttleA-GPU-GTX550Ti-x86_64-Release-Valgrind',
314 'Test-Win8-MSVC-ShuttleB-GPU-HD4600-x86-Release-ANGLE',
315 'Test-Win8-MSVC-ShuttleA-CPU-AVX-x86_64-Debug',
316 ]
317
318 cov = coverage.coverage()
319 cov.start()
320 for case in cases:
321 args[case] = get_builder_spec(case)
322 cov.stop()
323
324 this_file = os.path.basename(__file__)
325 _, _, not_run, _ = cov.analysis(this_file)
326 filtered = [line for line in not_run if
327 line > cov_start and line < cov_end and line not in cov_skip]
328 if filtered:
329 print 'Lines not covered by test cases: ', filtered
330 sys.exit(1)
331
332 golden = this_file.replace('.py', '.json')
333 with open(os.path.join(os.path.dirname(__file__), golden), 'w') as f:
334 json.dump(args, f, indent=2, sort_keys=True)
335
336
337 if __name__ == '__main__':
338 if len(sys.argv) == 2 and sys.argv[1] == 'test':
339 self_test()
340 sys.exit(0)
341
342 if len(sys.argv) != 3:
343 print usage
344 sys.exit(1)
345
346 with open(sys.argv[1], 'w') as out:
347 json.dump(get_builder_spec(sys.argv[2]), out)
OLDNEW
« no previous file with comments | « tools/buildbot_spec.json ('k') | tools/builder_name_schema.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698