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 contextlib | 6 import contextlib |
| 7 import copy | 7 import copy |
| 8 import itertools | 8 import itertools |
| 9 import json | 9 import json |
| 10 | 10 |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 291 if t.abort_on_failure: | 291 if t.abort_on_failure: |
| 292 raise | 292 raise |
| 293 | 293 |
| 294 if failed_tests: | 294 if failed_tests: |
| 295 failed_tests_names = [t.name for t in failed_tests] | 295 failed_tests_names = [t.name for t in failed_tests] |
| 296 raise self.m.step.StepFailure( | 296 raise self.m.step.StepFailure( |
| 297 '%d tests failed: %r' % (len(failed_tests), failed_tests_names)) | 297 '%d tests failed: %r' % (len(failed_tests), failed_tests_names)) |
| 298 | 298 |
| 299 return test_runner | 299 return test_runner |
| 300 | 300 |
| 301 def get_compile_targets_and_tests( | 301 def get_test_targets_compile_targets_and_tests( |
| 302 self, mastername, buildername, master_dict, test_spec, | 302 self, mastername, buildername, master_dict, test_spec, |
| 303 override_bot_type=None, override_tests=None): | 303 override_bot_type=None, override_tests=None): |
| 304 """Returns a tuple: list of compile targets and list of tests. | 304 """Returns a tuple: test target list, compile target list, and test list. |
| 305 | 305 |
| 306 The list of tests includes ones on the triggered testers.""" | 306 The test list includes ones on the triggered testers.""" |
| 307 | 307 |
| 308 bot_config = master_dict.get('builders', {}).get(buildername) | 308 bot_config = master_dict.get('builders', {}).get(buildername) |
| 309 bot_type = override_bot_type or bot_config.get('bot_type', 'builder_tester') | 309 bot_type = override_bot_type or bot_config.get('bot_type', 'builder_tester') |
| 310 | 310 |
| 311 if bot_type not in ['builder', 'builder_tester']: | |
| 312 return [], [], [] | |
| 313 | |
| 311 tests = bot_config.get('tests', []) | 314 tests = bot_config.get('tests', []) |
| 312 if override_tests is not None: | 315 if override_tests is not None: |
| 313 tests = override_tests | 316 tests = override_tests |
| 314 | 317 |
| 315 if bot_type not in ['builder', 'builder_tester']: | |
| 316 return [], [] | |
| 317 | |
| 318 compile_targets = set(bot_config.get('compile_targets', [])) | |
| 319 tests_including_triggered = list(tests) | 318 tests_including_triggered = list(tests) |
| 320 for _, builder_dict in master_dict.get('builders', {}).iteritems(): | 319 for _, builder_dict in master_dict.get('builders', {}).iteritems(): |
| 321 if builder_dict.get('parent_buildername') == buildername: | 320 if builder_dict.get('parent_buildername') == buildername: |
| 322 tests_including_triggered.extend(builder_dict.get('tests', [])) | 321 tests_including_triggered.extend(builder_dict.get('tests', [])) |
| 323 | 322 |
| 323 test_compile_targets = set() | |
| 324 if bot_config.get('add_tests_as_compile_targets', True): | 324 if bot_config.get('add_tests_as_compile_targets', True): |
| 325 for t in tests_including_triggered: | 325 for t in tests_including_triggered: |
| 326 compile_targets.update(t.compile_targets(self.m)) | 326 test_compile_targets.update(t.compile_targets(self.m)) |
| 327 | |
| 328 compile_targets = set(bot_config.get('compile_targets', [])) | |
| 329 compile_targets.update(test_compile_targets) | |
| 327 | 330 |
| 328 # Only add crash_service when we have explicit compile targets. | 331 # Only add crash_service when we have explicit compile targets. |
| 329 if (self.m.platform.is_win and | 332 if (self.m.platform.is_win and |
| 330 compile_targets and | 333 compile_targets and |
| 331 'all' not in compile_targets): | 334 'all' not in compile_targets): |
| 332 compile_targets.add('crash_service') | 335 compile_targets.add('crash_service') |
| 333 | 336 |
| 334 # Lastly, add any targets the checkout-side test spec told us to use. | 337 # Lastly, add any targets the checkout-side test spec told us to use. |
| 335 compile_targets.update(test_spec.get(buildername, {}).get( | 338 compile_targets.update(test_spec.get(buildername, {}).get( |
| 336 'additional_compile_targets', [])) | 339 'additional_compile_targets', [])) |
| 337 | 340 |
| 338 return sorted(compile_targets), tests_including_triggered | 341 return (sorted(test_compile_targets), sorted(compile_targets), |
|
Paweł Hajdan Jr.
2015/11/24 13:20:41
Why do we need this change?
stgao
2015/11/24 23:19:19
Was trying to match to new api filter.does_patch_r
| |
| 342 tests_including_triggered) | |
| 343 | |
| 344 def get_compile_targets_and_tests( | |
| 345 self, mastername, buildername, master_dict, test_spec, | |
| 346 override_bot_type=None, override_tests=None): | |
| 347 """Returns a tuple: list of compile targets and list of tests. | |
| 348 | |
| 349 The list of tests includes ones on the triggered testers.""" | |
| 350 _, compile_targets, tests_including_triggered = \ | |
| 351 self.get_test_targets_compile_targets_and_tests( | |
| 352 mastername, buildername, master_dict, test_spec, | |
| 353 override_bot_type=override_bot_type, override_tests=override_tests) | |
| 354 return compile_targets, tests_including_triggered | |
| 339 | 355 |
| 340 def transient_check(self, update_step, command): | 356 def transient_check(self, update_step, command): |
| 341 """Runs command, checking for transience if this is a try job. | 357 """Runs command, checking for transience if this is a try job. |
| 342 | 358 |
| 343 * command is a function which takes an argument of type (str -> str), | 359 * command is a function which takes an argument of type (str -> str), |
| 344 which is a test name transformation (it adds "with patch" or "without | 360 which is a test name transformation (it adds "with patch" or "without |
| 345 patch") and runs the command. | 361 patch") and runs the command. |
| 346 * update_step is the bot_update step used for deapplying the patch. | 362 * update_step is the bot_update step used for deapplying the patch. |
| 347 """ | 363 """ |
| 348 if self.m.tryserver.is_tryserver: | 364 if self.m.tryserver.is_tryserver: |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 467 mode='dev' | 483 mode='dev' |
| 468 ) | 484 ) |
| 469 | 485 |
| 470 def run_mb_and_compile(self, compile_targets, isolated_targets, name_suffix): | 486 def run_mb_and_compile(self, compile_targets, isolated_targets, name_suffix): |
| 471 if self.m.chromium.c.project_generator.tool == 'mb': | 487 if self.m.chromium.c.project_generator.tool == 'mb': |
| 472 # We don't use the mastername and buildername passed in, because | 488 # We don't use the mastername and buildername passed in, because |
| 473 # those may be the values of the continuous builder the trybot may | 489 # those may be the values of the continuous builder the trybot may |
| 474 # be configured to match; we need to use the actual mastername | 490 # be configured to match; we need to use the actual mastername |
| 475 # and buildername we're running on, because it may be configured | 491 # and buildername we're running on, because it may be configured |
| 476 # with different MB settings. | 492 # with different MB settings. |
| 477 real_mastername = self.m.properties['mastername'] | 493 # However, use target_mastername and target_buildername instead if they |
| 478 real_buildername = self.m.properties['buildername'] | 494 # are available in the build properties. This gives a recipe running on a |
| 479 self.m.chromium.run_mb(real_mastername, real_buildername, | 495 # trybot the flexibility to run MB in exactly the same configuration as |
| 496 # the continuous builder it tries to match. | |
| 497 target_mastername = (self.m.properties.get('target_mastername') or | |
|
Paweł Hajdan Jr.
2015/11/24 13:20:41
Let's make this explicit then, i.e. have run_mb_an
Dirk Pranke
2015/11/24 16:35:00
I actually told stgao to do things this way; becau
stgao
2015/11/24 23:19:19
Done.
| |
| 498 self.m.properties['mastername']) | |
| 499 target_buildername = (self.m.properties.get('target_buildername') or | |
| 500 self.m.properties['buildername']) | |
| 501 self.m.chromium.run_mb(target_mastername, target_buildername, | |
| 480 isolated_targets=isolated_targets, | 502 isolated_targets=isolated_targets, |
| 481 name='generate_build_files%s' % name_suffix) | 503 name='generate_build_files%s' % name_suffix) |
| 482 | 504 |
| 483 self.m.chromium.compile(compile_targets, name='compile%s' % name_suffix) | 505 self.m.chromium.compile(compile_targets, name='compile%s' % name_suffix) |
| 484 | 506 |
| 485 def tests_for_builder(self, mastername, buildername, update_step, master_dict, | 507 def tests_for_builder(self, mastername, buildername, update_step, master_dict, |
| 486 override_bot_type=None): | 508 override_bot_type=None): |
| 487 got_revision = update_step.presentation.properties['got_revision'] | 509 got_revision = update_step.presentation.properties['got_revision'] |
| 488 | 510 |
| 489 bot_config = master_dict.get('builders', {}).get(buildername) | 511 bot_config = master_dict.get('builders', {}).get(buildername) |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 814 result_text = 'MB is enabled for this builder at this revision.' | 836 result_text = 'MB is enabled for this builder at this revision.' |
| 815 log_name = 'Builder MB-ready' | 837 log_name = 'Builder MB-ready' |
| 816 self.m.step.active_result.presentation.logs[log_name] = [result_text] | 838 self.m.step.active_result.presentation.logs[log_name] = [result_text] |
| 817 return False | 839 return False |
| 818 except (self.m.step.StepFailure, KeyError): | 840 except (self.m.step.StepFailure, KeyError): |
| 819 result_text = 'MB is not enabled for this builder at this revision.' | 841 result_text = 'MB is not enabled for this builder at this revision.' |
| 820 log_name = 'Builder NOT MB-ready' | 842 log_name = 'Builder NOT MB-ready' |
| 821 self.m.step.active_result.presentation.logs[log_name] = [result_text] | 843 self.m.step.active_result.presentation.logs[log_name] = [result_text] |
| 822 self.m.step.active_result.presentation.status = self.m.step.WARNING | 844 self.m.step.active_result.presentation.status = self.m.step.WARNING |
| 823 return True | 845 return True |
| OLD | NEW |