Chromium Code Reviews| 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 | |
|
iannucci
2014/07/24 19:08:10
general disclaimer: imports in recipes are usually
sky
2014/07/24 19:15:30
Good to know. Thanks!
| |
| 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': ['.*'], | |
|
iannucci
2014/07/24 19:08:10
you may want to consider fnmatch instead of regex.
sky
2014/07/24 19:15:30
I don't feel strongly as to which is more widely k
| |
| 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 787 }, | 800 }, |
| 788 { | 801 { |
| 789 'test': 'browser_tests', | 802 'test': 'browser_tests', |
| 790 'swarming': { | 803 'swarming': { |
| 791 'can_use_on_swarming_builders': True, | 804 'can_use_on_swarming_builders': True, |
| 792 'shards': 5, | 805 'shards': 5, |
| 793 'platforms': ['linux'], | 806 'platforms': ['linux'], |
| 794 }, | 807 }, |
| 795 }, | 808 }, |
| 796 ], | 809 ], |
| 810 'non_filter_builders': ['linux_chromium_rel_swarming'], | |
| 797 }) | 811 }) |
| 798 ) + | 812 ) + |
| 799 api.override_step_data( | 813 api.override_step_data( |
| 800 'find isolated tests', | 814 'find isolated tests', |
| 801 api.isolate.output_json(['base_unittests', 'browser_tests'])) | 815 api.isolate.output_json(['base_unittests', 'browser_tests'])) |
| 802 ) | 816 ) |
| 803 | 817 |
| 804 # One target (browser_tests) failed to produce *.isolated file. | 818 # One target (browser_tests) failed to produce *.isolated file. |
| 805 yield ( | 819 yield ( |
| 806 api.test('swarming_missing_isolated') + | 820 api.test('swarming_missing_isolated') + |
| 807 props(buildername='linux_chromium_rel_swarming') + | 821 props(buildername='linux_chromium_rel_swarming') + |
| 808 api.platform.name('linux') + | 822 api.platform.name('linux') + |
| 809 api.override_step_data('read test spec', api.json.output({ | 823 api.override_step_data('read test spec', api.json.output({ |
| 810 'gtest_tests': [ | 824 'gtest_tests': [ |
| 811 { | 825 { |
| 812 'test': 'base_unittests', | 826 'test': 'base_unittests', |
| 813 'swarming': {'can_use_on_swarming_builders': True}, | 827 'swarming': {'can_use_on_swarming_builders': True}, |
| 814 }, | 828 }, |
| 815 { | 829 { |
| 816 'test': 'browser_tests', | 830 'test': 'browser_tests', |
| 817 'swarming': {'can_use_on_swarming_builders': True}, | 831 'swarming': {'can_use_on_swarming_builders': True}, |
| 818 }, | 832 }, |
| 819 ], | 833 ], |
| 834 'non_filter_builders': ['linux_chromium_rel_swarming'], | |
| 820 }) | 835 }) |
| 821 ) + | 836 ) + |
| 822 api.override_step_data( | 837 api.override_step_data( |
| 823 'find isolated tests', | 838 'find isolated tests', |
| 824 api.isolate.output_json(['base_unittests'])) | 839 api.isolate.output_json(['base_unittests'])) |
| 825 ) | 840 ) |
| 826 | 841 |
| 827 # One test (base_unittest) failed on swarming. It is retried with | 842 # One test (base_unittest) failed on swarming. It is retried with |
| 828 # deapplied patch. | 843 # deapplied patch. |
| 829 yield ( | 844 yield ( |
| 830 api.test('swarming_deapply_patch') + | 845 api.test('swarming_deapply_patch') + |
| 831 props(buildername='linux_chromium_rel_swarming') + | 846 props(buildername='linux_chromium_rel_swarming') + |
| 832 api.platform.name('linux') + | 847 api.platform.name('linux') + |
| 833 api.override_step_data('read test spec', api.json.output({ | 848 api.override_step_data('read test spec', api.json.output({ |
| 834 'gtest_tests': [ | 849 'gtest_tests': [ |
| 835 { | 850 { |
| 836 'test': 'base_unittests', | 851 'test': 'base_unittests', |
| 837 'swarming': {'can_use_on_swarming_builders': True}, | 852 'swarming': {'can_use_on_swarming_builders': True}, |
| 838 }, | 853 }, |
| 839 { | 854 { |
| 840 'test': 'browser_tests', | 855 'test': 'browser_tests', |
| 841 'swarming': {'can_use_on_swarming_builders': True}, | 856 'swarming': {'can_use_on_swarming_builders': True}, |
| 842 }, | 857 }, |
| 843 ], | 858 ], |
| 859 'non_filter_builders': ['linux_chromium_rel_swarming'], | |
| 844 }) | 860 }) |
| 845 ) + | 861 ) + |
| 846 api.override_step_data( | 862 api.override_step_data( |
| 847 'find isolated tests', | 863 'find isolated tests', |
| 848 api.isolate.output_json(['base_unittests', 'browser_tests'])) + | 864 api.isolate.output_json(['base_unittests', 'browser_tests'])) + |
| 849 api.override_step_data('[swarming] base_unittests (with patch)', | 865 api.override_step_data('[swarming] base_unittests (with patch)', |
| 850 canned_test(passing=False)) + | 866 canned_test(passing=False)) + |
| 851 api.override_step_data( | 867 api.override_step_data( |
| 852 'find isolated tests (2)', | 868 'find isolated tests (2)', |
| 853 api.isolate.output_json(['base_unittests'])) | 869 api.isolate.output_json(['base_unittests'])) |
| 854 ) | 870 ) |
| 855 | 871 |
| 856 # Tests analyze module by way of making builder match that of filter_builders. | 872 # Tests analyze module by not specifying a non_filter_builders. |
| 857 yield ( | 873 yield ( |
| 858 api.test('no_compile_because_of_analyze') + | 874 api.test('no_compile_because_of_analyze') + |
| 859 props(buildername='linux_chromium_rel') + | 875 props(buildername='linux_chromium_rel') + |
| 860 api.platform.name('linux') + | 876 api.platform.name('linux') + |
| 861 api.override_step_data('read test spec', api.json.output({ | 877 api.override_step_data('read test spec', api.json.output({ |
| 862 'filter_builders': ['linux_chromium_rel'], | |
| 863 }) | 878 }) |
| 864 ) | 879 ) |
| 865 ) | 880 ) |
| 866 | 881 |
| 867 # Tests analyze module by way of making builder match that of filter_builders | 882 # Tests analyze module by way of not specifying non_filter_builders and file |
| 868 # and file matching exclusion list. This should result in a compile. | 883 # matching exclusion list. This should result in a compile. |
| 869 yield ( | 884 yield ( |
| 870 api.test('compile_because_of_analyze_matching_exclusion') + | 885 api.test('compile_because_of_analyze_matching_exclusion') + |
| 871 props(buildername='linux_chromium_rel') + | 886 props(buildername='linux_chromium_rel') + |
| 872 api.platform.name('linux') + | 887 api.platform.name('linux') + |
| 873 api.override_step_data('read test spec', api.json.output({ | 888 api.override_step_data('read test spec', api.json.output({ |
| 874 'filter_builders': ['linux_chromium_rel'], | |
| 875 'gtest_tests_filter_exclusions': ['f.*'], | 889 'gtest_tests_filter_exclusions': ['f.*'], |
| 876 }) | 890 }) |
| 877 ) | 891 ) |
| 878 ) | 892 ) |
| 879 | 893 |
| 880 # Tests analyze module by way of making builder match that of filter_builders | 894 # Tests analyze module by way of not specifying non_filter_builders and |
| 881 # and analyze result returning true. This should result in a compile. | 895 # analyze result returning true. This should result in a compile. |
| 882 yield ( | 896 yield ( |
| 883 api.test('compile_because_of_analyze') + | 897 api.test('compile_because_of_analyze') + |
| 884 props(buildername='linux_chromium_rel') + | 898 props(buildername='linux_chromium_rel') + |
| 885 api.platform.name('linux') + | 899 api.platform.name('linux') + |
| 886 api.override_step_data('read test spec', api.json.output({ | 900 api.override_step_data('read test spec', api.json.output({ |
| 887 'filter_builders': ['linux_chromium_rel'], | |
| 888 }) | 901 }) |
| 889 ) + | 902 ) + |
| 890 api.override_step_data( | 903 api.override_step_data( |
| 891 'analyze', | 904 'analyze', |
| 892 api.raw_io.stream_output('Found dependency')) | 905 api.raw_io.stream_output('Found dependency')) |
| 893 ) | 906 ) |
| OLD | NEW |