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

Side by Side Diff: scripts/slave/recipes/chromium_trybot.py

Issue 1565113003: Add concept of bot config and test spec database (BotConfigAndTestDB). (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/build.git@master
Patch Set: Created 4 years, 11 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
OLDNEW
1 # Copyright 2013 The Chromium Authors. All rights reserved. 1 # Copyright 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import collections 5 import collections
6 6
7 from recipe_engine.types import freeze 7 from recipe_engine.types import freeze
8 8
9 DEPS = [ 9 DEPS = [
10 'amp', 10 'amp',
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 for test in tests 192 for test in tests
193 for x in test.compile_targets(api))) 193 for x in test.compile_targets(api)))
194 194
195 195
196 def is_source_file(api, filepath): 196 def is_source_file(api, filepath):
197 """Returns true iff the file is a source file.""" 197 """Returns true iff the file is a source file."""
198 _, ext = api.path.splitext(filepath) 198 _, ext = api.path.splitext(filepath)
199 return ext in ['.c', '.cc', '.cpp', '.h', '.java', '.mm'] 199 return ext in ['.c', '.cc', '.cpp', '.h', '.java', '.mm']
200 200
201 def _RunStepsInternal(api): 201 def _RunStepsInternal(api):
202 def get_bot_config(mastername, buildername): 202 def _get_bot_config(mastername, buildername):
203 master_dict = api.chromium_tests.trybots.get(mastername, {}) 203 master_dict = api.chromium_tests.trybots.get(mastername, {})
204 return master_dict.get('builders', {}).get(buildername) 204 return master_dict.get('builders', {}).get(buildername)
205 205
206 mastername = api.properties.get('mastername') 206 mastername = api.properties.get('mastername')
207 buildername = api.properties.get('buildername') 207 buildername = api.properties.get('buildername')
208 bot_config = get_bot_config(mastername, buildername) 208 bot_config = _get_bot_config(mastername, buildername)
209 209
210 # TODO(sergiyb): This is a temporary hack to run GPU tests on tryserver 210 # TODO(sergiyb): This is a temporary hack to run GPU tests on tryserver
211 # only. This should be removed when we will convert chromium.gpu waterfall 211 # only. This should be removed when we will convert chromium.gpu waterfall
212 # to swarming and be able to replicate the tests to tryserver automatically. 212 # to swarming and be able to replicate the tests to tryserver automatically.
213 master = api.properties['mastername'] 213 master = api.properties['mastername']
214 builder = api.properties['buildername'] 214 builder = api.properties['buildername']
215 enable_gpu_tests = builder in CHROMIUM_GPU_DIMENSION_SETS.get(master, {}) 215 enable_gpu_tests = builder in CHROMIUM_GPU_DIMENSION_SETS.get(master, {})
216 216
217 api.chromium_tests.configure_build( 217 api.chromium_tests.configure_build(
218 bot_config['mastername'], 218 bot_config['mastername'],
219 bot_config['buildername'], 219 bot_config['buildername'],
220 override_bot_type='builder_tester') 220 override_bot_type='builder_tester')
221 221
222 api.chromium_tests.configure_swarming('chromium', precommit=True) 222 api.chromium_tests.configure_swarming('chromium', precommit=True)
223 223
224 api.chromium.apply_config('trybot_flavor') 224 api.chromium.apply_config('trybot_flavor')
225 if enable_gpu_tests: 225 if enable_gpu_tests:
226 api.chromium.apply_config('archive_gpu_tests') 226 api.chromium.apply_config('archive_gpu_tests')
227 api.chromium.apply_config('chrome_with_codecs') 227 api.chromium.apply_config('chrome_with_codecs')
228 228
229 if api.properties.get('patch_project') == 'blink': # pragma: no cover 229 if api.properties.get('patch_project') == 'blink': # pragma: no cover
230 raise Exception('CLs which use blink project are not supported. ' 230 raise Exception('CLs which use blink project are not supported. '
231 'Please re-create the CL using fresh checkout after ' 231 'Please re-create the CL using fresh checkout after '
232 'the blink merge.') 232 'the blink merge.')
233 233
234 bot_update_step, master_dict, test_spec = \ 234 bot_update_step, bot_db = \
235 api.chromium_tests.prepare_checkout( 235 api.chromium_tests.prepare_checkout(
236 bot_config['mastername'], 236 bot_config['mastername'],
237 bot_config['buildername']) 237 bot_config['buildername'])
238 238
239 tests = list(api.chromium_tests.tests_for_builder( 239 tests = list(api.chromium_tests.tests_for_builder(
240 bot_config['mastername'], 240 bot_config['mastername'],
241 bot_config['buildername'], 241 bot_config['buildername'],
242 bot_update_step, 242 bot_update_step,
243 master_dict, 243 bot_db,
244 override_bot_type='builder_tester')) 244 override_bot_type='builder_tester'))
245 tester = bot_config.get('tester', '') 245 tester = bot_config.get('tester', '')
246 if tester: 246 if tester:
247 test_config = master_dict.get('builders', {}).get(tester) 247 test_config = bot_db.get_bot_config(bot_config['mastername'], tester)
248 for key, value in test_config.get('swarming_dimensions', {}).iteritems(): 248 for key, value in test_config.get('swarming_dimensions', {}).iteritems():
249 api.swarming.set_default_dimension(key, value) 249 api.swarming.set_default_dimension(key, value)
250 tests.extend(api.chromium_tests.tests_for_builder( 250 tests.extend(api.chromium_tests.tests_for_builder(
251 bot_config['mastername'], 251 bot_config['mastername'],
252 tester, 252 tester,
253 bot_update_step, 253 bot_update_step,
254 master_dict, 254 bot_db,
255 override_bot_type='builder_tester')) 255 override_bot_type='builder_tester'))
256 256
257 if enable_gpu_tests: 257 if enable_gpu_tests:
258 tests.extend(api.gpu.create_tests( 258 tests.extend(api.gpu.create_tests(
259 bot_update_step.presentation.properties['got_revision'], 259 bot_update_step.presentation.properties['got_revision'],
260 bot_update_step.presentation.properties['got_revision'], 260 bot_update_step.presentation.properties['got_revision'],
261 enable_swarming=True, 261 enable_swarming=True,
262 swarming_dimension_sets=CHROMIUM_GPU_DIMENSION_SETS[master][builder])) 262 swarming_dimension_sets=CHROMIUM_GPU_DIMENSION_SETS[master][builder]))
263 263
264 affected_files = api.tryserver.get_files_affected_by_patch() 264 affected_files = api.tryserver.get_files_affected_by_patch()
(...skipping 25 matching lines...) Expand all
290 api.chromium_tests.steps.GTestTest('blink_heap_unittests'), 290 api.chromium_tests.steps.GTestTest('blink_heap_unittests'),
291 api.chromium_tests.steps.GTestTest('blink_platform_unittests'), 291 api.chromium_tests.steps.GTestTest('blink_platform_unittests'),
292 api.chromium_tests.steps.GTestTest('webkit_unit_tests'), 292 api.chromium_tests.steps.GTestTest('webkit_unit_tests'),
293 api.chromium_tests.steps.GTestTest('wtf_unittests'), 293 api.chromium_tests.steps.GTestTest('wtf_unittests'),
294 ]) 294 ])
295 295
296 compile_targets, tests_including_triggered = \ 296 compile_targets, tests_including_triggered = \
297 api.chromium_tests.get_compile_targets_and_tests( 297 api.chromium_tests.get_compile_targets_and_tests(
298 bot_config['mastername'], 298 bot_config['mastername'],
299 bot_config['buildername'], 299 bot_config['buildername'],
300 master_dict, 300 bot_db,
301 test_spec,
302 override_bot_type='builder_tester', 301 override_bot_type='builder_tester',
303 override_tests=tests) 302 override_tests=tests)
304 303
305 test_targets = sorted(set( 304 test_targets = sorted(set(
306 all_compile_targets(api, tests + tests_including_triggered))) 305 all_compile_targets(api, tests + tests_including_triggered)))
307 additional_compile_targets = sorted(set(compile_targets) - 306 additional_compile_targets = sorted(set(compile_targets) -
308 set(test_targets)) 307 set(test_targets))
309 test_targets, compile_targets = \ 308 test_targets, compile_targets = \
310 api.chromium_tests.analyze(affected_files, 309 api.chromium_tests.analyze(affected_files,
311 test_targets, 310 test_targets,
(...skipping 26 matching lines...) Expand all
338 tests.extend(blink_tests) 337 tests.extend(blink_tests)
339 tests_including_triggered.extend(blink_tests) 338 tests_including_triggered.extend(blink_tests)
340 for test in blink_tests: 339 for test in blink_tests:
341 compile_targets.extend(test.compile_targets(api)) 340 compile_targets.extend(test.compile_targets(api))
342 compile_targets = sorted(set(compile_targets)) 341 compile_targets = sorted(set(compile_targets))
343 342
344 api.chromium_tests.compile_specific_targets( 343 api.chromium_tests.compile_specific_targets(
345 bot_config['mastername'], 344 bot_config['mastername'],
346 bot_config['buildername'], 345 bot_config['buildername'],
347 bot_update_step, 346 bot_update_step,
348 master_dict, 347 bot_db,
349 compile_targets, 348 compile_targets,
350 tests_including_triggered, 349 tests_including_triggered,
351 override_bot_type='builder_tester') 350 override_bot_type='builder_tester')
352 else: 351 else:
353 # Even though the patch doesn't require a compile on this platform, 352 # Even though the patch doesn't require a compile on this platform,
354 # we'd still like to run tests not depending on 353 # we'd still like to run tests not depending on
355 # compiled targets (that's obviously not covered by the 354 # compiled targets (that's obviously not covered by the
356 # 'analyze' step) if any source files change. 355 # 'analyze' step) if any source files change.
357 if any([is_source_file(api, f) for f in affected_files]): 356 if any([is_source_file(api, f) for f in affected_files]):
358 tests = [t for t in tests if not t.compile_targets(api)] 357 tests = [t for t in tests if not t.compile_targets(api)]
(...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after
1076 api.test_utils.canned_test_output(passing=True)) 1075 api.test_utils.canned_test_output(passing=True))
1077 ) 1076 )
1078 1077
1079 yield ( 1078 yield (
1080 api.test('use_v8_patch_on_blink_trybot') + 1079 api.test('use_v8_patch_on_blink_trybot') +
1081 props(mastername='tryserver.blink', 1080 props(mastername='tryserver.blink',
1082 buildername='mac_blink_rel', 1081 buildername='mac_blink_rel',
1083 patch_project='v8') + 1082 patch_project='v8') +
1084 api.platform.name('mac') 1083 api.platform.name('mac')
1085 ) 1084 )
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698