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 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 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
646 return result | 646 return result |
647 | 647 |
648 | 648 |
649 def all_compile_targets(api, tests): | 649 def all_compile_targets(api, tests): |
650 """Returns the compile_targets for all the Tests in |tests|.""" | 650 """Returns the compile_targets for all the Tests in |tests|.""" |
651 return sorted(set(x | 651 return sorted(set(x |
652 for test in tests | 652 for test in tests |
653 for x in test.compile_targets(api))) | 653 for x in test.compile_targets(api))) |
654 | 654 |
655 | 655 |
| 656 def is_source_file(api, filepath): |
| 657 """Returns true iff the file is a source file.""" |
| 658 _, ext = api.path.splitext(filepath) |
| 659 return ext in ['.c', '.cc', '.cpp', '.h', '.java', '.mm'] |
| 660 |
656 def _RunStepsInternal(api): | 661 def _RunStepsInternal(api): |
657 def get_bot_config(mastername, buildername): | 662 def get_bot_config(mastername, buildername): |
658 master_dict = BUILDERS.get(mastername, {}) | 663 master_dict = BUILDERS.get(mastername, {}) |
659 return master_dict.get('builders', {}).get(buildername) | 664 return master_dict.get('builders', {}).get(buildername) |
660 | 665 |
661 mastername = api.properties.get('mastername') | 666 mastername = api.properties.get('mastername') |
662 buildername = api.properties.get('buildername') | 667 buildername = api.properties.get('buildername') |
663 bot_config = get_bot_config(mastername, buildername) | 668 bot_config = get_bot_config(mastername, buildername) |
664 api.chromium_tests.configure_swarming('chromium', precommit=True) | 669 api.chromium_tests.configure_swarming('chromium', precommit=True) |
665 | 670 |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
760 tests = [] | 765 tests = [] |
761 tests_including_triggered = [] | 766 tests_including_triggered = [] |
762 else: | 767 else: |
763 # Note that compile_targets doesn't necessarily include matching_exes, | 768 # Note that compile_targets doesn't necessarily include matching_exes, |
764 # and for correctness we need to add them. Otherwise it's possible we'd | 769 # and for correctness we need to add them. Otherwise it's possible we'd |
765 # only build say foo_unittests but not foo_unittests_run and fail when | 770 # only build say foo_unittests but not foo_unittests_run and fail when |
766 # trying to isolate the tests. Also see above comment. | 771 # trying to isolate the tests. Also see above comment. |
767 compile_targets = sorted(set(compile_targets + matching_exes)) | 772 compile_targets = sorted(set(compile_targets + matching_exes)) |
768 | 773 |
769 # Blink tests have to bypass "analyze", see below. | 774 # Blink tests have to bypass "analyze", see below. |
770 if not requires_compile and not add_blink_tests: | 775 if requires_compile or add_blink_tests: |
771 return | 776 tests = tests_in_compile_targets(api, matching_exes, tests) |
| 777 tests_including_triggered = tests_in_compile_targets( |
| 778 api, matching_exes, tests_including_triggered) |
772 | 779 |
773 tests = tests_in_compile_targets(api, matching_exes, tests) | 780 # Blink tests are tricky at this moment. We'd like to use "analyze" for |
774 tests_including_triggered = tests_in_compile_targets( | 781 # everything else. However, there are blink changes that only add or modify |
775 api, matching_exes, tests_including_triggered) | 782 # layout test files (html etc). This is not recognized by "analyze" as |
| 783 # compile dependency. However, the blink tests should still be executed. |
| 784 if add_blink_tests: |
| 785 blink_tests = [ |
| 786 api.chromium_tests.steps.ScriptTest( |
| 787 'webkit_lint', 'webkit_lint.py', collections.defaultdict(list)), |
| 788 api.chromium_tests.steps.ScriptTest( |
| 789 'webkit_python_tests', 'webkit_python_tests.py', |
| 790 collections.defaultdict(list)), |
| 791 api.chromium_tests.steps.BlinkTest(), |
| 792 ] |
| 793 tests.extend(blink_tests) |
| 794 tests_including_triggered.extend(blink_tests) |
| 795 for test in blink_tests: |
| 796 compile_targets.extend(test.compile_targets(api)) |
| 797 compile_targets = sorted(set(compile_targets)) |
776 | 798 |
777 # Blink tests are tricky at this moment. We'd like to use "analyze" for | 799 api.chromium_tests.compile_specific_targets( |
778 # everything else. However, there are blink changes that only add or modify | 800 bot_config['mastername'], |
779 # layout test files (html etc). This is not recognized by "analyze" as | 801 bot_config['buildername'], |
780 # compile dependency. However, the blink tests should still be executed. | 802 bot_update_step, |
781 if add_blink_tests: | 803 master_dict, |
782 blink_tests = [ | 804 compile_targets, |
783 api.chromium_tests.steps.ScriptTest( | 805 tests_including_triggered, |
784 'webkit_lint', 'webkit_lint.py', collections.defaultdict(list)), | 806 override_bot_type='builder_tester') |
785 api.chromium_tests.steps.ScriptTest( | 807 else: |
786 'webkit_python_tests', 'webkit_python_tests.py', | 808 # Even though the patch doesn't compile on this platform, we'd still like |
787 collections.defaultdict(list)), | 809 # to run tests not depending on compiled targets (that's obviously not |
788 api.chromium_tests.steps.BlinkTest(), | 810 # covered by the 'analyze' step) if any source files change. |
789 ] | 811 if any([is_source_file(api, f) for f in affected_files]): |
790 tests.extend(blink_tests) | 812 tests = [t for t in tests if not t.compile_targets(api)] |
791 tests_including_triggered.extend(blink_tests) | 813 else: |
792 for test in blink_tests: | 814 return |
793 compile_targets.extend(test.compile_targets(api)) | |
794 compile_targets = sorted(set(compile_targets)) | |
795 | |
796 api.chromium_tests.compile_specific_targets( | |
797 bot_config['mastername'], | |
798 bot_config['buildername'], | |
799 bot_update_step, | |
800 master_dict, | |
801 compile_targets, | |
802 tests_including_triggered, | |
803 override_bot_type='builder_tester') | |
804 | 815 |
805 if not tests: | 816 if not tests: |
806 return | 817 return |
807 | 818 |
808 api.chromium_tests.run_tests_and_deapply_as_needed(mastername, api, tests, | 819 api.chromium_tests.run_tests_and_deapply_as_needed(mastername, api, tests, |
809 bot_update_step) | 820 bot_update_step) |
810 | 821 |
811 | 822 |
812 def RunSteps(api): | 823 def RunSteps(api): |
813 # build/tests/masters_recipes_tests.py needs to manipulate the BUILDERS | 824 # build/tests/masters_recipes_tests.py needs to manipulate the BUILDERS |
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1429 api.test('analyze_runs_nothing') + | 1440 api.test('analyze_runs_nothing') + |
1430 api.properties.tryserver( | 1441 api.properties.tryserver( |
1431 mastername='tryserver.chromium.win', | 1442 mastername='tryserver.chromium.win', |
1432 buildername='win_chromium_rel_ng', | 1443 buildername='win_chromium_rel_ng', |
1433 swarm_hashes={} | 1444 swarm_hashes={} |
1434 ) + | 1445 ) + |
1435 api.platform.name('win') + | 1446 api.platform.name('win') + |
1436 api.override_step_data('analyze', api.gpu.analyze_builds_nothing) | 1447 api.override_step_data('analyze', api.gpu.analyze_builds_nothing) |
1437 ) | 1448 ) |
1438 | 1449 |
| 1450 # Tests that we run nothing if analyze said we didn't have to run anything |
| 1451 # and there were no source file changes. |
| 1452 yield ( |
| 1453 api.test('analyze_runs_nothing_with_no_source_file_changes') + |
| 1454 api.properties.tryserver( |
| 1455 mastername='tryserver.chromium.win', |
| 1456 buildername='win_chromium_rel_ng', |
| 1457 swarm_hashes={} |
| 1458 ) + |
| 1459 api.platform.name('win') + |
| 1460 api.override_step_data('analyze', api.gpu.analyze_builds_nothing) + |
| 1461 api.override_step_data( |
| 1462 'git diff to analyze patch', |
| 1463 api.raw_io.stream_output('README.md\nfoo/bar/baz.py') |
| 1464 ) |
| 1465 ) |
| 1466 |
1439 yield ( | 1467 yield ( |
1440 api.test('swarming_paths') + | 1468 api.test('swarming_paths') + |
1441 api.properties.tryserver( | 1469 api.properties.tryserver( |
1442 mastername='tryserver.chromium.linux', | 1470 mastername='tryserver.chromium.linux', |
1443 buildername='linux_chromium_rel_ng', | 1471 buildername='linux_chromium_rel_ng', |
1444 path_config='swarming', | 1472 path_config='swarming', |
1445 ) + | 1473 ) + |
1446 api.platform.name('linux') | 1474 api.platform.name('linux') |
1447 ) | 1475 ) |
1448 | 1476 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1528 api.override_step_data('webkit_tests (with patch)', | 1556 api.override_step_data('webkit_tests (with patch)', |
1529 api.test_utils.canned_test_output(passing=True)) | 1557 api.test_utils.canned_test_output(passing=True)) |
1530 ) | 1558 ) |
1531 | 1559 |
1532 yield ( | 1560 yield ( |
1533 api.test('use_v8_patch_on_blink_trybot') + | 1561 api.test('use_v8_patch_on_blink_trybot') + |
1534 props(mastername='tryserver.blink', | 1562 props(mastername='tryserver.blink', |
1535 buildername='mac_blink_rel', | 1563 buildername='mac_blink_rel', |
1536 patch_project='v8') + | 1564 patch_project='v8') + |
1537 api.platform.name('mac') | 1565 api.platform.name('mac') |
1538 ) | 1566 ) |
OLD | NEW |