| 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 DEPS = [ | 5 DEPS = [ |
| 6 'bot_update', | 6 'bot_update', |
| 7 'chromium', | 7 'chromium', |
| 8 'chromium_tests', | 8 'chromium_tests', |
| 9 'gclient', | 9 'gclient', |
| 10 'isolate', | 10 'isolate', |
| (...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 550 return sorted(set(x | 550 return sorted(set(x |
| 551 for test in tests | 551 for test in tests |
| 552 for x in test.compile_targets(api))) | 552 for x in test.compile_targets(api))) |
| 553 | 553 |
| 554 | 554 |
| 555 def find_test_named(test_name, tests): | 555 def find_test_named(test_name, tests): |
| 556 """Returns a list with all tests whose name matches |test_name|.""" | 556 """Returns a list with all tests whose name matches |test_name|.""" |
| 557 return [test for test in tests if test.name == test_name] | 557 return [test for test in tests if test.name == test_name] |
| 558 | 558 |
| 559 | 559 |
| 560 def build_to_priority(build_properties): | |
| 561 """Returns the Swarming task priority for the build. | |
| 562 | |
| 563 Does this by determining the build type. Lower is higher priority. | |
| 564 """ | |
| 565 requester = build_properties.get('requester') | |
| 566 if requester == 'commit-bot@chromium.org': | |
| 567 # Commit queue job. | |
| 568 return 30 | |
| 569 # Normal try job. | |
| 570 return 50 | |
| 571 | |
| 572 | |
| 573 def GenSteps(api): | 560 def GenSteps(api): |
| 574 def swarming_shards_from_test_spec(test_spec, test_name): | 561 def swarming_shards_from_test_spec(test_spec, test_name): |
| 575 if isinstance(test_spec, dict): | 562 if isinstance(test_spec, dict): |
| 576 gtest_tests_spec = test_spec.get('gtest_tests', []) | 563 gtest_tests_spec = test_spec.get('gtest_tests', []) |
| 577 else: | 564 else: |
| 578 # TODO(phajdan.jr): Convert test step data and remove this. | 565 # TODO(phajdan.jr): Convert test step data and remove this. |
| 579 gtest_tests_spec = test_spec | 566 gtest_tests_spec = test_spec |
| 580 | 567 |
| 581 for test in gtest_tests_spec: | 568 for test in gtest_tests_spec: |
| 582 if not isinstance(test, dict): | 569 if not isinstance(test, dict): |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 852 api.isolate.find_isolated_tests(api.chromium.output_dir) | 839 api.isolate.find_isolated_tests(api.chromium.output_dir) |
| 853 | 840 |
| 854 if bot_config['compile_only']: | 841 if bot_config['compile_only']: |
| 855 tests = [] | 842 tests = [] |
| 856 | 843 |
| 857 return tests, bot_update_step | 844 return tests, bot_update_step |
| 858 | 845 |
| 859 mastername = api.properties.get('mastername') | 846 mastername = api.properties.get('mastername') |
| 860 buildername = api.properties.get('buildername') | 847 buildername = api.properties.get('buildername') |
| 861 bot_config = get_bot_config(mastername, buildername) | 848 bot_config = get_bot_config(mastername, buildername) |
| 862 api.swarming.set_default_dimension('pool', 'Chrome') | 849 api.chromium_tests.configure_swarming('chromium', precommit=True) |
| 863 api.swarming.default_priority = build_to_priority(api.properties) | |
| 864 api.swarming.add_default_tag('project:chromium') | |
| 865 api.swarming.add_default_tag('purpose:pre-commit') | |
| 866 api.swarming.default_idempotent = True | |
| 867 | |
| 868 # Differentiate between try jobs and CQ jobs. Always find out who made the CL. | |
| 869 requestor = api.properties.get('requestor') | |
| 870 if requestor == 'commit-bot@chromium.org': | |
| 871 api.swarming.add_default_tag('purpose:CQ') | |
| 872 blamelist = api.properties.get('blamelist') | |
| 873 if len(blamelist) == 1: | |
| 874 requestor = blamelist[0] | |
| 875 else: | |
| 876 api.swarming.add_default_tag('purpose:ManualTS') | |
| 877 api.swarming.default_user = requestor | |
| 878 | |
| 879 # TODO(phajdan): uncomment once we have XP or 10.6 trybots. | |
| 880 #os_dimension = bot_config.get('swarming_dimensions', {}).get('os') | |
| 881 #if os_dimension: | |
| 882 # api.swarming.set_default_dimension('os', os_dimension) | |
| 883 | 850 |
| 884 main_waterfall_config = bot_config.get('based_on_main_waterfall') | 851 main_waterfall_config = bot_config.get('based_on_main_waterfall') |
| 885 if main_waterfall_config: | 852 if main_waterfall_config: |
| 886 bot_update_step, master_dict, test_spec = \ | 853 bot_update_step, master_dict, test_spec = \ |
| 887 api.chromium_tests.sync_and_configure_build( | 854 api.chromium_tests.sync_and_configure_build( |
| 888 main_waterfall_config['mastername'], | 855 main_waterfall_config['mastername'], |
| 889 main_waterfall_config['buildername'], | 856 main_waterfall_config['buildername'], |
| 890 override_bot_type='builder_tester', | 857 override_bot_type='builder_tester', |
| 891 enable_swarming=True, | 858 enable_swarming=True, |
| 892 chromium_apply_config=['trybot_flavor']) | 859 chromium_apply_config=['trybot_flavor']) |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1142 'chromium': { | 1109 'chromium': { |
| 1143 'exclusions': [], | 1110 'exclusions': [], |
| 1144 }, | 1111 }, |
| 1145 })) + | 1112 })) + |
| 1146 api.step_data('compile (with patch)', retcode=1) + | 1113 api.step_data('compile (with patch)', retcode=1) + |
| 1147 api.step_data('compile (without patch)', retcode=1) | 1114 api.step_data('compile (without patch)', retcode=1) |
| 1148 ) | 1115 ) |
| 1149 | 1116 |
| 1150 yield ( | 1117 yield ( |
| 1151 api.test('arm') + | 1118 api.test('arm') + |
| 1152 api.properties.generic( | 1119 props(buildername='linux_arm', requester='commit-bot@chromium.org', |
| 1153 mastername='tryserver.chromium.linux', | 1120 blamelist='joe@chromium.org', blamelist_real=['joe@chromium.org']) + |
| 1154 buildername='linux_arm', | |
| 1155 requestor='commit-bot@chromium.org', | |
| 1156 blamelist='joe@chromium.org', | |
| 1157 blamelist_real=['joe@chromium.org']) + | |
| 1158 api.platform('linux', 64) + | 1121 api.platform('linux', 64) + |
| 1159 api.override_step_data('read test spec', api.json.output({ | 1122 api.override_step_data('read test spec', api.json.output({ |
| 1160 'compile_targets': ['browser_tests_run'], | 1123 'compile_targets': ['browser_tests_run'], |
| 1161 'gtest_tests': [ | 1124 'gtest_tests': [ |
| 1162 { | 1125 { |
| 1163 'test': 'browser_tests', | 1126 'test': 'browser_tests', |
| 1164 'args': '--gtest-filter: *NaCl*.*', | 1127 'args': '--gtest-filter: *NaCl*.*', |
| 1165 }, { | 1128 }, { |
| 1166 'test': 'base_tests', | 1129 'test': 'base_tests', |
| 1167 'args': ['--gtest-filter: *NaCl*.*'], | 1130 'args': ['--gtest-filter: *NaCl*.*'], |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1221 'filename': 'base/basictypes.h', | 1184 'filename': 'base/basictypes.h', |
| 1222 'license': 'UNKNOWN', | 1185 'license': 'UNKNOWN', |
| 1223 }, | 1186 }, |
| 1224 ])) | 1187 ])) |
| 1225 ) | 1188 ) |
| 1226 | 1189 |
| 1227 # Successfully compiling, isolating and running two targets on swarming for a | 1190 # Successfully compiling, isolating and running two targets on swarming for a |
| 1228 # commit queue job. | 1191 # commit queue job. |
| 1229 yield ( | 1192 yield ( |
| 1230 api.test('swarming_basic_cq') + | 1193 api.test('swarming_basic_cq') + |
| 1231 props(buildername='linux_chromium_rel') + | 1194 props(requester='commit-bot@chromium.org', blamelist='joe@chromium.org', |
| 1195 blamelist_real=['joe@chromium.org']) + |
| 1232 api.platform.name('linux') + | 1196 api.platform.name('linux') + |
| 1233 api.override_step_data('read test spec', api.json.output({ | 1197 api.override_step_data('read test spec', api.json.output({ |
| 1234 'gtest_tests': [ | 1198 'gtest_tests': [ |
| 1235 { | 1199 { |
| 1236 'test': 'base_unittests', | 1200 'test': 'base_unittests', |
| 1237 'swarming': {'can_use_on_swarming_builders': True}, | 1201 'swarming': {'can_use_on_swarming_builders': True}, |
| 1238 }, | 1202 }, |
| 1239 { | 1203 { |
| 1240 'test': 'browser_tests', | 1204 'test': 'browser_tests', |
| 1241 'swarming': { | 1205 'swarming': { |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1294 }, | 1258 }, |
| 1295 })) + | 1259 })) + |
| 1296 api.override_step_data( | 1260 api.override_step_data( |
| 1297 'find isolated tests', | 1261 'find isolated tests', |
| 1298 api.isolate.output_json(['base_unittests', 'browser_tests'])) | 1262 api.isolate.output_json(['base_unittests', 'browser_tests'])) |
| 1299 ) | 1263 ) |
| 1300 | 1264 |
| 1301 # One target (browser_tests) failed to produce *.isolated file. | 1265 # One target (browser_tests) failed to produce *.isolated file. |
| 1302 yield ( | 1266 yield ( |
| 1303 api.test('swarming_missing_isolated') + | 1267 api.test('swarming_missing_isolated') + |
| 1304 props(buildername='linux_chromium_rel') + | 1268 props(requester='commit-bot@chromium.org', blamelist='joe@chromium.org', |
| 1269 blamelist_real=['joe@chromium.org']) + |
| 1305 api.platform.name('linux') + | 1270 api.platform.name('linux') + |
| 1306 api.override_step_data('read test spec', api.json.output({ | 1271 api.override_step_data('read test spec', api.json.output({ |
| 1307 'gtest_tests': [ | 1272 'gtest_tests': [ |
| 1308 { | 1273 { |
| 1309 'test': 'base_unittests', | 1274 'test': 'base_unittests', |
| 1310 'swarming': {'can_use_on_swarming_builders': True}, | 1275 'swarming': {'can_use_on_swarming_builders': True}, |
| 1311 }, | 1276 }, |
| 1312 { | 1277 { |
| 1313 'test': 'browser_tests', | 1278 'test': 'browser_tests', |
| 1314 'swarming': {'can_use_on_swarming_builders': True}, | 1279 'swarming': {'can_use_on_swarming_builders': True}, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1326 })) + | 1291 })) + |
| 1327 api.override_step_data( | 1292 api.override_step_data( |
| 1328 'find isolated tests', | 1293 'find isolated tests', |
| 1329 api.isolate.output_json(['base_unittests'])) | 1294 api.isolate.output_json(['base_unittests'])) |
| 1330 ) | 1295 ) |
| 1331 | 1296 |
| 1332 # One test (base_unittest) failed on swarming. It is retried with | 1297 # One test (base_unittest) failed on swarming. It is retried with |
| 1333 # deapplied patch. | 1298 # deapplied patch. |
| 1334 yield ( | 1299 yield ( |
| 1335 api.test('swarming_deapply_patch') + | 1300 api.test('swarming_deapply_patch') + |
| 1336 props(buildername='linux_chromium_rel') + | 1301 props(requester='commit-bot@chromium.org', blamelist='joe@chromium.org', |
| 1302 blamelist_real=['joe@chromium.org']) + |
| 1337 api.platform.name('linux') + | 1303 api.platform.name('linux') + |
| 1338 api.override_step_data('read test spec', api.json.output({ | 1304 api.override_step_data('read test spec', api.json.output({ |
| 1339 'gtest_tests': [ | 1305 'gtest_tests': [ |
| 1340 { | 1306 { |
| 1341 'test': 'base_unittests', | 1307 'test': 'base_unittests', |
| 1342 'swarming': {'can_use_on_swarming_builders': True}, | 1308 'swarming': {'can_use_on_swarming_builders': True}, |
| 1343 }, | 1309 }, |
| 1344 { | 1310 { |
| 1345 'test': 'browser_tests', | 1311 'test': 'browser_tests', |
| 1346 'swarming': {'can_use_on_swarming_builders': True}, | 1312 'swarming': {'can_use_on_swarming_builders': True}, |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1541 'test': 'base_tests', | 1507 'test': 'base_tests', |
| 1542 'args': ['--gtest-filter: *NaCl*.*'], | 1508 'args': ['--gtest-filter: *NaCl*.*'], |
| 1543 }, | 1509 }, |
| 1544 ], | 1510 ], |
| 1545 }) | 1511 }) |
| 1546 ) + | 1512 ) + |
| 1547 api.override_step_data( | 1513 api.override_step_data( |
| 1548 'analyze', | 1514 'analyze', |
| 1549 api.json.output({'invalid_targets': 'invalid target'})) | 1515 api.json.output({'invalid_targets': 'invalid target'})) |
| 1550 ) | 1516 ) |
| OLD | NEW |