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 | 5 import re |
6 | 6 |
7 DEPS = [ | 7 DEPS = [ |
8 'bot_update', | 8 'bot_update', |
9 'chromium', | 9 'chromium', |
10 'chromium_tests', | 10 'chromium_tests', |
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
511 config_path = api.path.join('testing', 'buildbot', file_name) | 511 config_path = api.path.join('testing', 'buildbot', file_name) |
512 step_result = api.json.read( | 512 step_result = api.json.read( |
513 'read analyze test spec', | 513 'read analyze test spec', |
514 api.path['checkout'].join(config_path), | 514 api.path['checkout'].join(config_path), |
515 step_test_data=lambda: api.json.test_api.output({'exclusions': []}) | 515 step_test_data=lambda: api.json.test_api.output({'exclusions': []}) |
516 ) | 516 ) |
517 step_result.presentation.step_text = 'path: %r' % config_path | 517 step_result.presentation.step_text = 'path: %r' % config_path |
518 return step_result.json.output | 518 return step_result.json.output |
519 | 519 |
520 | 520 |
| 521 def tests_in_compile_targets(compile_targets, *tests): |
| 522 """Returns the tests in |tests| that have at least one of their compile |
| 523 targets in |compile_targets|.""" |
| 524 # The target all builds everything. |
| 525 if 'all' in compile_targets: |
| 526 return tests |
| 527 return [test for test in tests if set(compile_targets) & |
| 528 set(test.compile_targets(None))] |
| 529 |
| 530 |
521 add_swarming_builder('linux_chromium_rel', 'linux_chromium_rel_swarming', | 531 add_swarming_builder('linux_chromium_rel', 'linux_chromium_rel_swarming', |
522 'tryserver.chromium.linux') | 532 'tryserver.chromium.linux') |
523 add_swarming_builder('linux_chromium_chromeos_rel', | 533 add_swarming_builder('linux_chromium_chromeos_rel', |
524 'linux_chromium_chromeos_rel_swarming', | 534 'linux_chromium_chromeos_rel_swarming', |
525 'tryserver.chromium.linux') | 535 'tryserver.chromium.linux') |
526 add_swarming_builder('win_chromium_rel', 'win_chromium_rel_swarming', | 536 add_swarming_builder('win_chromium_rel', 'win_chromium_rel_swarming', |
527 'tryserver.chromium.win') | 537 'tryserver.chromium.win') |
528 add_swarming_builder('win_chromium_x64_rel', 'win_chromium_x64_rel_swarming', | 538 add_swarming_builder('win_chromium_x64_rel', 'win_chromium_x64_rel_swarming', |
529 'tryserver.chromium.win') | 539 'tryserver.chromium.win') |
530 add_swarming_builder('mac_chromium_rel', 'mac_chromium_rel_swarming', | 540 add_swarming_builder('mac_chromium_rel', 'mac_chromium_rel_swarming', |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
677 if 'exclude_builders' in test: | 687 if 'exclude_builders' in test: |
678 if '%s:%s' % (mastername, buildername) in test['exclude_builders']: | 688 if '%s:%s' % (mastername, buildername) in test['exclude_builders']: |
679 return False | 689 return False |
680 return True | 690 return True |
681 | 691 |
682 # Parse test spec file into list of Test instances. | 692 # Parse test spec file into list of Test instances. |
683 compile_targets, gtest_tests, swarming_tests = parse_test_spec( | 693 compile_targets, gtest_tests, swarming_tests = parse_test_spec( |
684 test_spec, | 694 test_spec, |
685 bot_config.get('enable_swarming'), | 695 bot_config.get('enable_swarming'), |
686 should_use_test) | 696 should_use_test) |
| 697 compile_targets.extend(bot_config.get('compile_targets', [])) |
| 698 # TODO(phajdan.jr): Also compile 'all' on win, http://crbug.com/368831 . |
| 699 # Disabled for now because it takes too long and/or fails on Windows. |
| 700 if not api.platform.is_win and not bot_config.get('exclude_compile_all'): |
| 701 compile_targets = ['all'] + compile_targets |
687 | 702 |
688 runhooks_env = bot_config.get('runhooks_env', {}) | 703 runhooks_env = bot_config.get('runhooks_env', {}) |
689 | 704 |
690 # See if the patch needs to compile on the current platform. | 705 # See if the patch needs to compile on the current platform. |
691 if isinstance(test_spec, dict) and should_filter_builder( | 706 if isinstance(test_spec, dict) and should_filter_builder( |
692 buildername, test_spec.get('non_filter_builders', []), | 707 buildername, test_spec.get('non_filter_builders', []), |
693 api.properties.get('root')): | 708 api.properties.get('root')): |
694 analyze_config = get_analyze_config( | 709 analyze_config = get_analyze_config( |
695 api, bot_config['testing'].get('analyze_config_file', | 710 api, bot_config['testing'].get('analyze_config_file', |
696 'trybot_analyze_config.json')) | 711 'trybot_analyze_config.json')) |
697 api.filter.does_patch_require_compile( | 712 api.filter.does_patch_require_compile( |
698 exclusions=analyze_config.get('exclusions', []), | 713 exclusions=analyze_config.get('exclusions', []), |
699 exes=get_test_names(gtest_tests, swarming_tests), | 714 exes=get_test_names(gtest_tests, swarming_tests), |
| 715 compile_targets=compile_targets, |
700 env=runhooks_env) | 716 env=runhooks_env) |
701 if not api.filter.result: | 717 if not api.filter.result: |
702 return [], swarming_tests, bot_update_step | 718 return [], swarming_tests, bot_update_step |
703 # Patch needs compile. Filter the list of test targets. | 719 # Patch needs compile. Filter the list of test and compile targets. |
704 if should_filter_tests(buildername, | 720 if should_filter_tests(buildername, |
705 test_spec.get('non_filter_tests_builders', [])): | 721 test_spec.get('non_filter_tests_builders', [])): |
706 gtest_tests = filter_tests(gtest_tests, api.filter.matching_exes) | 722 gtest_tests = filter_tests(gtest_tests, api.filter.matching_exes) |
707 swarming_tests = filter_tests(swarming_tests, api.filter.matching_exes) | 723 swarming_tests = filter_tests(swarming_tests, api.filter.matching_exes) |
| 724 if buildername in test_spec.get('filter_compile_builders', []): |
| 725 if 'all' in compile_targets: |
| 726 compile_targets = api.filter.compile_targets |
| 727 else: |
| 728 compile_targets = list(set(compile_targets) & |
| 729 set(api.filter.compile_targets)) |
708 | 730 |
709 # Swarming uses Isolate to transfer files to swarming bots. | 731 # Swarming uses Isolate to transfer files to swarming bots. |
710 # set_isolate_environment modifies GYP_DEFINES to enable test isolation. | 732 # set_isolate_environment modifies GYP_DEFINES to enable test isolation. |
711 if bot_config.get('use_isolate') or swarming_tests: | 733 if bot_config.get('use_isolate') or swarming_tests: |
712 api.isolate.set_isolate_environment(api.chromium.c) | 734 api.isolate.set_isolate_environment(api.chromium.c) |
713 | 735 |
714 # If going to use swarming_client (pinned in src/DEPS), ensure it is | 736 # If going to use swarming_client (pinned in src/DEPS), ensure it is |
715 # compatible with what recipes expect. | 737 # compatible with what recipes expect. |
716 if swarming_tests: | 738 if swarming_tests: |
717 api.swarming.check_client_version() | 739 api.swarming.check_client_version() |
(...skipping 10 matching lines...) Expand all Loading... |
728 tests.extend([ | 750 tests.extend([ |
729 api.chromium.steps.CheckpermsTest(), | 751 api.chromium.steps.CheckpermsTest(), |
730 api.chromium.steps.ChecklicensesTest(), | 752 api.chromium.steps.ChecklicensesTest(), |
731 ]) | 753 ]) |
732 tests.append(api.chromium.steps.Deps2GitTest()) | 754 tests.append(api.chromium.steps.Deps2GitTest()) |
733 | 755 |
734 if (bot_config['chromium_config'] not in ['chromium_chromeos', | 756 if (bot_config['chromium_config'] not in ['chromium_chromeos', |
735 'chromium_asan', | 757 'chromium_asan', |
736 'chromium_chromeos_clang'] | 758 'chromium_chromeos_clang'] |
737 and not buildername.startswith('win8')): | 759 and not buildername.startswith('win8')): |
738 tests.append(api.chromium.steps.TelemetryUnitTests()) | 760 tests.extend(tests_in_compile_targets( |
739 tests.append(api.chromium.steps.TelemetryPerfUnitTests()) | 761 compile_targets, |
| 762 api.chromium.steps.TelemetryUnitTests(), |
| 763 api.chromium.steps.TelemetryPerfUnitTests())) |
740 | 764 |
741 tests.extend(gtest_tests) | 765 tests.extend(gtest_tests) |
742 tests.extend(swarming_tests) | 766 tests.extend(swarming_tests) |
743 tests.append(api.chromium.steps.NaclIntegrationTest()) | 767 tests.extend(tests_in_compile_targets(compile_targets, |
| 768 api.chromium.steps.NaclIntegrationTest())) |
| 769 # MojoPythonTests don't require anything to be compiled. |
744 tests.append(api.chromium.steps.MojoPythonTests()) | 770 tests.append(api.chromium.steps.MojoPythonTests()) |
745 | 771 |
746 # test_installer only works on 32-bit builds; http://crbug.com/399643 | 772 # test_installer only works on 32-bit builds; http://crbug.com/399643 |
747 # Disabled due to retry issues (http://crbug.com/402081. | 773 # Disabled due to retry issues (http://crbug.com/402081. |
748 #if api.platform.is_win and api.chromium.c.TARGET_BITS == 32: | 774 #if api.platform.is_win and api.chromium.c.TARGET_BITS == 32: |
749 # tests.append(api.chromium.steps.MiniInstallerTest()) | 775 # tests.append(api.chromium.steps.MiniInstallerTest()) |
750 | 776 |
751 compile_targets.extend(bot_config.get('compile_targets', [])) | |
752 compile_targets.extend(api.itertools.chain( | 777 compile_targets.extend(api.itertools.chain( |
753 *[t.compile_targets(api) for t in tests])) | 778 *[t.compile_targets(api) for t in tests])) |
754 # TODO(phajdan.jr): Also compile 'all' on win, http://crbug.com/368831 . | |
755 # Disabled for now because it takes too long and/or fails on Windows. | |
756 if not api.platform.is_win and not bot_config.get('exclude_compile_all'): | |
757 compile_targets = ['all'] + compile_targets | |
758 api.chromium.compile(compile_targets, name='compile (with patch)') | 779 api.chromium.compile(compile_targets, name='compile (with patch)') |
759 | 780 |
760 # Collect *.isolated hashes for all isolated targets, used when triggering | 781 # Collect *.isolated hashes for all isolated targets, used when triggering |
761 # tests on swarming. | 782 # tests on swarming. |
762 if bot_config.get('use_isolate') or swarming_tests: | 783 if bot_config.get('use_isolate') or swarming_tests: |
763 api.isolate.find_isolated_tests(api.chromium.output_dir) | 784 api.isolate.find_isolated_tests(api.chromium.output_dir) |
764 | 785 |
765 if bot_config['compile_only']: | 786 if bot_config['compile_only']: |
766 tests = [] | 787 tests = [] |
767 swarming_tests = [] | 788 swarming_tests = [] |
(...skipping 26 matching lines...) Expand all Loading... |
794 bot_update_json['properties']['got_revision']) | 815 bot_update_json['properties']['got_revision']) |
795 api.bot_update.ensure_checkout(force=True, | 816 api.bot_update.ensure_checkout(force=True, |
796 patch=False, | 817 patch=False, |
797 update_presentation=False) | 818 update_presentation=False) |
798 try: | 819 try: |
799 api.chromium.runhooks() | 820 api.chromium.runhooks() |
800 finally: | 821 finally: |
801 compile_targets = list(api.itertools.chain( | 822 compile_targets = list(api.itertools.chain( |
802 *[t.compile_targets(api) for t in failing_tests])) | 823 *[t.compile_targets(api) for t in failing_tests])) |
803 if compile_targets: | 824 if compile_targets: |
| 825 # Remove duplicate targets. |
| 826 compile_targets = list(set(compile_targets)) |
804 try: | 827 try: |
805 api.chromium.compile( | 828 api.chromium.compile( |
806 compile_targets, name='compile (without patch)') | 829 compile_targets, name='compile (without patch)') |
807 except api.step.StepFailure: | 830 except api.step.StepFailure: |
808 api.chromium.compile(compile_targets, | 831 api.chromium.compile(compile_targets, |
809 name='compile (without patch, clobber)', | 832 name='compile (without patch, clobber)', |
810 force_clobber=True) | 833 force_clobber=True) |
811 # Search for *.isolated only if enabled in bot config or if some | 834 # Search for *.isolated only if enabled in bot config or if some |
812 # swarming test is being recompiled. | 835 # swarming test is being recompiled. |
813 bot_config = get_bot_config(mastername, buildername) | 836 bot_config = get_bot_config(mastername, buildername) |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1144 # analyze result returning true. This should result in a compile. | 1167 # analyze result returning true. This should result in a compile. |
1145 yield ( | 1168 yield ( |
1146 api.test('compile_because_of_analyze') + | 1169 api.test('compile_because_of_analyze') + |
1147 props(buildername='linux_chromium_rel') + | 1170 props(buildername='linux_chromium_rel') + |
1148 api.platform.name('linux') + | 1171 api.platform.name('linux') + |
1149 api.override_step_data('read test spec', api.json.output({ | 1172 api.override_step_data('read test spec', api.json.output({ |
1150 }) | 1173 }) |
1151 ) + | 1174 ) + |
1152 api.override_step_data( | 1175 api.override_step_data( |
1153 'analyze', | 1176 'analyze', |
1154 api.json.output({'status': 'Found dependency', 'targets': []})) | 1177 api.json.output({'status': 'Found dependency', 'targets': [], |
| 1178 'build_targets': []})) |
1155 ) | 1179 ) |
1156 | 1180 |
1157 # Tests analyze module by way of specifying non_filter_builders and | 1181 # Tests analyze module by way of specifying non_filter_builders and |
1158 # analyze result returning true along with a smaller set of tests. | 1182 # analyze result returning true along with a smaller set of tests. |
1159 yield ( | 1183 yield ( |
1160 api.test('compile_because_of_analyze_with_filtered_tests_no_builder') + | 1184 api.test('compile_because_of_analyze_with_filtered_tests_no_builder') + |
1161 props(buildername='linux_chromium_rel') + | 1185 props(buildername='linux_chromium_rel') + |
1162 api.platform.name('linux') + | 1186 api.platform.name('linux') + |
1163 api.override_step_data('read test spec', api.json.output({ | 1187 api.override_step_data('read test spec', api.json.output({ |
1164 'non_filter_tests_builders': ['linux_chromium_rel'], | 1188 'non_filter_tests_builders': ['linux_chromium_rel'], |
1165 'gtest_tests': [ | 1189 'gtest_tests': [ |
1166 { | 1190 { |
1167 'test': 'base_unittests', | 1191 'test': 'base_unittests', |
1168 'swarming': {'can_use_on_swarming_builders': True}, | 1192 'swarming': {'can_use_on_swarming_builders': True}, |
1169 }, | 1193 }, |
1170 { | 1194 { |
1171 'test': 'browser_tests', | 1195 'test': 'browser_tests', |
1172 }, | 1196 }, |
1173 { | 1197 { |
1174 'test': 'unittests', | 1198 'test': 'unittests', |
1175 }, | 1199 }, |
1176 ], | 1200 ], |
1177 }) | 1201 }) |
1178 ) + | 1202 ) + |
1179 api.override_step_data( | 1203 api.override_step_data( |
1180 'analyze', | 1204 'analyze', |
1181 api.json.output({'status': 'Found dependency', | 1205 api.json.output({'status': 'Found dependency', |
1182 'targets': ['browser_tests', 'base_unittests']})) | 1206 'targets': ['browser_tests', 'base_unittests'], |
| 1207 'build_targets': ['browser_tests', 'base_unittests']})) |
1183 ) | 1208 ) |
1184 | 1209 |
1185 # Tests analyze module by way of not specifying non_filter_builders and | 1210 # Tests analyze module by way of not specifying non_filter_builders and |
1186 # analyze result returning true along with a smaller set of tests. This | 1211 # analyze result returning true along with a smaller set of tests. This |
1187 # specifices a 'filter_test_builder', so that this bot uses the filtered set. | 1212 # specifices a 'filter_test_builder', so that this bot uses the filtered set. |
1188 yield ( | 1213 yield ( |
1189 api.test('compile_because_of_analyze_with_filtered_tests') + | 1214 api.test('compile_because_of_analyze_with_filtered_tests') + |
1190 props(buildername='linux_chromium_rel') + | 1215 props(buildername='linux_chromium_rel') + |
1191 api.platform.name('linux') + | 1216 api.platform.name('linux') + |
1192 api.override_step_data('read test spec', api.json.output({ | 1217 api.override_step_data('read test spec', api.json.output({ |
1193 'gtest_tests': [ | 1218 'gtest_tests': [ |
1194 { | 1219 { |
1195 'test': 'base_unittests', | 1220 'test': 'base_unittests', |
1196 'swarming': {'can_use_on_swarming_builders': True}, | 1221 'swarming': {'can_use_on_swarming_builders': True}, |
1197 }, | 1222 }, |
1198 { | 1223 { |
1199 'test': 'browser_tests', | 1224 'test': 'browser_tests', |
1200 }, | 1225 }, |
1201 { | 1226 { |
1202 'test': 'unittests', | 1227 'test': 'unittests', |
1203 }, | 1228 }, |
1204 ], | 1229 ], |
1205 }) | 1230 }) |
1206 ) + | 1231 ) + |
1207 api.override_step_data( | 1232 api.override_step_data( |
1208 'analyze', | 1233 'analyze', |
1209 api.json.output({'status': 'Found dependency', | 1234 api.json.output({'status': 'Found dependency', |
1210 'targets': ['browser_tests', 'base_unittests']})) | 1235 'targets': ['browser_tests', 'base_unittests'], |
| 1236 'build_targets': ['browser_tests', 'base_unittests']})) |
1211 ) | 1237 ) |
| 1238 |
| 1239 # Tests compile_target portion of analyze module. |
| 1240 yield ( |
| 1241 api.test('compile_because_of_analyze_with_filtered_compile_targets') + |
| 1242 props(buildername='linux_chromium_rel') + |
| 1243 api.platform.name('linux') + |
| 1244 api.override_step_data('read test spec', api.json.output({ |
| 1245 'filter_compile_builders': 'linux_chromium_rel', |
| 1246 'gtest_tests': [ |
| 1247 { |
| 1248 'test': 'base_unittests', |
| 1249 'swarming': {'can_use_on_swarming_builders': True}, |
| 1250 }, |
| 1251 { |
| 1252 'test': 'browser_tests', |
| 1253 }, |
| 1254 { |
| 1255 'test': 'unittests', |
| 1256 }, |
| 1257 ], |
| 1258 }) |
| 1259 ) + |
| 1260 api.override_step_data( |
| 1261 'analyze', |
| 1262 api.json.output({'status': 'Found dependency', |
| 1263 'targets': ['browser_tests', 'base_unittests'], |
| 1264 'build_targets': ['chrome', 'browser_tests', |
| 1265 'base_unittests']})) |
| 1266 ) |
| 1267 |
| 1268 # Tests compile_targets portion of analyze with a bot that doesn't include the |
| 1269 # 'all' target. |
| 1270 yield ( |
| 1271 api.test( |
| 1272 'compile_because_of_analyze_with_filtered_compile_targets_exclude_all') + |
| 1273 props(buildername='linux_chromium_browser_asan_rel') + |
| 1274 api.platform.name('linux') + |
| 1275 api.override_step_data('read test spec', api.json.output({ |
| 1276 'compile_targets': ['base_unittests'], |
| 1277 'gtest_tests': [ |
| 1278 { |
| 1279 'test': 'browser_tests', |
| 1280 'args': '--gtest-filter: *NaCl*', |
| 1281 }, { |
| 1282 'test': 'base_tests', |
| 1283 'args': ['--gtest-filter: *NaCl*'], |
| 1284 }, |
| 1285 ], |
| 1286 'filter_compile_builders': 'linux_chromium_browser_asan_rel', |
| 1287 }) |
| 1288 ) + |
| 1289 api.override_step_data( |
| 1290 'analyze', |
| 1291 api.json.output({'status': 'Found dependency', |
| 1292 'targets': ['browser_tests', 'base_unittests'], |
| 1293 'build_targets': ['base_unittests']})) |
| 1294 ) |
| 1295 |
OLD | NEW |