OLD | NEW |
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 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 | 446 |
447 return result | 447 return result |
448 | 448 |
449 | 449 |
450 def all_compile_targets(api, tests): | 450 def all_compile_targets(api, tests): |
451 """Returns the compile_targets for all the Tests in |tests|.""" | 451 """Returns the compile_targets for all the Tests in |tests|.""" |
452 return sorted(set(x | 452 return sorted(set(x |
453 for test in tests | 453 for test in tests |
454 for x in test.compile_targets(api))) | 454 for x in test.compile_targets(api))) |
455 | 455 |
| 456 def is_source_file(api, filepath): |
| 457 """Returns true iff the file is a source file.""" |
| 458 _, ext = api.path.splitext(filepath) |
| 459 return ext in ['.c', '.cc', '.cpp', '.h', '.java', '.mm'] |
| 460 |
456 | 461 |
457 def _RunStepsInternal(api): | 462 def _RunStepsInternal(api): |
458 def get_bot_config(mastername, buildername): | 463 def get_bot_config(mastername, buildername): |
459 master_dict = BUILDERS.get(mastername, {}) | 464 master_dict = BUILDERS.get(mastername, {}) |
460 return master_dict.get('builders', {}).get(buildername) | 465 return master_dict.get('builders', {}).get(buildername) |
461 | 466 |
462 mastername = api.properties.get('mastername') | 467 mastername = api.properties.get('mastername') |
463 buildername = api.properties.get('buildername') | 468 buildername = api.properties.get('buildername') |
464 bot_config = get_bot_config(mastername, buildername) | 469 bot_config = get_bot_config(mastername, buildername) |
465 api.chromium_tests.configure_swarming('chromium', precommit=True) | 470 api.chromium_tests.configure_swarming('chromium', precommit=True) |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
549 # trying to isolate affected targets may fail. | 554 # trying to isolate affected targets may fail. |
550 tests = [] | 555 tests = [] |
551 tests_including_triggered = [] | 556 tests_including_triggered = [] |
552 else: | 557 else: |
553 # Note that compile_targets doesn't necessarily include matching_exes, | 558 # Note that compile_targets doesn't necessarily include matching_exes, |
554 # and for correctness we need to add them. Otherwise it's possible we'd | 559 # and for correctness we need to add them. Otherwise it's possible we'd |
555 # only build say foo_unittests but not foo_unittests_run and fail when | 560 # only build say foo_unittests but not foo_unittests_run and fail when |
556 # trying to isolate the tests. Also see above comment. | 561 # trying to isolate the tests. Also see above comment. |
557 compile_targets = sorted(set(compile_targets + matching_exes)) | 562 compile_targets = sorted(set(compile_targets + matching_exes)) |
558 | 563 |
559 if not requires_compile: | 564 if requires_compile: |
560 return | 565 tests = tests_in_compile_targets(api, matching_exes, tests) |
| 566 tests_including_triggered = tests_in_compile_targets( |
| 567 api, matching_exes, tests_including_triggered) |
561 | 568 |
562 tests = tests_in_compile_targets(api, matching_exes, tests) | 569 api.chromium_tests.compile_specific_targets( |
563 tests_including_triggered = tests_in_compile_targets( | 570 bot_config['mastername'], |
564 api, matching_exes, tests_including_triggered) | 571 bot_config['buildername'], |
565 | 572 bot_update_step, |
566 api.chromium_tests.compile_specific_targets( | 573 master_dict, |
567 bot_config['mastername'], | 574 compile_targets, |
568 bot_config['buildername'], | 575 tests_including_triggered, |
569 bot_update_step, | 576 override_bot_type='builder_tester') |
570 master_dict, | 577 else: |
571 compile_targets, | 578 # Even though the patch doesn't compile on this platform, we'd still like |
572 tests_including_triggered, | 579 # to run tests not depending on compiled targets (that's obviously not |
573 override_bot_type='builder_tester') | 580 # covered by the 'analyze' step) if any source files change. |
| 581 if any([is_source_file(api, f) for f in affected_files]): |
| 582 tests = [t for t in tests if not t.compile_targets(api)] |
574 | 583 |
575 if not tests: | 584 if not tests: |
576 return | 585 return |
577 | 586 |
578 api.chromium_tests.run_tests_and_deapply_as_needed(mastername, api, tests, | 587 api.chromium_tests.run_tests_and_deapply_as_needed(mastername, api, tests, |
579 bot_update_step) | 588 bot_update_step) |
580 | 589 |
581 | 590 |
582 def RunSteps(api): | 591 def RunSteps(api): |
583 with api.tryserver.set_failure_hash(): | 592 with api.tryserver.set_failure_hash(): |
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1154 | 1163 |
1155 yield ( | 1164 yield ( |
1156 api.test('swarming_paths') + | 1165 api.test('swarming_paths') + |
1157 api.properties.tryserver( | 1166 api.properties.tryserver( |
1158 mastername='tryserver.chromium.linux', | 1167 mastername='tryserver.chromium.linux', |
1159 buildername='linux_chromium_rel_ng', | 1168 buildername='linux_chromium_rel_ng', |
1160 path_config='swarming', | 1169 path_config='swarming', |
1161 ) + | 1170 ) + |
1162 api.platform.name('linux') | 1171 api.platform.name('linux') |
1163 ) | 1172 ) |
OLD | NEW |