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

Side by Side Diff: tools/buildbot_spec.py

Issue 1265623002: Add builder_spec.py (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Don't build nanobench on Test-...-Release bots 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
24
25 def lineno():
26 caller = inspect.stack()[1] # Up one level to our caller.
27 return inspect.getframeinfo(caller[0]).lineno
28
29 # Since we don't actually start coverage until we're in the self-test,
30 # some function def lines aren't reported as covered. Add them to this
31 # list so that we can ignore them.
32 cov_skip = []
33
34 cov_start = lineno()+1 # We care about coverage starting just past this def.
35 def gyp_defines(builder_dict):
36 gyp_defs = {}
37
38 # skia_arch_type.
39 if builder_dict['role'] == builder_name_schema.BUILDER_ROLE_BUILD:
40 arch = builder_dict['target_arch']
41 elif builder_dict['role'] == builder_name_schema.BUILDER_ROLE_HOUSEKEEPER:
42 arch = None
43 else:
44 arch = builder_dict['arch']
45
46 arch_types = {
47 'x86': 'x86',
48 'x86_64': 'x86_64',
49 'Arm7': 'arm',
50 'Arm64': 'arm64',
51 'Mips': 'mips32',
52 'Mips64': 'mips64',
53 'MipsDSP2': 'mips32',
54 }
55 if arch in arch_types:
56 gyp_defs['skia_arch_type'] = arch_types[arch]
57
58 # housekeeper: build shared lib.
59 if builder_dict['role'] == builder_name_schema.BUILDER_ROLE_HOUSEKEEPER:
60 gyp_defs['skia_shared_lib'] = '1'
61
62 # skia_gpu.
63 if builder_dict.get('cpu_or_gpu') == 'CPU':
64 gyp_defs['skia_gpu'] = '0'
65
66 # skia_warnings_as_errors.
67 werr = False
68 if builder_dict['role'] == builder_name_schema.BUILDER_ROLE_BUILD:
69 if 'Win' in builder_dict.get('os', ''):
70 if not ('GDI' in builder_dict.get('extra_config', '') or
71 'Exceptions' in builder_dict.get('extra_config', '')):
72 werr = True
73 elif ('Mac' in builder_dict.get('os', '') and
74 'Android' in builder_dict.get('extra_config', '')):
75 werr = False
76 else:
77 werr = True
78 gyp_defs['skia_warnings_as_errors'] = str(int(werr)) # True/False -> '1'/'0'
79
80 # Win debugger.
81 if 'Win' in builder_dict.get('os', ''):
82 gyp_defs['skia_win_debuggers_path'] = 'c:/DbgHelp'
83
84 # Qt SDK (Win).
85 if 'Win' in builder_dict.get('os', ''):
86 if builder_dict.get('os') == 'Win8':
87 gyp_defs['qt_sdk'] = 'C:/Qt/Qt5.1.0/5.1.0/msvc2012_64/'
88 else:
89 gyp_defs['qt_sdk'] = 'C:/Qt/4.8.5/'
90
91 # ANGLE.
92 if builder_dict.get('extra_config') == 'ANGLE':
93 gyp_defs['skia_angle'] = '1'
94
95 # GDI.
96 if builder_dict.get('extra_config') == 'GDI':
97 gyp_defs['skia_gdi'] = '1'
98
99 # Build with Exceptions on Windows.
100 if ('Win' in builder_dict.get('os', '') and
101 builder_dict.get('extra_config') == 'Exceptions'):
102 gyp_defs['skia_win_exceptions'] = '1'
103
104 # iOS.
105 if (builder_dict.get('os') == 'iOS' or
106 builder_dict.get('extra_config') == 'iOS'):
107 gyp_defs['skia_os'] = 'ios'
108
109 # Shared library build.
110 if builder_dict.get('extra_config') == 'Shared':
111 gyp_defs['skia_shared_lib'] = '1'
112
113 # PDF viewer in GM.
114 if (builder_dict.get('os') == 'Mac10.8' and
115 builder_dict.get('arch') == 'x86_64' and
116 builder_dict.get('configuration') == 'Release'):
117 gyp_defs['skia_run_pdfviewer_in_gm'] = '1'
118
119 # Clang.
120 if builder_dict.get('compiler') == 'Clang':
121 gyp_defs['skia_clang_build'] = '1'
122
123 # Valgrind.
124 if 'Valgrind' in builder_dict.get('extra_config', ''):
125 gyp_defs['skia_release_optimization_level'] = '1'
126
127 # Link-time code generation just wastes time on compile-only bots.
128 if (builder_dict.get('role') == builder_name_schema.BUILDER_ROLE_BUILD and
129 builder_dict.get('compiler') == 'MSVC'):
130 gyp_defs['skia_win_ltcg'] = '0'
131
132 # Mesa.
133 if (builder_dict.get('extra_config') == 'Mesa' or
134 builder_dict.get('cpu_or_gpu_value') == 'Mesa'):
135 gyp_defs['skia_mesa'] = '1'
136
137 # SKNX_NO_SIMD
138 if builder_dict.get('extra_config') == 'SKNX_NO_SIMD':
139 gyp_defs['sknx_no_simd'] = '1'
140
141 # skia_use_android_framework_defines.
142 if builder_dict.get('extra_config') == 'Android_FrameworkDefs':
143 gyp_defs['skia_use_android_framework_defines'] = '1'
144
145 return gyp_defs
146
147
148 cov_skip.extend([lineno(), lineno() + 1])
149 def get_extra_env_vars(builder_dict):
150 env = {}
151 if builder_dict.get('compiler') == 'Clang':
152 env['CC'] = '/usr/bin/clang'
153 env['CXX'] = '/usr/bin/clang++'
154 return env
155
156
157 cov_skip.extend([lineno(), lineno() + 1])
158 def build_targets_from_builder_dict(builder_dict):
159 """Return a list of targets to build, depending on the builder type."""
160 if builder_dict['role'] in ('Test', 'Perf') and builder_dict['os'] == 'iOS':
161 return ['iOSShell']
162 elif builder_dict['role'] == builder_name_schema.BUILDER_ROLE_TEST:
163 t = ['dm']
164 if builder_dict.get('configuration') == 'Debug':
165 t.append('nanobench')
166 return t
167 elif builder_dict['role'] == builder_name_schema.BUILDER_ROLE_PERF:
168 return ['nanobench']
169 else:
170 return ['most']
171
172
173 cov_skip.extend([lineno(), lineno() + 1])
174 def get_builder_spec(builder_name):
175 builder_dict = builder_name_schema.DictForBuilderName(builder_name)
176 env = get_extra_env_vars(builder_dict)
177 gyp_defs = gyp_defines(builder_dict)
178 gyp_defs_list = ['%s=%s' % (k, v) for k, v in gyp_defs.iteritems()]
179 gyp_defs_list.sort()
180 env['GYP_DEFINES'] = ' '.join(gyp_defs_list)
181 return {
182 'build_targets': build_targets_from_builder_dict(builder_dict),
183 'env': env,
184 }
185
186
187 cov_end = lineno() # Don't care about code coverage past here.
188
189
190 def self_test():
191 import coverage # This way the bots don't need coverage.py to be installed.
192 args = {}
193 cases = [
194 'Build-Mac10.8-Clang-Arm7-Debug-Android',
195 'Build-Win-MSVC-x86-Debug',
196 'Build-Win-MSVC-x86-Debug-GDI',
197 'Build-Win-MSVC-x86-Debug-Exceptions',
198 'Build-Ubuntu-GCC-Arm7-Debug-Android_FrameworkDefs',
199 'Build-Ubuntu-GCC-x86_64-Release-Mesa',
200 'Housekeeper-PerCommit',
201 'Perf-Win8-MSVC-ShuttleB-GPU-HD4600-x86_64-Release-Trybot',
202 'Test-iOS-Clang-iPad4-GPU-SGX554-Arm7-Debug',
203 'Test-Mac10.8-Clang-MacMini4.1-GPU-GeForce320M-x86_64-Release',
204 'Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD',
205 'Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-Shared',
206 'Test-Ubuntu-GCC-ShuttleA-GPU-GTX550Ti-x86_64-Release-Valgrind',
207 'Test-Win8-MSVC-ShuttleB-GPU-HD4600-x86-Release-ANGLE',
208 'Test-Win8-MSVC-ShuttleA-CPU-AVX-x86_64-Debug',
209 ]
210
211 cov = coverage.coverage()
212 cov.start()
213 for case in cases:
214 args[case] = get_builder_spec(case)
215 cov.stop()
216
217 this_file = os.path.basename(__file__)
218 _, _, not_run, _ = cov.analysis(this_file)
219 filtered = [line for line in not_run if
220 line > cov_start and line < cov_end and line not in cov_skip]
221 if filtered:
222 print 'Lines not covered by test cases: ', filtered
223 sys.exit(1)
224
225 golden = this_file.replace('.py', '.json')
226 with open(os.path.join(os.path.dirname(__file__), golden), 'w') as f:
227 json.dump(args, f, indent=2, sort_keys=True)
228
229
230 if __name__ == '__main__':
231 if len(sys.argv) == 2 and sys.argv[1] == 'test':
232 self_test()
233 sys.exit(0)
234
235 if len(sys.argv) != 3:
236 print usage
237 sys.exit(1)
238
239 with open(sys.argv[1], 'w') as out:
240 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