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 | 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 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 483 config_path = api.path.join('testing', 'buildbot', file_name) | 483 config_path = api.path.join('testing', 'buildbot', file_name) |
| 484 step_result = api.json.read( | 484 step_result = api.json.read( |
| 485 'read analyze test spec', | 485 'read analyze test spec', |
| 486 api.path['checkout'].join(config_path), | 486 api.path['checkout'].join(config_path), |
| 487 step_test_data=lambda: api.json.test_api.output({'exclusions': []}) | 487 step_test_data=lambda: api.json.test_api.output({'exclusions': []}) |
| 488 ) | 488 ) |
| 489 step_result.presentation.step_text = 'path: %r' % config_path | 489 step_result.presentation.step_text = 'path: %r' % config_path |
| 490 return step_result.json.output | 490 return step_result.json.output |
| 491 | 491 |
| 492 | 492 |
| 493 def append_test_if_in_compile_targets(test, tests, compile_targets): | |
| 494 """Adds |test| to |tests| if at least one of the test's compile target is in | |
| 495 |compile_targets|.""" | |
| 496 # The target all builds everything. | |
| 497 if 'all' in compile_targets: | |
| 498 tests.append(test) | |
| 499 return | |
|
iannucci
2014/08/20 17:54:40
I would generally recommend returning something (p
sky
2014/08/20 20:26:33
Done.
| |
| 500 for target in test.compile_targets(None): | |
| 501 if target in compile_targets: | |
| 502 tests.append(test) | |
| 503 return | |
| 504 | |
| 505 | |
| 493 add_swarming_builder('linux_chromium_rel', 'linux_chromium_rel_swarming', | 506 add_swarming_builder('linux_chromium_rel', 'linux_chromium_rel_swarming', |
| 494 'tryserver.chromium.linux') | 507 'tryserver.chromium.linux') |
| 495 add_swarming_builder('linux_chromium_chromeos_rel', | 508 add_swarming_builder('linux_chromium_chromeos_rel', |
| 496 'linux_chromium_chromeos_rel_swarming', | 509 'linux_chromium_chromeos_rel_swarming', |
| 497 'tryserver.chromium.linux') | 510 'tryserver.chromium.linux') |
| 498 add_swarming_builder('win_chromium_rel', 'win_chromium_rel_swarming', | 511 add_swarming_builder('win_chromium_rel', 'win_chromium_rel_swarming', |
| 499 'tryserver.chromium.win') | 512 'tryserver.chromium.win') |
| 500 add_swarming_builder('win_chromium_x64_rel', 'win_chromium_x64_rel_swarming', | 513 add_swarming_builder('win_chromium_x64_rel', 'win_chromium_x64_rel_swarming', |
| 501 'tryserver.chromium.win') | 514 'tryserver.chromium.win') |
| 502 add_swarming_builder('mac_chromium_rel', 'mac_chromium_rel_swarming', | 515 add_swarming_builder('mac_chromium_rel', 'mac_chromium_rel_swarming', |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 649 if 'exclude_builders' in test: | 662 if 'exclude_builders' in test: |
| 650 if '%s:%s' % (mastername, buildername) in test['exclude_builders']: | 663 if '%s:%s' % (mastername, buildername) in test['exclude_builders']: |
| 651 return False | 664 return False |
| 652 return True | 665 return True |
| 653 | 666 |
| 654 # Parse test spec file into list of Test instances. | 667 # Parse test spec file into list of Test instances. |
| 655 compile_targets, gtest_tests, swarming_tests = parse_test_spec( | 668 compile_targets, gtest_tests, swarming_tests = parse_test_spec( |
| 656 test_spec, | 669 test_spec, |
| 657 bot_config.get('enable_swarming'), | 670 bot_config.get('enable_swarming'), |
| 658 should_use_test) | 671 should_use_test) |
| 672 compile_targets.extend(bot_config.get('compile_targets', [])) | |
| 673 # TODO(phajdan.jr): Also compile 'all' on win, http://crbug.com/368831 . | |
| 674 # Disabled for now because it takes too long and/or fails on Windows. | |
| 675 if not api.platform.is_win and not bot_config.get('exclude_compile_all'): | |
|
iannucci
2014/08/20 17:54:40
TODO: the bot_config stuff has gotten excessively
sky
2014/08/20 20:26:33
No argument there.
| |
| 676 compile_targets = ['all'] + compile_targets | |
| 659 | 677 |
| 660 runhooks_env = bot_config.get('runhooks_env', {}) | 678 runhooks_env = bot_config.get('runhooks_env', {}) |
| 661 | 679 |
| 662 # See if the patch needs to compile on the current platform. | 680 # See if the patch needs to compile on the current platform. |
| 663 if isinstance(test_spec, dict) and should_filter_builder( | 681 if isinstance(test_spec, dict) and should_filter_builder( |
| 664 buildername, test_spec.get('non_filter_builders', []), | 682 buildername, test_spec.get('non_filter_builders', []), |
| 665 api.properties.get('root')): | 683 api.properties.get('root')): |
| 666 analyze_config = get_analyze_config( | 684 analyze_config = get_analyze_config( |
| 667 api, bot_config['testing'].get('analyze_config_file', | 685 api, bot_config['testing'].get('analyze_config_file', |
| 668 'trybot_analyze_config.json')) | 686 'trybot_analyze_config.json')) |
| 669 api.filter.does_patch_require_compile( | 687 api.filter.does_patch_require_compile( |
| 670 exclusions=analyze_config.get('exclusions', []), | 688 exclusions=analyze_config.get('exclusions', []), |
| 671 exes=get_test_names(gtest_tests, swarming_tests), | 689 exes=get_test_names(gtest_tests, swarming_tests), |
| 690 compile_targets=compile_targets, | |
| 672 env=runhooks_env) | 691 env=runhooks_env) |
| 673 if not api.filter.result: | 692 if not api.filter.result: |
| 674 return [], swarming_tests, bot_update_step | 693 return [], swarming_tests, bot_update_step |
| 675 # Patch needs compile. Filter the list of test targets. | 694 # Patch needs compile. Filter the list of test and compile targets. |
| 676 if should_filter_tests(buildername, | 695 if should_filter_tests(buildername, |
| 677 test_spec.get('non_filter_tests_builders', [])): | 696 test_spec.get('non_filter_tests_builders', [])): |
| 678 gtest_tests = filter_tests(gtest_tests, api.filter.matching_exes) | 697 gtest_tests = filter_tests(gtest_tests, api.filter.matching_exes) |
| 679 swarming_tests = filter_tests(swarming_tests, api.filter.matching_exes) | 698 swarming_tests = filter_tests(swarming_tests, api.filter.matching_exes) |
| 699 if buildername in test_spec.get('filter_compile_builders', []): | |
| 700 if 'all' in compile_targets: | |
|
iannucci
2014/08/20 17:54:40
TBH, I would rather 'magic' compile targets like '
sky
2014/08/20 20:26:33
The specialness is handled by the build system. Ar
| |
| 701 compile_targets = api.filter.compile_targets | |
| 702 else: | |
| 703 compile_targets = list(set(compile_targets) & | |
| 704 set(api.filter.compile_targets)) | |
| 680 | 705 |
| 681 # Swarming uses Isolate to transfer files to swarming bots. | 706 # Swarming uses Isolate to transfer files to swarming bots. |
| 682 # set_isolate_environment modifies GYP_DEFINES to enable test isolation. | 707 # set_isolate_environment modifies GYP_DEFINES to enable test isolation. |
| 683 if bot_config.get('use_isolate') or swarming_tests: | 708 if bot_config.get('use_isolate') or swarming_tests: |
| 684 api.isolate.set_isolate_environment(api.chromium.c) | 709 api.isolate.set_isolate_environment(api.chromium.c) |
| 685 | 710 |
| 686 # If going to use swarming_client (pinned in src/DEPS), ensure it is | 711 # If going to use swarming_client (pinned in src/DEPS), ensure it is |
| 687 # compatible with what recipes expect. | 712 # compatible with what recipes expect. |
| 688 if swarming_tests: | 713 if swarming_tests: |
| 689 api.swarming.check_client_version() | 714 api.swarming.check_client_version() |
| 690 # Decide the task priority. | 715 # Decide the task priority. |
| 691 api.swarming.task_priority = build_to_priority(api.properties) | 716 api.swarming.task_priority = build_to_priority(api.properties) |
| 692 | 717 |
| 693 api.chromium.runhooks(env=runhooks_env) | 718 api.chromium.runhooks(env=runhooks_env) |
| 694 | 719 |
| 695 tests = [] | 720 tests = [] |
| 696 # TODO(phajdan.jr): Re-enable checkdeps on Windows when it works with git. | 721 # TODO(phajdan.jr): Re-enable checkdeps on Windows when it works with git. |
| 697 if not api.platform.is_win: | 722 if not api.platform.is_win: |
| 698 tests.append(api.chromium.steps.CheckdepsTest()) | 723 tests.append(api.chromium.steps.CheckdepsTest()) |
| 699 if api.platform.is_linux: | 724 if api.platform.is_linux: |
| 700 tests.extend([ | 725 tests.extend([ |
| 701 api.chromium.steps.CheckpermsTest(), | 726 api.chromium.steps.CheckpermsTest(), |
| 702 api.chromium.steps.ChecklicensesTest(), | 727 api.chromium.steps.ChecklicensesTest(), |
| 703 ]) | 728 ]) |
| 704 tests.append(api.chromium.steps.Deps2GitTest()) | 729 tests.append(api.chromium.steps.Deps2GitTest()) |
| 705 | 730 |
| 706 if (bot_config['chromium_config'] not in ['chromium_chromeos', | 731 if (bot_config['chromium_config'] not in ['chromium_chromeos', |
| 707 'chromium_chromeos_clang'] | 732 'chromium_chromeos_clang'] |
|
iannucci
2014/08/20 17:54:40
this should be
if bot_config.get('do_telemetry_te
sky
2014/08/20 20:26:33
Agreed. I didn't add these. I'm happy to change in
| |
| 708 and not buildername.startswith('win8')): | 733 and not buildername.startswith('win8')): |
|
iannucci
2014/08/20 17:54:40
This is exactly the sort of logic that configs sho
| |
| 709 tests.append(api.chromium.steps.TelemetryUnitTests()) | 734 append_test_if_in_compile_targets(api.chromium.steps.TelemetryUnitTests(), |
| 710 tests.append(api.chromium.steps.TelemetryPerfUnitTests()) | 735 tests, compile_targets) |
| 736 append_test_if_in_compile_targets( | |
| 737 api.chromium.steps.TelemetryPerfUnitTests(), tests, compile_targets) | |
| 711 | 738 |
| 712 tests.extend(gtest_tests) | 739 tests.extend(gtest_tests) |
| 713 tests.extend(swarming_tests) | 740 tests.extend(swarming_tests) |
| 714 tests.append(api.chromium.steps.NaclIntegrationTest()) | 741 append_test_if_in_compile_targets(api.chromium.steps.NaclIntegrationTest(), |
| 742 tests, compile_targets) | |
| 743 # MojoPythonTests don't require anything to be compiled. | |
| 715 tests.append(api.chromium.steps.MojoPythonTests()) | 744 tests.append(api.chromium.steps.MojoPythonTests()) |
| 716 | 745 |
| 717 # test_installer only works on 32-bit builds; http://crbug.com/399643 | 746 # test_installer only works on 32-bit builds; http://crbug.com/399643 |
| 718 # Disabled due to retry issues (http://crbug.com/402081. | 747 # Disabled due to retry issues (http://crbug.com/402081. |
| 719 #if api.platform.is_win and api.chromium.c.TARGET_BITS == 32: | 748 #if api.platform.is_win and api.chromium.c.TARGET_BITS == 32: |
| 720 # tests.append(api.chromium.steps.MiniInstallerTest()) | 749 # tests.append(api.chromium.steps.MiniInstallerTest()) |
| 721 | 750 |
| 722 compile_targets.extend(bot_config.get('compile_targets', [])) | |
| 723 compile_targets.extend(api.itertools.chain( | 751 compile_targets.extend(api.itertools.chain( |
| 724 *[t.compile_targets(api) for t in tests])) | 752 *[t.compile_targets(api) for t in tests])) |
| 725 # TODO(phajdan.jr): Also compile 'all' on win, http://crbug.com/368831 . | |
| 726 # Disabled for now because it takes too long and/or fails on Windows. | |
| 727 if not api.platform.is_win and not bot_config.get('exclude_compile_all'): | |
| 728 compile_targets = ['all'] + compile_targets | |
| 729 api.chromium.compile(compile_targets, name='compile (with patch)') | 753 api.chromium.compile(compile_targets, name='compile (with patch)') |
| 730 | 754 |
| 731 # Collect *.isolated hashes for all isolated targets, used when triggering | 755 # Collect *.isolated hashes for all isolated targets, used when triggering |
| 732 # tests on swarming. | 756 # tests on swarming. |
| 733 if bot_config.get('use_isolate') or swarming_tests: | 757 if bot_config.get('use_isolate') or swarming_tests: |
| 734 api.isolate.find_isolated_tests(api.chromium.output_dir) | 758 api.isolate.find_isolated_tests(api.chromium.output_dir) |
| 735 | 759 |
| 736 if bot_config['compile_only']: | 760 if bot_config['compile_only']: |
| 737 tests = [] | 761 tests = [] |
| 738 swarming_tests = [] | 762 swarming_tests = [] |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 762 bot_update_json['properties']['got_revision']) | 786 bot_update_json['properties']['got_revision']) |
| 763 api.bot_update.ensure_checkout(force=True, | 787 api.bot_update.ensure_checkout(force=True, |
| 764 patch=False, | 788 patch=False, |
| 765 update_presentation=False) | 789 update_presentation=False) |
| 766 try: | 790 try: |
| 767 api.chromium.runhooks() | 791 api.chromium.runhooks() |
| 768 finally: | 792 finally: |
| 769 compile_targets = list(api.itertools.chain( | 793 compile_targets = list(api.itertools.chain( |
| 770 *[t.compile_targets(api) for t in failing_tests])) | 794 *[t.compile_targets(api) for t in failing_tests])) |
| 771 if compile_targets: | 795 if compile_targets: |
| 796 # Remove duplicate targets. | |
| 797 compile_targets = list(set(compile_targets)) | |
| 772 try: | 798 try: |
| 773 api.chromium.compile( | 799 api.chromium.compile( |
| 774 compile_targets, name='compile (without patch)') | 800 compile_targets, name='compile (without patch)') |
| 775 except api.step.StepFailure: | 801 except api.step.StepFailure: |
| 776 api.chromium.compile(compile_targets, | 802 api.chromium.compile(compile_targets, |
| 777 name='compile (without patch, clobber)', | 803 name='compile (without patch, clobber)', |
| 778 force_clobber=True) | 804 force_clobber=True) |
| 779 # Search for *.isolated only if enabled in bot config or if some | 805 # Search for *.isolated only if enabled in bot config or if some |
| 780 # swarming test is being recompiled. | 806 # swarming test is being recompiled. |
| 781 bot_config = get_bot_config(mastername, buildername) | 807 bot_config = get_bot_config(mastername, buildername) |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1111 # analyze result returning true. This should result in a compile. | 1137 # analyze result returning true. This should result in a compile. |
| 1112 yield ( | 1138 yield ( |
| 1113 api.test('compile_because_of_analyze') + | 1139 api.test('compile_because_of_analyze') + |
| 1114 props(buildername='linux_chromium_rel') + | 1140 props(buildername='linux_chromium_rel') + |
| 1115 api.platform.name('linux') + | 1141 api.platform.name('linux') + |
| 1116 api.override_step_data('read test spec', api.json.output({ | 1142 api.override_step_data('read test spec', api.json.output({ |
| 1117 }) | 1143 }) |
| 1118 ) + | 1144 ) + |
| 1119 api.override_step_data( | 1145 api.override_step_data( |
| 1120 'analyze', | 1146 'analyze', |
| 1121 api.json.output({'status': 'Found dependency', 'targets': []})) | 1147 api.json.output({'status': 'Found dependency', 'targets': [], |
| 1148 'build_targets': []})) | |
| 1122 ) | 1149 ) |
| 1123 | 1150 |
| 1124 # Tests analyze module by way of specifying non_filter_builders and | 1151 # Tests analyze module by way of specifying non_filter_builders and |
| 1125 # analyze result returning true along with a smaller set of tests. | 1152 # analyze result returning true along with a smaller set of tests. |
| 1126 yield ( | 1153 yield ( |
| 1127 api.test('compile_because_of_analyze_with_filtered_tests_no_builder') + | 1154 api.test('compile_because_of_analyze_with_filtered_tests_no_builder') + |
| 1128 props(buildername='linux_chromium_rel') + | 1155 props(buildername='linux_chromium_rel') + |
| 1129 api.platform.name('linux') + | 1156 api.platform.name('linux') + |
| 1130 api.override_step_data('read test spec', api.json.output({ | 1157 api.override_step_data('read test spec', api.json.output({ |
| 1131 'non_filter_tests_builders': ['linux_chromium_rel'], | 1158 'non_filter_tests_builders': ['linux_chromium_rel'], |
| 1132 'gtest_tests': [ | 1159 'gtest_tests': [ |
| 1133 { | 1160 { |
| 1134 'test': 'base_unittests', | 1161 'test': 'base_unittests', |
| 1135 'swarming': {'can_use_on_swarming_builders': True}, | 1162 'swarming': {'can_use_on_swarming_builders': True}, |
| 1136 }, | 1163 }, |
| 1137 { | 1164 { |
| 1138 'test': 'browser_tests', | 1165 'test': 'browser_tests', |
| 1139 }, | 1166 }, |
| 1140 { | 1167 { |
| 1141 'test': 'unittests', | 1168 'test': 'unittests', |
| 1142 }, | 1169 }, |
| 1143 ], | 1170 ], |
| 1144 }) | 1171 }) |
| 1145 ) + | 1172 ) + |
| 1146 api.override_step_data( | 1173 api.override_step_data( |
| 1147 'analyze', | 1174 'analyze', |
| 1148 api.json.output({'status': 'Found dependency', | 1175 api.json.output({'status': 'Found dependency', |
| 1149 'targets': ['browser_tests', 'base_unittests']})) | 1176 'targets': ['browser_tests', 'base_unittests'], |
| 1177 'build_targets': ['browser_tests', 'base_unittests']})) | |
| 1150 ) | 1178 ) |
| 1151 | 1179 |
| 1152 # Tests analyze module by way of not specifying non_filter_builders and | 1180 # Tests analyze module by way of not specifying non_filter_builders and |
| 1153 # analyze result returning true along with a smaller set of tests. This | 1181 # analyze result returning true along with a smaller set of tests. This |
| 1154 # specifices a 'filter_test_builder', so that this bot uses the filtered set. | 1182 # specifices a 'filter_test_builder', so that this bot uses the filtered set. |
| 1155 yield ( | 1183 yield ( |
| 1156 api.test('compile_because_of_analyze_with_filtered_tests') + | 1184 api.test('compile_because_of_analyze_with_filtered_tests') + |
| 1157 props(buildername='linux_chromium_rel') + | 1185 props(buildername='linux_chromium_rel') + |
| 1158 api.platform.name('linux') + | 1186 api.platform.name('linux') + |
| 1159 api.override_step_data('read test spec', api.json.output({ | 1187 api.override_step_data('read test spec', api.json.output({ |
| 1160 'gtest_tests': [ | 1188 'gtest_tests': [ |
| 1161 { | 1189 { |
| 1162 'test': 'base_unittests', | 1190 'test': 'base_unittests', |
| 1163 'swarming': {'can_use_on_swarming_builders': True}, | 1191 'swarming': {'can_use_on_swarming_builders': True}, |
| 1164 }, | 1192 }, |
| 1165 { | 1193 { |
| 1166 'test': 'browser_tests', | 1194 'test': 'browser_tests', |
| 1167 }, | 1195 }, |
| 1168 { | 1196 { |
| 1169 'test': 'unittests', | 1197 'test': 'unittests', |
| 1170 }, | 1198 }, |
| 1171 ], | 1199 ], |
| 1172 }) | 1200 }) |
| 1173 ) + | 1201 ) + |
| 1174 api.override_step_data( | 1202 api.override_step_data( |
| 1175 'analyze', | 1203 'analyze', |
| 1176 api.json.output({'status': 'Found dependency', | 1204 api.json.output({'status': 'Found dependency', |
| 1177 'targets': ['browser_tests', 'base_unittests']})) | 1205 'targets': ['browser_tests', 'base_unittests'], |
| 1206 'build_targets': ['browser_tests', 'base_unittests']})) | |
| 1178 ) | 1207 ) |
| 1208 | |
| 1209 # Tests compile_target portion of analyze module. | |
| 1210 yield ( | |
| 1211 api.test('compile_because_of_analyze_with_filtered_compile_targets') + | |
| 1212 props(buildername='linux_chromium_rel') + | |
| 1213 api.platform.name('linux') + | |
| 1214 api.override_step_data('read test spec', api.json.output({ | |
| 1215 'filter_compile_builders': 'linux_chromium_rel', | |
| 1216 'gtest_tests': [ | |
| 1217 { | |
| 1218 'test': 'base_unittests', | |
| 1219 'swarming': {'can_use_on_swarming_builders': True}, | |
| 1220 }, | |
| 1221 { | |
| 1222 'test': 'browser_tests', | |
| 1223 }, | |
| 1224 { | |
| 1225 'test': 'unittests', | |
| 1226 }, | |
| 1227 ], | |
| 1228 }) | |
| 1229 ) + | |
| 1230 api.override_step_data( | |
| 1231 'analyze', | |
| 1232 api.json.output({'status': 'Found dependency', | |
| 1233 'targets': ['browser_tests', 'base_unittests'], | |
| 1234 'build_targets': ['chrome', 'browser_tests', | |
| 1235 'base_unittests']})) | |
| 1236 ) | |
| 1237 | |
| 1238 # Tests compile_targets portion of analyze with a bot that doesn't include the | |
| 1239 # 'all' target. | |
| 1240 yield ( | |
| 1241 api.test( | |
| 1242 'compile_because_of_analyze_with_filtered_compile_targets_exclude_all') + | |
| 1243 props(buildername='linux_browser_asan') + | |
| 1244 api.platform.name('linux') + | |
| 1245 api.override_step_data('read test spec', api.json.output({ | |
| 1246 'compile_targets': ['base_unittests'], | |
| 1247 'gtest_tests': [ | |
| 1248 { | |
| 1249 'test': 'browser_tests', | |
| 1250 'args': '--gtest-filter: *NaCl*', | |
| 1251 }, { | |
| 1252 'test': 'base_tests', | |
| 1253 'args': ['--gtest-filter: *NaCl*'], | |
| 1254 }, | |
| 1255 ], | |
| 1256 'filter_compile_builders': 'linux_browser_asan', | |
| 1257 }) | |
| 1258 ) + | |
| 1259 api.override_step_data( | |
| 1260 'analyze', | |
| 1261 api.json.output({'status': 'Found dependency', | |
| 1262 'targets': ['browser_tests', 'base_unittests'], | |
| 1263 'build_targets': ['base_unittests']})) | |
| 1264 ) | |
| 1265 | |
| OLD | NEW |