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

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

Issue 963263002: Run scripts which don't have any compile targets if any source files change. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/build@master
Patch Set: Created 5 years, 9 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 from infra.libs.infra_types import freeze 5 from infra.libs.infra_types import freeze
6 6
7 DEPS = [ 7 DEPS = [
8 'bot_update', 8 'bot_update',
9 'chromium', 9 'chromium',
10 'chromium_android', 10 'chromium_android',
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 return result 277 return result
278 278
279 279
280 def all_compile_targets(api, tests): 280 def all_compile_targets(api, tests):
281 """Returns the compile_targets for all the Tests in |tests|.""" 281 """Returns the compile_targets for all the Tests in |tests|."""
282 return sorted(set(x 282 return sorted(set(x
283 for test in tests 283 for test in tests
284 for x in test.compile_targets(api))) 284 for x in test.compile_targets(api)))
285 285
286 286
287 def is_source_file(api, file):
288 """Returns true iff the file is a source file."""
289 _, ext = api.path.splitext(file)
290 return ext in [".cc", ".cpp", ".h", ".java", ".mm"]
291
292
287 def _GenStepsInternal(api): 293 def _GenStepsInternal(api):
288 def get_bot_config(mastername, buildername): 294 def get_bot_config(mastername, buildername):
289 master_dict = BUILDERS.get(mastername, {}) 295 master_dict = BUILDERS.get(mastername, {})
290 return master_dict.get('builders', {}).get(buildername) 296 return master_dict.get('builders', {}).get(buildername)
291 297
292 mastername = api.properties.get('mastername') 298 mastername = api.properties.get('mastername')
293 buildername = api.properties.get('buildername') 299 buildername = api.properties.get('buildername')
294 bot_config = get_bot_config(mastername, buildername) 300 bot_config = get_bot_config(mastername, buildername)
295 api.chromium_tests.configure_swarming('chromium', precommit=True) 301 api.chromium_tests.configure_swarming('chromium', precommit=True)
296 302
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 override_bot_type='builder_tester', 358 override_bot_type='builder_tester',
353 override_tests=tests) 359 override_tests=tests)
354 360
355 requires_compile, _, compile_targets = \ 361 requires_compile, _, compile_targets = \
356 api.chromium_tests.analyze( 362 api.chromium_tests.analyze(
357 affected_files, 363 affected_files,
358 all_compile_targets(api, tests + tests_including_triggered), 364 all_compile_targets(api, tests + tests_including_triggered),
359 compile_targets, 365 compile_targets,
360 'trybot_analyze_config.json') 366 'trybot_analyze_config.json')
361 367
362 if not requires_compile: 368 if requires_compile:
363 return 369 tests = tests_in_compile_targets(api, compile_targets, tests)
370 tests_including_triggered = tests_in_compile_targets(
371 api, compile_targets, tests_including_triggered)
364 372
365 tests = tests_in_compile_targets(api, compile_targets, tests) 373 api.chromium_tests.compile_specific_targets(
366 tests_including_triggered = tests_in_compile_targets( 374 bot_config['mastername'],
367 api, compile_targets, tests_including_triggered) 375 bot_config['buildername'],
368 376 bot_update_step,
369 api.chromium_tests.compile_specific_targets( 377 master_dict,
370 bot_config['mastername'], 378 test_spec,
371 bot_config['buildername'], 379 compile_targets,
372 bot_update_step, 380 tests_including_triggered,
373 master_dict, 381 override_bot_type='builder_tester')
374 test_spec, 382 else:
375 compile_targets, 383 # Even though the patch doesn't require compile on this platform, we'd still
376 tests_including_triggered, 384 # like to run tests not depending on compiled targets (that's obviously not
377 override_bot_type='builder_tester') 385 # covered by the "analyze" step) if any source files change.
386 if any([is_source_file(api, f) for f in affected_files]):
387 tests = [t for t in tests if not t.compile_targets(api)]
388 else:
389 return
luqui 2015/03/02 23:21:53 You could either add a test for it in GenTests (ge
jam 2015/03/04 15:16:41 right, i didn't know how to do the "somehow" part
luqui 2015/03/04 21:51:04 You could try yield (api.test('...') +
378 390
379 def deapply_patch_fn(failing_tests): 391 def deapply_patch_fn(failing_tests):
380 api.chromium_tests.deapply_patch(bot_update_step) 392 api.chromium_tests.deapply_patch(bot_update_step)
381 compile_targets = list(api.itertools.chain( 393 compile_targets = list(api.itertools.chain(
382 *[t.compile_targets(api) for t in failing_tests])) 394 *[t.compile_targets(api) for t in failing_tests]))
383 if compile_targets: 395 if compile_targets:
384 # Remove duplicate targets. 396 # Remove duplicate targets.
385 compile_targets = sorted(set(compile_targets)) 397 compile_targets = sorted(set(compile_targets))
386 has_failing_swarming_tests = [ 398 has_failing_swarming_tests = [
387 t for t in failing_tests if t.uses_swarming] 399 t for t in failing_tests if t.uses_swarming]
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after
888 tryserver=True) 900 tryserver=True)
889 yield step_failure(mastername='tryserver.chromium.linux', 901 yield step_failure(mastername='tryserver.chromium.linux',
890 buildername='android_clang_dbg_recipe', 902 buildername='android_clang_dbg_recipe',
891 steps=['findbugs (with patch)'], 903 steps=['findbugs (with patch)'],
892 tryserver=True) 904 tryserver=True)
893 yield step_failure(mastername='tryserver.chromium.linux', 905 yield step_failure(mastername='tryserver.chromium.linux',
894 buildername='android_clang_dbg_recipe', 906 buildername='android_clang_dbg_recipe',
895 steps=['findbugs (with patch)', 907 steps=['findbugs (with patch)',
896 'findbugs (without patch)'], 908 'findbugs (without patch)'],
897 tryserver=True) 909 tryserver=True)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698