Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 ast | 5 import ast |
| 6 import collections | 6 import collections |
| 7 import contextlib | 7 import contextlib |
| 8 import copy | 8 import copy |
| 9 import itertools | 9 import itertools |
| 10 import json | 10 import json |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 61 return steps | 61 return steps |
| 62 | 62 |
| 63 @property | 63 @property |
| 64 def trybots(self): | 64 def trybots(self): |
| 65 return trybots.TRYBOTS | 65 return trybots.TRYBOTS |
| 66 | 66 |
| 67 def add_builders(self, builders): | 67 def add_builders(self, builders): |
| 68 """Adds builders to our builder map""" | 68 """Adds builders to our builder map""" |
| 69 self._builders.update(builders) | 69 self._builders.update(builders) |
| 70 | 70 |
| 71 def _get_bot_config_internal(self, mastername, buildername): | |
|
Paweł Hajdan Jr.
2016/01/07 09:14:27
"internal" is a bit vague. How about renaming to _
| |
| 72 master_dict = self.builders.get(mastername, {}) | |
| 73 return master_dict.get('builders', {}).get(buildername) | |
| 74 | |
| 71 def get_bot_config(self, mastername, buildername): | 75 def get_bot_config(self, mastername, buildername): |
| 72 master_dict = self.builders.get(mastername, {}) | 76 return freeze(self._get_bot_config_internal(mastername, buildername)) |
| 73 return freeze(master_dict.get('builders', {}).get(buildername)) | |
| 74 | 77 |
| 75 def configure_build(self, mastername, buildername, override_bot_type=None): | 78 def _verify_additional_trybot_mirror_property(self, mastername, buildername, |
| 76 master_dict = self.builders.get(mastername, {}) | 79 additional_trybot_mirrors, |
| 77 bot_config = master_dict.get('builders', {}).get(buildername) | 80 property): |
| 81 if not additional_trybot_mirrors: | |
| 82 return | |
| 83 bot_config = self._get_bot_config_internal(mastername, buildername) | |
| 84 # Verify that all of the other builders this trybot is supposed to | |
| 85 # mirror all use the same key properties like chromium_config and | |
| 86 # gclient_config. Otherwise, unexpected results are likely. | |
|
Paweł Hajdan Jr.
2016/01/07 09:14:27
Whoa. Thanks for thinking about this. I agree it's
Ken Russell (switch to Gerrit)
2016/01/07 10:19:24
I haven't talked with Luke about this patch. I men
| |
| 87 for mirror in additional_trybot_mirrors: | |
| 88 mirror_config = self._get_bot_config_internal(mirror['mastername'], | |
| 89 mirror['buildername']) | |
| 90 if not mirror_config: | |
| 91 raise '%s not found for master %s' % ( | |
| 92 mirror['mastername'], mirror['buildername']) # pragma: no cover | |
| 93 if mirror_config.get(property) != bot_config.get(property): | |
| 94 raise ('%s was different between (%s, %s) and ' + | |
| 95 'additional trybot mirror (%s, %s)' % | |
| 96 (property, mastername, buildername, mirror['mastername'], | |
| 97 mirror['buildername'])) # pragma: no cover | |
| 98 | |
| 99 def configure_build(self, mastername, buildername, | |
| 100 additional_trybot_mirrors=None, | |
| 101 override_bot_type=None): | |
| 102 bot_config = self._get_bot_config_internal(mastername, buildername) | |
| 103 all_bot_configs = [bot_config] | |
| 104 if additional_trybot_mirrors: | |
| 105 for mirror in additional_trybot_mirrors: | |
| 106 mirror_config = self._get_bot_config_internal(mirror['mastername'], | |
| 107 mirror['buildername']) | |
| 108 all_bot_configs.append(mirror_config) | |
| 78 | 109 |
| 79 # Get the buildspec version. It can be supplied as a build property or as | 110 # Get the buildspec version. It can be supplied as a build property or as |
| 80 # a recipe config value. | 111 # a recipe config value. |
| 81 buildspec_version = (self.m.properties.get('buildspec_version') or | 112 buildspec_version = (self.m.properties.get('buildspec_version') or |
| 82 bot_config.get('buildspec_version')) | 113 bot_config.get('buildspec_version')) |
| 83 | 114 |
| 84 self.m.chromium.set_config( | 115 self.m.chromium.set_config( |
| 85 bot_config.get('chromium_config'), | 116 bot_config.get('chromium_config'), |
| 86 **bot_config.get('chromium_config_kwargs', {})) | 117 **bot_config.get('chromium_config_kwargs', {})) |
| 87 | 118 |
| 119 self._verify_additional_trybot_mirror_property( | |
| 120 mastername, buildername, additional_trybot_mirrors, 'chromium_config') | |
| 121 | |
| 88 # Set GYP_DEFINES explicitly because chromium config constructor does | 122 # Set GYP_DEFINES explicitly because chromium config constructor does |
| 89 # not support that. | 123 # not support that. |
| 90 self.m.chromium.c.gyp_env.GYP_DEFINES.update( | 124 for config in all_bot_configs: |
| 91 bot_config.get('GYP_DEFINES', {})) | 125 self.m.chromium.c.gyp_env.GYP_DEFINES.update( |
| 92 if bot_config.get('use_isolate'): | 126 config.get('GYP_DEFINES', {})) |
| 93 self.m.isolate.set_isolate_environment(self.m.chromium.c) | 127 for config in all_bot_configs: |
| 128 if config.get('use_isolate'): | |
| 129 self.m.isolate.set_isolate_environment(self.m.chromium.c) | |
| 130 break | |
| 94 | 131 |
| 95 self.m.gclient.set_config( | 132 self.m.gclient.set_config( |
| 96 bot_config.get('gclient_config'), | 133 bot_config.get('gclient_config'), |
| 97 PATCH_PROJECT=self.m.properties.get('patch_project'), | 134 PATCH_PROJECT=self.m.properties.get('patch_project'), |
| 98 BUILDSPEC_VERSION=buildspec_version, | 135 BUILDSPEC_VERSION=buildspec_version, |
| 99 **bot_config.get('gclient_config_kwargs', {})) | 136 **bot_config.get('gclient_config_kwargs', {})) |
| 100 | 137 |
| 138 self._verify_additional_trybot_mirror_property( | |
| 139 mastername, buildername, additional_trybot_mirrors, 'gclient_config') | |
| 140 | |
| 101 if 'android_config' in bot_config: | 141 if 'android_config' in bot_config: |
| 102 self.m.chromium_android.configure_from_properties( | 142 self.m.chromium_android.configure_from_properties( |
| 103 bot_config['android_config'], | 143 bot_config['android_config'], |
| 104 **bot_config.get('chromium_config_kwargs', {})) | 144 **bot_config.get('chromium_config_kwargs', {})) |
| 145 assert additional_trybot_mirrors == None | |
| 105 | 146 |
| 106 if 'amp_config' in bot_config: | 147 if 'amp_config' in bot_config: |
| 107 self.m.amp.set_config(bot_config['amp_config']) | 148 self.m.amp.set_config(bot_config['amp_config']) |
| 149 assert additional_trybot_mirrors == None | |
| 108 | 150 |
| 109 for c in bot_config.get('chromium_apply_config', []): | 151 chromium_applied_configs = set() |
| 110 self.m.chromium.apply_config(c) | 152 gclient_applied_configs = set() |
| 111 | 153 for config in all_bot_configs: |
| 112 for c in bot_config.get('gclient_apply_config', []): | 154 for c in config.get('chromium_apply_config', []): |
|
Sergey Berezin
2016/01/06 01:50:56
nit: Does the order matter? If not, you can shorte
Ken Russell (switch to Gerrit)
2016/01/06 03:30:07
After talking with iannucci@, the order does matte
Sergey Berezin
2016/01/06 19:12:35
Acknowledged.
| |
| 113 self.m.gclient.apply_config(c) | 155 if not c in chromium_applied_configs: |
| 156 self.m.chromium.apply_config(c) | |
| 157 chromium_applied_configs.add(c) | |
| 158 for c in config.get('gclient_apply_config', []): | |
| 159 if not c in gclient_applied_configs: | |
| 160 self.m.gclient.apply_config(c) | |
| 161 gclient_applied_configs.add(c) | |
| 114 | 162 |
| 115 # WARNING: src-side runtest.py is only tested with chromium CQ builders. | 163 # WARNING: src-side runtest.py is only tested with chromium CQ builders. |
| 116 # Usage not covered by chromium CQ is not supported and can break | 164 # Usage not covered by chromium CQ is not supported and can break |
| 117 # without notice. | 165 # without notice. |
| 166 master_dict = self.builders.get(mastername, {}) | |
| 118 if master_dict.get('settings', {}).get('src_side_runtest_py'): | 167 if master_dict.get('settings', {}).get('src_side_runtest_py'): |
| 119 self.m.chromium.c.runtest_py.src_side = True | 168 self.m.chromium.c.runtest_py.src_side = True |
| 120 | 169 |
| 121 if bot_config.get('goma_canary'): | 170 if bot_config.get('goma_canary'): |
| 122 self.m.goma.update_goma_canary(buildername) | 171 self.m.goma.update_goma_canary(buildername) |
| 172 assert additional_trybot_mirrors == None | |
| 123 | 173 |
| 124 bot_type = override_bot_type or bot_config.get('bot_type', 'builder_tester') | 174 bot_type = override_bot_type or bot_config.get('bot_type', 'builder_tester') |
| 125 | 175 |
| 126 if bot_config.get('set_component_rev'): | 176 if bot_config.get('set_component_rev'): |
| 127 # If this is a component build and the main revision is e.g. blink, | 177 # If this is a component build and the main revision is e.g. blink, |
| 128 # webrtc, or v8, the custom deps revision of this component must be | 178 # webrtc, or v8, the custom deps revision of this component must be |
| 129 # dynamically set to either: | 179 # dynamically set to either: |
| 130 # (1) the revision of the builder if this is a tester, | 180 # (1) the revision of the builder if this is a tester, |
| 131 # (2) 'revision' from the waterfall, or | 181 # (2) 'revision' from the waterfall, or |
| 132 # (3) 'HEAD' for forced builds with unspecified 'revision'. | 182 # (3) 'HEAD' for forced builds with unspecified 'revision'. |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 201 dict(builders[loop_buildername])) | 251 dict(builders[loop_buildername])) |
| 202 builders[loop_buildername]['tests'] = ( | 252 builders[loop_buildername]['tests'] = ( |
| 203 self.generate_tests_from_test_spec( | 253 self.generate_tests_from_test_spec( |
| 204 self.m, test_spec, builder_dict, loop_buildername, mastername, | 254 self.m, test_spec, builder_dict, loop_buildername, mastername, |
| 205 # TODO(phajdan.jr): Get enable_swarming value from builder_dict. | 255 # TODO(phajdan.jr): Get enable_swarming value from builder_dict. |
| 206 # Above should remove the need to get bot_config and buildername | 256 # Above should remove the need to get bot_config and buildername |
| 207 # in this method. | 257 # in this method. |
| 208 bot_config.get('enable_swarming', False), | 258 bot_config.get('enable_swarming', False), |
| 209 scripts_compile_targets, builder_dict.get('test_generators', []) | 259 scripts_compile_targets, builder_dict.get('test_generators', []) |
| 210 )) | 260 )) |
| 211 | |
| 212 return freeze(master_dict) | 261 return freeze(master_dict) |
| 213 | 262 |
| 214 def prepare_checkout(self, mastername, buildername, | 263 def prepare_checkout(self, mastername, buildername, |
| 264 additional_trybot_mirrors=None, | |
| 215 root_solution_revision=None): | 265 root_solution_revision=None): |
| 216 bot_config = self.get_bot_config(mastername, buildername) | 266 bot_config = self.get_bot_config(mastername, buildername) |
| 217 | 267 |
| 218 update_step = self.ensure_checkout(mastername, buildername, | 268 update_step = self.ensure_checkout(mastername, buildername, |
| 219 root_solution_revision) | 269 root_solution_revision) |
| 220 # TODO(robertocn): Remove this hack by the end of Q1/2016. | 270 # TODO(robertocn): Remove this hack by the end of Q1/2016. |
| 221 if (mastername == 'tryserver.chromium.perf' | 271 if (mastername == 'tryserver.chromium.perf' |
| 222 and bot_config.get('bot_type') == 'builder' | 272 and bot_config.get('bot_type') == 'builder' |
| 223 and buildername.endswith('builder')): | 273 and buildername.endswith('builder')): |
| 224 force_legacy_compile = self.should_force_legacy_compiling( | 274 force_legacy_compile = self.should_force_legacy_compiling( |
| 225 mastername, buildername) | 275 mastername, buildername) |
| 226 if force_legacy_compile: | 276 if force_legacy_compile: |
| 227 self.m.chromium.c.project_generator.tool = 'gyp' | 277 self.m.chromium.c.project_generator.tool = 'gyp' |
| 228 | 278 |
| 229 self.set_up_swarming(mastername, buildername) | 279 self.set_up_swarming(mastername, buildername) |
| 230 self.runhooks(update_step) | 280 self.runhooks(update_step) |
| 231 | 281 |
| 232 test_spec = self.get_test_spec(mastername, buildername) | 282 test_specs = [self.get_test_spec(mastername, buildername)] |
| 283 if additional_trybot_mirrors: | |
| 284 for mirror in additional_trybot_mirrors: | |
| 285 test_specs.append(self.get_test_spec(mirror['mastername'], | |
| 286 mirror['buildername'])) | |
| 233 | 287 |
| 234 # TODO(phajdan.jr): Bots should have no generators instead. | 288 # TODO(phajdan.jr): Bots should have no generators instead. |
| 235 if bot_config.get('disable_tests'): | 289 if bot_config.get('disable_tests'): |
| 236 scripts_compile_targets = {} | 290 scripts_compile_targets = {} |
| 237 else: | 291 else: |
| 238 scripts_compile_targets = \ | 292 scripts_compile_targets = \ |
| 239 self.get_compile_targets_for_scripts().json.output | 293 self.get_compile_targets_for_scripts().json.output |
| 240 | 294 |
| 241 master_dict = self.get_master_dict_with_dynamic_tests( | 295 master_dicts = [ |
| 242 mastername, buildername, test_spec, scripts_compile_targets) | 296 self.get_master_dict_with_dynamic_tests( |
| 297 mastername, buildername, test_specs[0], scripts_compile_targets)] | |
|
Sergey Berezin
2016/01/06 01:50:56
nit: indent args by 4 spaces
| |
| 298 if additional_trybot_mirrors: | |
| 299 i = 1 | |
| 300 for mirror in additional_trybot_mirrors: | |
|
Sergey Berezin
2016/01/06 01:50:56
nit: for i, mirror in enumerate(additional_trybot_
| |
| 301 master_dicts.append( | |
| 302 self.get_master_dict_with_dynamic_tests( | |
|
Sergey Berezin
2016/01/06 01:50:56
nit: indent args by 4 spaces, here and below
| |
| 303 mirror['mastername'], mirror['buildername'], test_specs[i], | |
| 304 scripts_compile_targets)) | |
| 305 i += 1 | |
| 243 | 306 |
| 244 if self.m.chromium.c.lto and \ | 307 if self.m.chromium.c.lto and \ |
| 245 not self.m.chromium.c.env.LLVM_FORCE_HEAD_REVISION: | 308 not self.m.chromium.c.env.LLVM_FORCE_HEAD_REVISION: |
| 246 self.m.chromium.download_lto_plugin() | 309 self.m.chromium.download_lto_plugin() |
| 247 | 310 |
| 248 return update_step, master_dict, test_spec | 311 return update_step, master_dicts, test_specs |
| 249 | 312 |
| 250 def generate_tests_from_test_spec(self, api, test_spec, builder_dict, | 313 def generate_tests_from_test_spec(self, api, test_spec, builder_dict, |
| 251 buildername, mastername, enable_swarming, scripts_compile_targets, | 314 buildername, mastername, enable_swarming, scripts_compile_targets, |
| 252 generators): | 315 generators): |
| 253 tests = builder_dict.get('tests', ()) | 316 tests = builder_dict.get('tests', ()) |
| 254 # TODO(phajdan.jr): Switch everything to scripts generators and simplify. | 317 # TODO(phajdan.jr): Switch everything to scripts generators and simplify. |
| 255 for generator in generators: | 318 for generator in generators: |
| 256 tests = ( | 319 tests = ( |
| 257 tuple(generator(api, mastername, buildername, test_spec, | 320 tuple(generator(api, mastername, buildername, test_spec, |
| 258 enable_swarming=enable_swarming, | 321 enable_swarming=enable_swarming, |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 316 raise | 379 raise |
| 317 | 380 |
| 318 if failed_tests: | 381 if failed_tests: |
| 319 failed_tests_names = [t.name for t in failed_tests] | 382 failed_tests_names = [t.name for t in failed_tests] |
| 320 raise self.m.step.StepFailure( | 383 raise self.m.step.StepFailure( |
| 321 '%d tests failed: %r' % (len(failed_tests), failed_tests_names)) | 384 '%d tests failed: %r' % (len(failed_tests), failed_tests_names)) |
| 322 | 385 |
| 323 return test_runner | 386 return test_runner |
| 324 | 387 |
| 325 def get_compile_targets_and_tests( | 388 def get_compile_targets_and_tests( |
| 326 self, mastername, buildername, master_dict, test_spec, | 389 self, mastername, buildername, master_dicts, |
| 390 additional_trybot_mirrors, test_specs, | |
| 327 override_bot_type=None, override_tests=None): | 391 override_bot_type=None, override_tests=None): |
| 328 """Returns a tuple: list of compile targets and list of tests. | 392 """Returns a tuple: list of compile targets and list of tests. |
| 329 | 393 |
| 330 The list of tests includes ones on the triggered testers.""" | 394 The list of tests includes ones on the triggered testers.""" |
| 331 | 395 |
| 332 bot_config = master_dict.get('builders', {}).get(buildername) | 396 bot_config = master_dicts[0].get('builders', {}).get(buildername) |
| 333 bot_type = override_bot_type or bot_config.get('bot_type', 'builder_tester') | 397 bot_type = override_bot_type or bot_config.get('bot_type', 'builder_tester') |
| 334 | 398 |
| 335 tests = [copy.deepcopy(t) for t in bot_config.get('tests', [])] | 399 tests = [copy.deepcopy(t) for t in bot_config.get('tests', [])] |
| 336 if override_tests is not None: | 400 if override_tests is not None: |
| 337 tests = override_tests | 401 tests = override_tests |
| 338 | 402 |
| 339 if bot_type not in ['builder', 'builder_tester']: | 403 if bot_type not in ['builder', 'builder_tester']: |
| 340 return [], [] | 404 return [], [] |
| 341 | 405 |
| 342 compile_targets = set(bot_config.get('compile_targets', [])) | 406 compile_targets = set(bot_config.get('compile_targets', [])) |
| 343 tests_including_triggered = list(tests) | 407 tests_including_triggered = list(tests) |
| 344 for _, builder_dict in master_dict.get('builders', {}).iteritems(): | 408 for _, builder_dict in master_dicts[0].get('builders', {}).iteritems(): |
| 345 if builder_dict.get('parent_buildername') == buildername: | 409 if builder_dict.get('parent_buildername') == buildername: |
| 346 tests_including_triggered.extend(builder_dict.get('tests', [])) | 410 tests_including_triggered.extend(builder_dict.get('tests', [])) |
| 347 | 411 |
| 348 if bot_config.get('add_tests_as_compile_targets', True): | 412 if bot_config.get('add_tests_as_compile_targets', True): |
| 349 for t in tests_including_triggered: | 413 for t in tests_including_triggered: |
| 350 compile_targets.update(t.compile_targets(self.m)) | 414 compile_targets.update(t.compile_targets(self.m)) |
| 351 | 415 |
| 352 # Only add crash_service when we have explicit compile targets. | 416 # Only add crash_service when we have explicit compile targets. |
| 353 if (self.m.platform.is_win and | 417 if (self.m.platform.is_win and |
| 354 compile_targets and | 418 compile_targets and |
| 355 'all' not in compile_targets): | 419 'all' not in compile_targets): |
| 356 compile_targets.add('crash_service') | 420 compile_targets.add('crash_service') |
| 357 | 421 |
| 358 # Lastly, add any targets the checkout-side test spec told us to use. | 422 # Lastly, add any targets the checkout-side test spec told us to use. |
| 359 compile_targets.update(test_spec.get(buildername, {}).get( | 423 for i in xrange(len(test_specs)): |
| 360 'additional_compile_targets', [])) | 424 # The first element in the test_specs array always corresponds |
| 425 # to the mastername/buildername. Others come from the additional | |
| 426 # mirrors, which are only used by trybots. | |
| 427 test_spec = test_specs[i] | |
| 428 if i == 0: | |
| 429 current_builder = buildername | |
| 430 else: | |
| 431 current_builder = additional_trybot_mirrors[i-1]['buildername'] | |
| 432 compile_targets.update(test_spec.get(current_builder, {}).get( | |
| 433 'additional_compile_targets', [])) | |
| 361 | 434 |
| 362 return sorted(compile_targets), tests_including_triggered | 435 return sorted(compile_targets), tests_including_triggered |
| 363 | 436 |
| 364 def transient_check(self, update_step, command): | 437 def transient_check(self, update_step, command): |
| 365 """Runs command, checking for transience if this is a try job. | 438 """Runs command, checking for transience if this is a try job. |
| 366 | 439 |
| 367 * command is a function which takes an argument of type (str -> str), | 440 * command is a function which takes an argument of type (str -> str), |
| 368 which is a test name transformation (it adds "with patch" or "without | 441 which is a test name transformation (it adds "with patch" or "without |
| 369 patch") and runs the command. | 442 patch") and runs the command. |
| 370 * update_step is the bot_update step used for deapplying the patch. | 443 * update_step is the bot_update step used for deapplying the patch. |
| 371 """ | 444 """ |
| 372 if self.m.tryserver.is_tryserver: | 445 if self.m.tryserver.is_tryserver: |
| 373 try: | 446 try: |
| 374 command(lambda name: '%s (with patch)' % name) | 447 command(lambda name: '%s (with patch)' % name) |
| 375 except self.m.step.StepFailure: | 448 except self.m.step.StepFailure: |
| 376 self.deapply_patch(update_step) | 449 self.deapply_patch(update_step) |
| 377 command(lambda name: '%s (without patch)' % name) | 450 command(lambda name: '%s (without patch)' % name) |
| 378 raise | 451 raise |
| 379 else: | 452 else: |
| 380 command(lambda name: name) | 453 command(lambda name: name) |
| 381 | 454 |
| 382 | 455 |
| 383 def compile(self, mastername, buildername, update_step, master_dict, | 456 def compile(self, mastername, buildername, update_step, master_dicts, |
| 384 test_spec, mb_mastername=None, mb_buildername=None): | 457 additional_trybot_mirrors, |
| 458 test_specs, mb_mastername=None, mb_buildername=None): | |
| 385 """Runs compile and related steps for given builder.""" | 459 """Runs compile and related steps for given builder.""" |
| 386 compile_targets, tests_including_triggered = \ | 460 compile_targets, tests_including_triggered = \ |
| 387 self.get_compile_targets_and_tests( | 461 self.get_compile_targets_and_tests( |
| 388 mastername, | 462 mastername, |
| 389 buildername, | 463 buildername, |
| 390 master_dict, test_spec) | 464 master_dicts, |
| 465 additional_trybot_mirrors, | |
| 466 test_specs) | |
| 391 self.compile_specific_targets( | 467 self.compile_specific_targets( |
| 392 mastername, buildername, update_step, master_dict, | 468 mastername, buildername, update_step, master_dicts, |
| 393 compile_targets, tests_including_triggered, | 469 compile_targets, tests_including_triggered, |
| 394 mb_mastername=mb_mastername, mb_buildername=mb_buildername) | 470 mb_mastername=mb_mastername, mb_buildername=mb_buildername) |
| 395 | 471 |
| 396 def compile_specific_targets( | 472 def compile_specific_targets( |
| 397 self, mastername, buildername, update_step, master_dict, | 473 self, mastername, buildername, update_step, master_dicts, |
| 398 compile_targets, tests_including_triggered, | 474 compile_targets, tests_including_triggered, |
| 399 mb_mastername=None, mb_buildername=None, override_bot_type=None): | 475 mb_mastername=None, mb_buildername=None, override_bot_type=None): |
| 400 """Runs compile and related steps for given builder. | 476 """Runs compile and related steps for given builder. |
| 401 | 477 |
| 402 Allows finer-grained control about exact compile targets used. | 478 Allows finer-grained control about exact compile targets used. |
| 403 | 479 |
| 404 We don't use the given `mastername` and `buildername` to run MB, because | 480 We don't use the given `mastername` and `buildername` to run MB, because |
| 405 they may be the values of the continuous builder the trybot may be | 481 they may be the values of the continuous builder the trybot may be |
| 406 configured to match; instead we need to use the actual mastername and | 482 configured to match; instead we need to use the actual mastername and |
| 407 buildername we're running on (Default to the "mastername" and | 483 buildername we're running on (Default to the "mastername" and |
| 408 "buildername" in the build properties -- self.m.properties, but could be | 484 "buildername" in the build properties -- self.m.properties, but could be |
| 409 overridden by `mb_mastername` and `mb_buildername`), because it may be | 485 overridden by `mb_mastername` and `mb_buildername`), because it may be |
| 410 configured with different MB settings. | 486 configured with different MB settings. |
| 411 | 487 |
| 412 However, recipes used by Findit for culprit finding may still set | 488 However, recipes used by Findit for culprit finding may still set |
| 413 (mb_mastername, mb_buildername) = (mastername, buildername) to exactly match | 489 (mb_mastername, mb_buildername) = (mastername, buildername) to exactly match |
| 414 a given continuous builder.""" | 490 a given continuous builder.""" |
| 415 | 491 |
| 416 bot_config = master_dict.get('builders', {}).get(buildername) | 492 bot_config = master_dicts[0].get('builders', {}).get(buildername) |
| 417 master_config = master_dict.get('settings', {}) | 493 master_config = master_dicts[0].get('settings', {}) |
| 418 bot_type = override_bot_type or bot_config.get('bot_type', 'builder_tester') | 494 bot_type = override_bot_type or bot_config.get('bot_type', 'builder_tester') |
| 419 | 495 |
| 420 self.m.chromium.cleanup_temp() | 496 self.m.chromium.cleanup_temp() |
| 421 if self.m.chromium.c.TARGET_PLATFORM == 'android': | 497 if self.m.chromium.c.TARGET_PLATFORM == 'android': |
| 422 self.m.chromium_android.clean_local_files() | 498 self.m.chromium_android.clean_local_files() |
| 423 self.m.chromium_android.run_tree_truth() | 499 self.m.chromium_android.run_tree_truth() |
| 424 | 500 |
| 425 if bot_type in ['builder', 'builder_tester']: | 501 if bot_type in ['builder', 'builder_tester']: |
| 426 isolated_targets = [ | 502 isolated_targets = [ |
| 427 t.isolate_target(self.m) | 503 t.isolate_target(self.m) |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 486 build_url=self._build_gs_archive_url( | 562 build_url=self._build_gs_archive_url( |
| 487 mastername, master_config, buildername), | 563 mastername, master_config, buildername), |
| 488 build_revision=build_revision, | 564 build_revision=build_revision, |
| 489 cros_board=self.m.chromium.c.TARGET_CROS_BOARD, | 565 cros_board=self.m.chromium.c.TARGET_CROS_BOARD, |
| 490 # TODO(machenbach): Make asan a configuration switch. | 566 # TODO(machenbach): Make asan a configuration switch. |
| 491 package_dsym_files=( | 567 package_dsym_files=( |
| 492 self.m.chromium.c.gyp_env.GYP_DEFINES.get('asan') and | 568 self.m.chromium.c.gyp_env.GYP_DEFINES.get('asan') and |
| 493 self.m.chromium.c.HOST_PLATFORM == 'mac'), | 569 self.m.chromium.c.HOST_PLATFORM == 'mac'), |
| 494 ) | 570 ) |
| 495 | 571 |
| 496 for loop_buildername, builder_dict in sorted(master_dict.get( | 572 for loop_buildername, builder_dict in sorted(master_dicts[0].get( |
| 497 'builders', {}).iteritems()): | 573 'builders', {}).iteritems()): |
| 498 if builder_dict.get('parent_buildername') == buildername: | 574 if builder_dict.get('parent_buildername') == buildername: |
| 499 trigger_spec = { | 575 trigger_spec = { |
| 500 'builder_name': loop_buildername, | 576 'builder_name': loop_buildername, |
| 501 'properties': {}, | 577 'properties': {}, |
| 502 } | 578 } |
| 503 for name, value in update_step.presentation.properties.iteritems(): | 579 for name, value in update_step.presentation.properties.iteritems(): |
| 504 if name.startswith('got_'): | 580 if name.startswith('got_'): |
| 505 trigger_spec['properties']['parent_' + name] = value | 581 trigger_spec['properties']['parent_' + name] = value |
| 506 self.m.trigger(trigger_spec) | 582 self.m.trigger(trigger_spec) |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 518 if self.m.chromium.c.project_generator.tool == 'mb': | 594 if self.m.chromium.c.project_generator.tool == 'mb': |
| 519 mb_mastername = mb_mastername or self.m.properties['mastername'] | 595 mb_mastername = mb_mastername or self.m.properties['mastername'] |
| 520 mb_buildername = mb_buildername or self.m.properties['buildername'] | 596 mb_buildername = mb_buildername or self.m.properties['buildername'] |
| 521 self.m.chromium.run_mb(mb_mastername, mb_buildername, | 597 self.m.chromium.run_mb(mb_mastername, mb_buildername, |
| 522 isolated_targets=isolated_targets, | 598 isolated_targets=isolated_targets, |
| 523 name='generate_build_files%s' % name_suffix) | 599 name='generate_build_files%s' % name_suffix) |
| 524 | 600 |
| 525 self.m.chromium.compile(compile_targets, name='compile%s' % name_suffix) | 601 self.m.chromium.compile(compile_targets, name='compile%s' % name_suffix) |
| 526 | 602 |
| 527 def download_and_unzip_build(self, mastername, buildername, update_step, | 603 def download_and_unzip_build(self, mastername, buildername, update_step, |
| 528 master_dict, build_archive_url=None, | 604 master_dicts, build_archive_url=None, |
| 529 build_revision=None, override_bot_type=None): | 605 build_revision=None, override_bot_type=None): |
| 530 # We only want to do this for tester bots (i.e. those which do not compile | 606 # We only want to do this for tester bots (i.e. those which do not compile |
| 531 # locally). | 607 # locally). |
| 532 bot_type = override_bot_type or master_dict.get('builders', {}).get( | 608 bot_type = override_bot_type or master_dicts[0].get('builders', {}).get( |
| 533 buildername, {}).get('bot_type') | 609 buildername, {}).get('bot_type') |
| 534 if bot_type != 'tester': | 610 if bot_type != 'tester': |
| 535 return | 611 return |
| 536 | 612 |
| 537 # Protect against hard to debug mismatches between directory names | 613 # Protect against hard to debug mismatches between directory names |
| 538 # used to run tests from and extract build to. We've had several cases | 614 # used to run tests from and extract build to. We've had several cases |
| 539 # where a stale build directory was used on a tester, and the extracted | 615 # where a stale build directory was used on a tester, and the extracted |
| 540 # build was not used at all, leading to confusion why source code changes | 616 # build was not used at all, leading to confusion why source code changes |
| 541 # are not taking effect. | 617 # are not taking effect. |
| 542 # | 618 # |
| 543 # The best way to ensure the old build directory is not used is to | 619 # The best way to ensure the old build directory is not used is to |
| 544 # remove it. | 620 # remove it. |
| 545 self.m.file.rmtree( | 621 self.m.file.rmtree( |
| 546 'build directory', | 622 'build directory', |
| 547 self.m.chromium.c.build_dir.join(self.m.chromium.c.build_config_fs)) | 623 self.m.chromium.c.build_dir.join(self.m.chromium.c.build_config_fs)) |
| 548 | 624 |
| 549 legacy_build_url = None | 625 legacy_build_url = None |
| 550 got_revision = update_step.presentation.properties['got_revision'] | 626 got_revision = update_step.presentation.properties['got_revision'] |
| 551 build_revision = build_revision or self.m.properties.get( | 627 build_revision = build_revision or self.m.properties.get( |
| 552 'parent_got_revision') or got_revision | 628 'parent_got_revision') or got_revision |
| 553 build_archive_url = build_archive_url or self.m.properties.get( | 629 build_archive_url = build_archive_url or self.m.properties.get( |
| 554 'parent_build_archive_url') | 630 'parent_build_archive_url') |
| 555 if build_archive_url is None: | 631 if build_archive_url is None: |
| 556 master_config = master_dict.get('settings', {}) | 632 master_config = master_dicts[0].get('settings', {}) |
| 557 legacy_build_url = self._make_legacy_build_url(master_config, mastername) | 633 legacy_build_url = self._make_legacy_build_url(master_config, mastername) |
| 558 | 634 |
| 559 self.m.archive.download_and_unzip_build( | 635 self.m.archive.download_and_unzip_build( |
| 560 step_name='extract build', | 636 step_name='extract build', |
| 561 target=self.m.chromium.c.build_config_fs, | 637 target=self.m.chromium.c.build_config_fs, |
| 562 build_url=legacy_build_url, | 638 build_url=legacy_build_url, |
| 563 build_revision=build_revision, | 639 build_revision=build_revision, |
| 564 build_archive_url=build_archive_url) | 640 build_archive_url=build_archive_url) |
| 565 | 641 |
| 566 def tests_for_builder(self, mastername, buildername, update_step, master_dict, | 642 def tests_for_builder(self, mastername, buildername, update_step, master_dict, |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 875 result_text = 'MB is enabled for this builder at this revision.' | 951 result_text = 'MB is enabled for this builder at this revision.' |
| 876 log_name = 'Builder MB-ready' | 952 log_name = 'Builder MB-ready' |
| 877 self.m.step.active_result.presentation.logs[log_name] = [result_text] | 953 self.m.step.active_result.presentation.logs[log_name] = [result_text] |
| 878 return False | 954 return False |
| 879 except (self.m.step.StepFailure, KeyError): | 955 except (self.m.step.StepFailure, KeyError): |
| 880 result_text = 'MB is not enabled for this builder at this revision.' | 956 result_text = 'MB is not enabled for this builder at this revision.' |
| 881 log_name = 'Builder NOT MB-ready' | 957 log_name = 'Builder NOT MB-ready' |
| 882 self.m.step.active_result.presentation.logs[log_name] = [result_text] | 958 self.m.step.active_result.presentation.logs[log_name] = [result_text] |
| 883 self.m.step.active_result.presentation.status = self.m.step.WARNING | 959 self.m.step.active_result.presentation.status = self.m.step.WARNING |
| 884 return True | 960 return True |
| OLD | NEW |