| 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 re |
| 6 |
| 5 DEPS = [ | 7 DEPS = [ |
| 6 'bot_update', | 8 'bot_update', |
| 7 'chromium', | 9 'chromium', |
| 8 'filter', | 10 'filter', |
| 9 'gclient', | 11 'gclient', |
| 10 'isolate', | 12 'isolate', |
| 11 'itertools', | 13 'itertools', |
| 12 'json', | 14 'json', |
| 13 'path', | 15 'path', |
| 14 'platform', | 16 'platform', |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 | 371 |
| 370 def add_swarming_builder(original, swarming, server='tryserver.chromium'): | 372 def add_swarming_builder(original, swarming, server='tryserver.chromium'): |
| 371 """Duplicates builder config on |server|, adding 'enable_swarming: True'.""" | 373 """Duplicates builder config on |server|, adding 'enable_swarming: True'.""" |
| 372 assert server in BUILDERS | 374 assert server in BUILDERS |
| 373 assert original in BUILDERS[server]['builders'] | 375 assert original in BUILDERS[server]['builders'] |
| 374 assert swarming not in BUILDERS[server]['builders'] | 376 assert swarming not in BUILDERS[server]['builders'] |
| 375 conf = BUILDERS[server]['builders'][original].copy() | 377 conf = BUILDERS[server]['builders'][original].copy() |
| 376 conf['enable_swarming'] = True | 378 conf['enable_swarming'] = True |
| 377 BUILDERS[server]['builders'][swarming] = conf | 379 BUILDERS[server]['builders'][swarming] = conf |
| 378 | 380 |
| 381 def should_filter_builder(name, regexs): |
| 382 """Returns true if the builder |name| should be filtered. |regexs| is a list |
| 383 of the regular expressions specifying the builders that should *not* be |
| 384 filtered. If |name| completely matches one of the regular expressions than |
| 385 false is returned, otherwise true.""" |
| 386 for regex in regexs: |
| 387 match = re.match(regex, name) |
| 388 if match and match.end() == len(name): |
| 389 return False |
| 390 return True |
| 379 | 391 |
| 380 add_swarming_builder('linux_chromium_rel', 'linux_chromium_rel_swarming') | 392 add_swarming_builder('linux_chromium_rel', 'linux_chromium_rel_swarming') |
| 381 add_swarming_builder('win_chromium_rel', 'win_chromium_rel_swarming') | 393 add_swarming_builder('win_chromium_rel', 'win_chromium_rel_swarming') |
| 382 add_swarming_builder('mac_chromium_rel', 'mac_chromium_rel_swarming') | 394 add_swarming_builder('mac_chromium_rel', 'mac_chromium_rel_swarming') |
| 383 | 395 |
| 384 | 396 |
| 385 def GenSteps(api): | 397 def GenSteps(api): |
| 386 def parse_test_spec(test_spec, enable_swarming, should_use_test): | 398 def parse_test_spec(test_spec, enable_swarming, should_use_test): |
| 387 """Returns a list of tests to run and additional targets to compile. | 399 """Returns a list of tests to run and additional targets to compile. |
| 388 | 400 |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 496 'test': 'browser_tests', | 508 'test': 'browser_tests', |
| 497 'exclude_builders': ['tryserver.chromium:win_chromium_x64_rel'], | 509 'exclude_builders': ['tryserver.chromium:win_chromium_x64_rel'], |
| 498 }, | 510 }, |
| 499 ]), | 511 ]), |
| 500 followup_fn=test_spec_followup_fn, | 512 followup_fn=test_spec_followup_fn, |
| 501 ) | 513 ) |
| 502 | 514 |
| 503 test_spec = api.step_history['read test spec'].json.output | 515 test_spec = api.step_history['read test spec'].json.output |
| 504 | 516 |
| 505 # See if the patch needs to compile on the current platform. | 517 # See if the patch needs to compile on the current platform. |
| 506 if isinstance(test_spec, dict) and \ | 518 if isinstance(test_spec, dict) and should_filter_builder( |
| 507 buildername in test_spec.get('filter_builders', []): | 519 buildername, test_spec.get('non_filter_builders', [])): |
| 508 yield api.filter.does_patch_require_compile( | 520 yield api.filter.does_patch_require_compile( |
| 509 exclusions=test_spec.get('gtest_tests_filter_exclusions', [])) | 521 exclusions=test_spec.get('gtest_tests_filter_exclusions', [])) |
| 510 if not api.filter.result: | 522 if not api.filter.result: |
| 511 return | 523 return |
| 512 | 524 |
| 513 def should_use_test(test): | 525 def should_use_test(test): |
| 514 """Given a test dict from test spec returns True or False.""" | 526 """Given a test dict from test spec returns True or False.""" |
| 515 if 'platforms' in test: | 527 if 'platforms' in test: |
| 516 if api.platform.name not in test['platforms']: | 528 if api.platform.name not in test['platforms']: |
| 517 return False | 529 return False |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 726 'compile_targets': ['browser_tests_run'], | 738 'compile_targets': ['browser_tests_run'], |
| 727 'gtest_tests': [ | 739 'gtest_tests': [ |
| 728 { | 740 { |
| 729 'test': 'browser_tests', | 741 'test': 'browser_tests', |
| 730 'args': '--gtest-filter: *NaCl*', | 742 'args': '--gtest-filter: *NaCl*', |
| 731 }, { | 743 }, { |
| 732 'test': 'base_tests', | 744 'test': 'base_tests', |
| 733 'args': ['--gtest-filter: *NaCl*'], | 745 'args': ['--gtest-filter: *NaCl*'], |
| 734 }, | 746 }, |
| 735 ], | 747 ], |
| 748 'non_filter_builders': ['.*'], |
| 736 }) | 749 }) |
| 737 ) | 750 ) |
| 738 ) | 751 ) |
| 739 | 752 |
| 740 yield ( | 753 yield ( |
| 741 api.test('checkperms_failure') + | 754 api.test('checkperms_failure') + |
| 742 props() + | 755 props() + |
| 743 api.platform.name('linux') + | 756 api.platform.name('linux') + |
| 744 api.override_step_data( | 757 api.override_step_data( |
| 745 'checkperms (with patch)', | 758 'checkperms (with patch)', |
| (...skipping 10 matching lines...) Expand all Loading... |
| 756 props(buildername='linux_chromium_rel_swarming') + | 769 props(buildername='linux_chromium_rel_swarming') + |
| 757 api.platform.name('linux') + | 770 api.platform.name('linux') + |
| 758 api.step_data('swarming.py --version', retcode=1) + | 771 api.step_data('swarming.py --version', retcode=1) + |
| 759 api.override_step_data('read test spec', api.json.output({ | 772 api.override_step_data('read test spec', api.json.output({ |
| 760 'gtest_tests': [ | 773 'gtest_tests': [ |
| 761 { | 774 { |
| 762 'test': 'base_unittests', | 775 'test': 'base_unittests', |
| 763 'swarming': {'can_use_on_swarming_builders': True}, | 776 'swarming': {'can_use_on_swarming_builders': True}, |
| 764 }, | 777 }, |
| 765 ], | 778 ], |
| 779 'non_filter_builders': ['linux_chromium_rel_swarming'], |
| 766 }) | 780 }) |
| 767 ) | 781 ) |
| 768 ) | 782 ) |
| 769 | 783 |
| 770 yield ( | 784 yield ( |
| 771 api.test('checklicenses_failure') + | 785 api.test('checklicenses_failure') + |
| 772 props() + | 786 props() + |
| 773 api.platform.name('linux') + | 787 api.platform.name('linux') + |
| 774 api.override_step_data( | 788 api.override_step_data( |
| 775 'checklicenses (with patch)', | 789 'checklicenses (with patch)', |
| (...skipping 27 matching lines...) Expand all Loading... |
| 803 }, | 817 }, |
| 804 { | 818 { |
| 805 'test': 'browser_tests', | 819 'test': 'browser_tests', |
| 806 'swarming': { | 820 'swarming': { |
| 807 'can_use_on_swarming_builders': True, | 821 'can_use_on_swarming_builders': True, |
| 808 'shards': 5, | 822 'shards': 5, |
| 809 'platforms': ['linux'], | 823 'platforms': ['linux'], |
| 810 }, | 824 }, |
| 811 }, | 825 }, |
| 812 ], | 826 ], |
| 827 'non_filter_builders': ['linux_chromium_rel_swarming'], |
| 813 }) | 828 }) |
| 814 ) + | 829 ) + |
| 815 api.override_step_data( | 830 api.override_step_data( |
| 816 'find isolated tests', | 831 'find isolated tests', |
| 817 api.isolate.output_json(['base_unittests', 'browser_tests'])) | 832 api.isolate.output_json(['base_unittests', 'browser_tests'])) |
| 818 ) | 833 ) |
| 819 | 834 |
| 820 # One target (browser_tests) failed to produce *.isolated file. | 835 # One target (browser_tests) failed to produce *.isolated file. |
| 821 yield ( | 836 yield ( |
| 822 api.test('swarming_missing_isolated') + | 837 api.test('swarming_missing_isolated') + |
| 823 props(buildername='linux_chromium_rel_swarming') + | 838 props(buildername='linux_chromium_rel_swarming') + |
| 824 api.platform.name('linux') + | 839 api.platform.name('linux') + |
| 825 api.override_step_data('read test spec', api.json.output({ | 840 api.override_step_data('read test spec', api.json.output({ |
| 826 'gtest_tests': [ | 841 'gtest_tests': [ |
| 827 { | 842 { |
| 828 'test': 'base_unittests', | 843 'test': 'base_unittests', |
| 829 'swarming': {'can_use_on_swarming_builders': True}, | 844 'swarming': {'can_use_on_swarming_builders': True}, |
| 830 }, | 845 }, |
| 831 { | 846 { |
| 832 'test': 'browser_tests', | 847 'test': 'browser_tests', |
| 833 'swarming': {'can_use_on_swarming_builders': True}, | 848 'swarming': {'can_use_on_swarming_builders': True}, |
| 834 }, | 849 }, |
| 835 ], | 850 ], |
| 851 'non_filter_builders': ['linux_chromium_rel_swarming'], |
| 836 }) | 852 }) |
| 837 ) + | 853 ) + |
| 838 api.override_step_data( | 854 api.override_step_data( |
| 839 'find isolated tests', | 855 'find isolated tests', |
| 840 api.isolate.output_json(['base_unittests'])) | 856 api.isolate.output_json(['base_unittests'])) |
| 841 ) | 857 ) |
| 842 | 858 |
| 843 # One test (base_unittest) failed on swarming. It is retried with | 859 # One test (base_unittest) failed on swarming. It is retried with |
| 844 # deapplied patch. | 860 # deapplied patch. |
| 845 yield ( | 861 yield ( |
| 846 api.test('swarming_deapply_patch') + | 862 api.test('swarming_deapply_patch') + |
| 847 props(buildername='linux_chromium_rel_swarming') + | 863 props(buildername='linux_chromium_rel_swarming') + |
| 848 api.platform.name('linux') + | 864 api.platform.name('linux') + |
| 849 api.override_step_data('read test spec', api.json.output({ | 865 api.override_step_data('read test spec', api.json.output({ |
| 850 'gtest_tests': [ | 866 'gtest_tests': [ |
| 851 { | 867 { |
| 852 'test': 'base_unittests', | 868 'test': 'base_unittests', |
| 853 'swarming': {'can_use_on_swarming_builders': True}, | 869 'swarming': {'can_use_on_swarming_builders': True}, |
| 854 }, | 870 }, |
| 855 { | 871 { |
| 856 'test': 'browser_tests', | 872 'test': 'browser_tests', |
| 857 'swarming': {'can_use_on_swarming_builders': True}, | 873 'swarming': {'can_use_on_swarming_builders': True}, |
| 858 }, | 874 }, |
| 859 ], | 875 ], |
| 876 'non_filter_builders': ['linux_chromium_rel_swarming'], |
| 860 }) | 877 }) |
| 861 ) + | 878 ) + |
| 862 api.override_step_data( | 879 api.override_step_data( |
| 863 'find isolated tests', | 880 'find isolated tests', |
| 864 api.isolate.output_json(['base_unittests', 'browser_tests'])) + | 881 api.isolate.output_json(['base_unittests', 'browser_tests'])) + |
| 865 api.override_step_data('[swarming] base_unittests (with patch)', | 882 api.override_step_data('[swarming] base_unittests (with patch)', |
| 866 canned_test(passing=False)) + | 883 canned_test(passing=False)) + |
| 867 api.override_step_data( | 884 api.override_step_data( |
| 868 'find isolated tests (2)', | 885 'find isolated tests (2)', |
| 869 api.isolate.output_json(['base_unittests'])) | 886 api.isolate.output_json(['base_unittests'])) |
| 870 ) | 887 ) |
| 871 | 888 |
| 872 # Tests analyze module by way of making builder match that of filter_builders. | 889 # Tests analyze module by not specifying a non_filter_builders. |
| 873 yield ( | 890 yield ( |
| 874 api.test('no_compile_because_of_analyze') + | 891 api.test('no_compile_because_of_analyze') + |
| 875 props(buildername='linux_chromium_rel') + | 892 props(buildername='linux_chromium_rel') + |
| 876 api.platform.name('linux') + | 893 api.platform.name('linux') + |
| 877 api.override_step_data('read test spec', api.json.output({ | 894 api.override_step_data('read test spec', api.json.output({ |
| 878 'filter_builders': ['linux_chromium_rel'], | |
| 879 }) | 895 }) |
| 880 ) | 896 ) |
| 881 ) | 897 ) |
| 882 | 898 |
| 883 # Tests analyze module by way of making builder match that of filter_builders | 899 # Tests analyze module by way of not specifying non_filter_builders and file |
| 884 # and file matching exclusion list. This should result in a compile. | 900 # matching exclusion list. This should result in a compile. |
| 885 yield ( | 901 yield ( |
| 886 api.test('compile_because_of_analyze_matching_exclusion') + | 902 api.test('compile_because_of_analyze_matching_exclusion') + |
| 887 props(buildername='linux_chromium_rel') + | 903 props(buildername='linux_chromium_rel') + |
| 888 api.platform.name('linux') + | 904 api.platform.name('linux') + |
| 889 api.override_step_data('read test spec', api.json.output({ | 905 api.override_step_data('read test spec', api.json.output({ |
| 890 'filter_builders': ['linux_chromium_rel'], | |
| 891 'gtest_tests_filter_exclusions': ['f.*'], | 906 'gtest_tests_filter_exclusions': ['f.*'], |
| 892 }) | 907 }) |
| 893 ) | 908 ) |
| 894 ) | 909 ) |
| 895 | 910 |
| 896 # Tests analyze module by way of making builder match that of filter_builders | 911 # Tests analyze module by way of not specifying non_filter_builders and |
| 897 # and analyze result returning true. This should result in a compile. | 912 # analyze result returning true. This should result in a compile. |
| 898 yield ( | 913 yield ( |
| 899 api.test('compile_because_of_analyze') + | 914 api.test('compile_because_of_analyze') + |
| 900 props(buildername='linux_chromium_rel') + | 915 props(buildername='linux_chromium_rel') + |
| 901 api.platform.name('linux') + | 916 api.platform.name('linux') + |
| 902 api.override_step_data('read test spec', api.json.output({ | 917 api.override_step_data('read test spec', api.json.output({ |
| 903 'filter_builders': ['linux_chromium_rel'], | |
| 904 }) | 918 }) |
| 905 ) + | 919 ) + |
| 906 api.override_step_data( | 920 api.override_step_data( |
| 907 'analyze', | 921 'analyze', |
| 908 api.raw_io.stream_output('Found dependency')) | 922 api.raw_io.stream_output('Found dependency')) |
| 909 ) | 923 ) |
| OLD | NEW |