OLD | NEW |
---|---|
(Empty) | |
1 #!/usr/bin/env python | |
2 # Copyright 2016 The Chromium Authors. All rights reserved. | |
3 # Use of this source code is governed by a BSD-style license that can be | |
4 # found in the LICENSE file. | |
5 | |
6 """Script to generate chromium.gpu.json and chromium.gpu.fyi.json in | |
7 the src/testing/buildbot directory. Maintaining these files by hand is | |
8 too unwieldy. | |
9 """ | |
10 | |
11 import copy | |
12 import json | |
13 import string | |
14 import sys | |
15 | |
16 BUILDERS = [ | |
17 'GPU NextGen Linux Builder', | |
18 'GPU NextGen Linux Builder (dbg)', | |
19 'GPU NextGen Mac Builder', | |
20 'GPU NextGen Mac Builder (dbg)', | |
21 'GPU NextGen Win Builder', | |
22 'GPU NextGen Win Builder (dbg)', | |
23 ] | |
24 | |
25 TESTERS = { | |
26 'Linux NextGen Debug (NVIDIA)': { | |
27 'swarming_dimensions': { | |
28 'gpu': '10de:104a', | |
29 'os': 'Linux' | |
30 }, | |
31 'build_config': 'Debug', | |
32 'swarming': True, | |
33 'os_type': 'linux', | |
34 }, | |
35 'Linux NextGen Release (NVIDIA)': { | |
36 'swarming_dimensions': { | |
37 'gpu': '10de:104a', | |
38 'os': 'Linux' | |
39 }, | |
40 'build_config': 'Release', | |
41 'swarming': True, | |
42 'os_type': 'linux', | |
43 }, | |
44 'Mac 10.10 Debug (ATI)': { | |
45 'swarming_dimensions': { | |
46 'gpu': '1002:679e', | |
47 'os': 'Mac-10.10' | |
48 }, | |
49 'build_config': 'Debug', | |
50 'swarming': False, | |
51 'os_type': 'mac', | |
52 }, | |
53 'Mac 10.10 Release (ATI)': { | |
54 'swarming_dimensions': { | |
55 'gpu': '1002:679e', | |
56 'os': 'Mac-10.10' | |
57 }, | |
58 'build_config': 'Release', | |
59 'swarming': False, | |
60 'os_type': 'mac', | |
61 }, | |
62 'Mac NextGen 10.10 Retina Debug (AMD)': { | |
63 'swarming_dimensions': { | |
64 'gpu': '1002:6821', | |
65 'hidpi': '1', | |
66 'os': 'Mac-10.10' | |
67 }, | |
68 'build_config': 'Debug', | |
69 'swarming': True, | |
70 'os_type': 'mac', | |
71 }, | |
72 'Mac NextGen 10.10 Retina Release (AMD)': { | |
73 'swarming_dimensions': { | |
74 'gpu': '1002:6821', | |
75 'hidpi': '1', | |
76 'os': 'Mac-10.10' | |
77 }, | |
78 'build_config': 'Release', | |
79 'swarming': True, | |
80 'os_type': 'mac', | |
81 }, | |
82 'Win7 NextGen Debug (NVIDIA)': { | |
83 'swarming_dimensions': { | |
84 'gpu': '10de:104a', | |
85 'os': 'Windows-2008ServerR2-SP1' | |
86 }, | |
87 'build_config': 'Debug', | |
88 'swarming': True, | |
89 'os_type': 'win', | |
90 }, | |
91 'Win7 NextGen Release (AMD)': { | |
92 'swarming_dimensions': { | |
93 'gpu': '1002:6779', | |
94 'os': 'Windows-2008ServerR2-SP1' | |
95 }, | |
96 'build_config': 'Release', | |
97 'swarming': True, | |
98 'os_type': 'win', | |
99 }, | |
100 'Win7 NextGen Release (Intel)': { | |
101 'swarming_dimensions': { | |
102 'gpu': '8086:041a', | |
103 'os': 'Windows-2008ServerR2-SP1' | |
104 }, | |
105 'build_config': 'Release', | |
106 'swarming': False, | |
107 'os_type': 'win', | |
108 }, | |
109 'Win7 NextGen Release (NVIDIA)': { | |
110 'swarming_dimensions': { | |
111 'gpu': '10de:104a', | |
112 'os': 'Windows-2008ServerR2-SP1' | |
113 }, | |
114 'build_config': 'Release', | |
115 'swarming': True, | |
116 'os_type': 'win', | |
117 }, | |
118 'Win7 NextGen dEQP (NVIDIA)': { | |
119 'deqp': True, | |
120 'swarming_dimensions': { | |
121 'gpu': '10de:104a', | |
122 'os': 'Windows-2008ServerR2-SP1' | |
123 }, | |
124 'build_config': 'Release', | |
125 'swarming': True, | |
126 'os_type': 'win', | |
127 }, | |
128 'Win8 NextGen Debug (NVIDIA)': { | |
129 'swarming_dimensions': { | |
130 'gpu': '10de:104a', | |
131 'os': 'Windows-2012ServerR2-SP0' | |
132 }, | |
133 'build_config': 'Debug', | |
134 'swarming': True, | |
135 'os_type': 'win', | |
136 }, | |
137 'Win8 NextGen Release (NVIDIA)': { | |
138 'swarming_dimensions': { | |
139 'gpu': '10de:104a', | |
140 'os': 'Windows-2012ServerR2-SP0' | |
141 }, | |
142 'build_config': 'Release', | |
143 'swarming': True, | |
144 'os_type': 'win', | |
145 }, | |
146 } | |
147 | |
148 COMMON_GTESTS = { | |
149 'angle_end2end_tests': {'args': ['--use-gpu-in-tests']}, | |
150 'angle_unittests': {'args': ['--use-gpu-in-tests']}, | |
151 'content_gl_tests': {'args': ['--use-gpu-in-tests']}, | |
152 'gl_tests': {'args': ['--use-gpu-in-tests']}, | |
153 'gl_unittests': {'args': ['--use-gpu-in-tests']}, | |
154 } | |
155 | |
156 RELEASE_ONLY_GTESTS = { | |
157 'tab_capture_end2end_tests': { | |
158 'override_compile_targets': [ | |
159 'tab_capture_end2end_tests_run', | |
160 ], | |
161 }, | |
162 } | |
163 | |
164 # This requires a hack because the isolate's name is different than | |
165 # the executable's name. On the few non-swarmed testers, this causes | |
166 # the executable to not be found. It would be better if the Chromium | |
167 # recipe supported running isolates locally. crbug.com/581953 | |
168 | |
169 NON_SWARMED_GTESTS = { | |
170 'tab_capture_end2end_tests': { | |
171 'test': 'browser_tests', | |
172 'args': [ | |
173 '--enable-gpu', | |
174 '--test-launcher-jobs=1', | |
175 '--gtest_filter=CastStreamingApiTestWithPixelOutput.EndToEnd*:' + \ | |
176 'TabCaptureApiPixelTest.EndToEnd*' | |
177 ] | |
178 } | |
179 } | |
180 | |
181 # Until the media-only tests are extracted from content_unittests and | |
182 # these both can be run on the commit queue with | |
183 # --require-audio-hardware-for-testing, run them only on the FYI | |
184 # waterfall. | |
185 # | |
186 # Note that the transition to the Chromium recipe has forced the | |
187 # removal of the --require-audio-hardware-for-testing flag for the | |
188 # time being. See crbug.com/574942. | |
189 FYI_ONLY_GTESTS = { | |
190 'audio_unittests': {'args': ['--use-gpu-in-tests']}, | |
191 'content_unittests': {}, | |
192 # The gles2_conform_tests are closed-source and deliberately only run | |
193 # on the FYI waterfall. | |
194 'gles2_conform_test': {'args': ['--use-gpu-in-tests']}, | |
195 'gles2_conform_d3d9_test': { | |
196 'win_only': True, | |
197 'args': [ | |
198 '--use-gpu-in-tests', | |
199 '--use-angle=d3d9', | |
200 ], | |
201 'test': 'gles2_conform_test', | |
202 }, | |
203 'gles2_conform_gl_test': { | |
204 'win_only': True, | |
205 'args': [ | |
206 '--use-gpu-in-tests', | |
207 '--use-angle=gl', | |
208 '--disable-gpu-sandbox', | |
209 ], | |
210 'test': 'gles2_conform_test', | |
211 } | |
212 } | |
213 | |
214 DEQP_GTESTS = { | |
215 'angle_deqp_gles2_tests': {'swarming_shards': 4}, | |
216 'angle_deqp_gles3_tests': {'swarming_shards': 12}, | |
217 } | |
218 | |
219 TELEMETRY_TESTS = { | |
220 'context_lost': {}, | |
221 'gpu_process_launch_tests': {'target_name': 'gpu_process'}, | |
222 'gpu_rasterization': {}, | |
223 'hardware_accelerated_feature': {}, | |
224 'maps_pixel_test': {'target_name': 'maps'}, | |
225 'memory_test': {}, | |
226 'pixel_test': { | |
227 'target_name': 'pixel', | |
228 'args': [ | |
229 '--refimg-cloud-storage-bucket', | |
230 'chromium-gpu-archive/reference-images', | |
231 '--os-type', | |
232 '${os_type}', | |
233 '--build-revision', | |
234 '${got_revision}', | |
235 '--test-machine-name', | |
236 '${buildername}', | |
237 ], | |
238 'non_precommit_args': [ | |
239 '--upload-refimg-to-cloud-storage', | |
240 ], | |
241 'precommit_args': [ | |
242 '--download-refimg-from-cloud-storage', | |
243 ] | |
244 }, | |
245 'screenshot_sync': {}, | |
246 'trace_test': {}, | |
247 'webgl_conformance': {}, | |
248 'webgl_conformance_d3d9_tests': { | |
249 'win_only': True, | |
250 'target_name': 'webgl_conformance', | |
251 'extra_browser_args': [ | |
252 '--use-angle=d3d9', | |
253 ], | |
254 }, | |
255 'webgl_conformance_gl_tests': { | |
256 'win_only': True, | |
257 'target_name': 'webgl_conformance', | |
258 'extra_browser_args': [ | |
259 '--use-angle=gl', | |
260 ], | |
261 }, | |
262 'webgl2_conformance_tests': { | |
263 'target_name': 'webgl_conformance', | |
264 'args': [ | |
265 '--webgl-conformance-version=2.0.0', | |
266 '--webgl2-only=true', | |
267 ], | |
268 }, | |
269 } | |
270 | |
271 def substitute_args(tester_config, args): | |
272 """Substitutes the ${os_type} variable in |args| from the | |
273 tester_config's "os_type" property. | |
274 """ | |
275 substitutions = { | |
276 'os_type': tester_config['os_type'] | |
277 } | |
278 return [string.Template(arg).safe_substitute(substitutions) for arg in args] | |
279 | |
280 def generate_gtest(tester_config, test, test_config): | |
281 result = copy.deepcopy(test_config) | |
282 if result.get('win_only'): | |
283 if tester_config['os_type'] != 'win': | |
284 return None | |
285 # Don't print this in the JSON. | |
286 result.pop('win_only') | |
287 if 'test' in result: | |
288 result['name'] = test | |
289 else: | |
290 result['test'] = test | |
291 if (not tester_config['swarming']) and test in NON_SWARMED_GTESTS: | |
292 # Need to override this result. | |
293 result = copy.deepcopy(NON_SWARMED_GTESTS[test]) | |
294 result['name'] = test | |
295 else: | |
296 # Put the swarming dimensions in anyway. If the tester is later | |
297 # swarmed, they will come in handy. | |
298 result['swarming'] = { | |
299 'can_use_on_swarming_builders': True, | |
300 'dimension_sets': [ | |
301 tester_config['swarming_dimensions'] | |
302 ], | |
303 } | |
304 if result.get('swarming_shards'): | |
305 result['swarming']['shards'] = result['swarming_shards'] | |
306 result.pop('swarming_shards') | |
307 # print "generating " + test | |
308 return result | |
309 | |
310 def generate_telemetry_test(tester_config, test, test_config): | |
311 if test_config.get('win_only'): | |
312 if tester_config['os_type'] != 'win': | |
313 return None | |
314 test_args = ['-v'] | |
315 # --expose-gc allows the WebGL conformance tests to more reliably | |
316 # reproduce GC-related bugs in the V8 bindings. | |
317 extra_browser_args_string = ( | |
318 '--enable-logging=stderr --js-flags=--expose-gc') | |
319 if 'extra_browser_args' in test_config: | |
320 extra_browser_args_string += ' ' + ' '.join( | |
321 test_config['extra_browser_args']) | |
322 test_args.append('--extra-browser-args=\"' + extra_browser_args_string + | |
323 '\"') | |
324 if 'args' in test_config: | |
325 test_args.extend(substitute_args(tester_config, test_config['args'])) | |
326 # The step name must end in 'test' or 'tests' in order for the | |
327 # results to automatically show up on the flakiness dashboard. | |
328 # (At least, this was true some time ago.) Continue to use this | |
329 # naming convention for the time being to minimize changes. | |
330 step_name = test | |
331 if not (step_name.endswith('test') or step_name.endswith('tests')): | |
332 step_name = '%s_tests' % step_name | |
333 # Prepend Telemetry GPU-specific flags. | |
334 benchmark_name = test_config.get('target_name') or test | |
335 prefix_args = [ | |
336 benchmark_name, | |
337 '--show-stdout', | |
338 '--browser=%s' % tester_config['build_config'].lower() | |
339 ] | |
340 result = { | |
341 'args': prefix_args + test_args, | |
342 'isolate_name': 'telemetry_gpu_test', | |
343 'name': step_name, | |
344 'override_compile_targets': [ | |
345 'telemetry_gpu_test_run' | |
346 ], | |
347 'swarming': { | |
348 # Always say this is true regardless of whether the tester | |
349 # supports swarming. It doesn't hurt. | |
350 'can_use_on_swarming_builders': True, | |
351 'dimension_sets': [ | |
352 tester_config['swarming_dimensions'] | |
353 ] | |
354 } | |
355 } | |
356 if 'non_precommit_args' in test_config: | |
357 result['non_precommit_args'] = test_config['non_precommit_args'] | |
358 if 'precommit_args' in test_config: | |
359 result['precommit_args'] = test_config['precommit_args'] | |
360 return result | |
361 | |
362 def generate_gtests(tester_config, test_dictionary): | |
363 # The relative ordering of some of the tests is important to | |
364 # minimize differences compared to the handwritten JSON files, since | |
365 # Python's sorts are stable and there are some tests with the same | |
366 # key (see gles2_conform_d3d9_test and similar variants). Avoid | |
367 # losing the order by avoiding coalescing the dictionaries into one. | |
368 gtests = [] | |
369 for test_name, test_config in sorted(test_dictionary.iteritems()): | |
370 test = generate_gtest(tester_config, test_name, test_config) | |
371 if test: | |
372 # generate_gtest may veto the test generation on this platform. | |
373 gtests.append(test) | |
374 return gtests | |
375 | |
376 def generate_all_tests(): | |
377 tests = {} | |
378 for builder in BUILDERS: | |
379 tests[builder] = {} | |
380 for name, config in TESTERS.iteritems(): | |
381 gtests = [] | |
382 if config.get('deqp'): | |
383 gtests.extend(generate_gtests(config, DEQP_GTESTS)) | |
384 else: | |
385 gtests.extend(generate_gtests(config, COMMON_GTESTS)) | |
386 if config['build_config'] == 'Release': | |
387 gtests.extend(generate_gtests(config, RELEASE_ONLY_GTESTS)) | |
388 # For the moment we're only generating the FYI waterfall's tests. | |
389 gtests.extend(generate_gtests(config, FYI_ONLY_GTESTS)) | |
390 isolated_scripts = [] | |
391 if not config.get('deqp'): | |
392 for test_name, test_config in sorted(TELEMETRY_TESTS.iteritems()): | |
393 test = generate_telemetry_test(config, test_name, test_config) | |
394 if test: | |
395 isolated_scripts.append(test) | |
396 cur_tests = {} | |
397 if gtests: | |
398 cur_tests['gtest_tests'] = sorted(gtests, key=lambda x: x['test']) | |
399 if isolated_scripts: | |
400 cur_tests['isolated_scripts'] = sorted( | |
401 isolated_scripts, key=lambda x: x['name']) | |
402 tests[name] = cur_tests | |
403 tests['AAAAA1 AUTOGENERATED FILE DO NOT EDIT'] = {} | |
404 tests['AAAAA2 See generate_buildbot_json.py to make changes'] = {} | |
Dirk Pranke
2016/01/28 23:53:24
these two lines are part of the reason I wish we h
| |
405 print json.dumps(tests, indent=2, separators=(',', ': '), sort_keys=True) | |
406 | |
407 if __name__ == "__main__": | |
408 sys.exit(generate_all_tests()) | |
OLD | NEW |