| 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 contextlib | 5 import contextlib |
| 6 import copy | 6 import copy |
| 7 import json | 7 import json |
| 8 | 8 |
| 9 from infra.libs.infra_types import freeze, thaw | 9 from infra.libs.infra_types import freeze, thaw |
| 10 from recipe_engine import recipe_api | 10 from recipe_engine import recipe_api |
| (...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 501 raise | 501 raise |
| 502 if has_failing_swarming_tests: | 502 if has_failing_swarming_tests: |
| 503 self.m.isolate.isolate_tests(self.m.chromium.output_dir, | 503 self.m.isolate.isolate_tests(self.m.chromium.output_dir, |
| 504 verbose=True) | 504 verbose=True) |
| 505 | 505 |
| 506 with self.wrap_chromium_tests(mastername): | 506 with self.wrap_chromium_tests(mastername): |
| 507 return self.m.test_utils.determine_new_failures(api, tests, | 507 return self.m.test_utils.determine_new_failures(api, tests, |
| 508 deapply_patch_fn) | 508 deapply_patch_fn) |
| 509 | 509 |
| 510 def analyze(self, affected_files, exes, compile_targets, config_file_name, | 510 def analyze(self, affected_files, exes, compile_targets, config_file_name, |
| 511 additional_names=None): | 511 additional_names=None, legacy_postprocess=True): |
| 512 """Runs "analyze" step to determine targets affected by the patch. | 512 """Runs "analyze" step to determine targets affected by the patch. |
| 513 | 513 |
| 514 Returns a tuple of: | 514 Returns a tuple of: |
| 515 - boolean, indicating whether patch requires compile | 515 - boolean, indicating whether patch requires compile |
| 516 - list of matching exes (see filter recipe module) | 516 - list of matching exes (see filter recipe module) |
| 517 - list of targets that need to be compiled (see filter recipe module)""" | 517 - list of targets that need to be compiled (see filter recipe module)""" |
| 518 | 518 |
| 519 original_exes = exes[:] | 519 original_exes = exes[:] |
| 520 original_compile_targets = compile_targets[:] | 520 original_compile_targets = compile_targets[:] |
| 521 | 521 |
| 522 if additional_names is None: | 522 if additional_names is None: |
| 523 additional_names = ['chromium'] | 523 additional_names = ['chromium'] |
| 524 | 524 |
| 525 use_mb = (self.m.chromium.c.project_generator.tool == 'mb') | 525 use_mb = (self.m.chromium.c.project_generator.tool == 'mb') |
| 526 build_output_dir = '//out/%s' % self.m.chromium.c.build_config_fs | 526 build_output_dir = '//out/%s' % self.m.chromium.c.build_config_fs |
| 527 self.m.filter.does_patch_require_compile( | 527 self.m.filter.does_patch_require_compile( |
| 528 affected_files, | 528 affected_files, |
| 529 exes=exes, | 529 exes=exes, |
| 530 compile_targets=compile_targets, | 530 compile_targets=compile_targets, |
| 531 additional_names=additional_names, | 531 additional_names=additional_names, |
| 532 config_file_name=config_file_name, | 532 config_file_name=config_file_name, |
| 533 use_mb=use_mb, | 533 use_mb=use_mb, |
| 534 build_output_dir=build_output_dir, | 534 build_output_dir=build_output_dir, |
| 535 cros_board=self.m.chromium.c.TARGET_CROS_BOARD) | 535 cros_board=self.m.chromium.c.TARGET_CROS_BOARD) |
| 536 | 536 |
| 537 if not self.m.filter.result: | 537 if not self.m.filter.result: |
| 538 # Patch does not require compile. | 538 # Patch does not require compile. |
| 539 return False, [], [] | 539 return False, [], [] |
| 540 | 540 |
| 541 if 'all' in compile_targets: | 541 if legacy_postprocess: |
| 542 if 'all' in compile_targets: |
| 543 compile_targets = self.m.filter.compile_targets |
| 544 else: |
| 545 compile_targets = list(set(compile_targets) & |
| 546 set(self.m.filter.compile_targets)) |
| 547 # Always add |matching_exes|. They will be covered by |compile_targets|, |
| 548 # but adding |matching_exes| makes determing if conditional tests are |
| 549 # necessary easier. For example, if we didn't do this we could end up |
| 550 # with chrome_run as a compile_target and not chrome (since chrome_run |
| 551 # depends upon chrome). This results in not picking up |
| 552 # NaclIntegrationTest as it depends upon chrome not chrome_run. |
| 553 compile_targets = list(set(self.m.filter.matching_exes + compile_targets)) |
| 554 else: |
| 542 compile_targets = self.m.filter.compile_targets | 555 compile_targets = self.m.filter.compile_targets |
| 543 else: | |
| 544 compile_targets = list(set(compile_targets) & | |
| 545 set(self.m.filter.compile_targets)) | |
| 546 # Always add |matching_exes|. They will be covered by |compile_targets|, | |
| 547 # but adding |matching_exes| makes determing if conditional tests are | |
| 548 # necessary easier. For example, if we didn't do this we could end up | |
| 549 # with chrome_run as a compile_target and not chrome (since chrome_run | |
| 550 # depends upon chrome). This results in not picking up | |
| 551 # NaclIntegrationTest as it depends upon chrome not chrome_run. | |
| 552 compile_targets = list(set(self.m.filter.matching_exes + compile_targets)) | |
| 553 | 556 |
| 554 # Add crash_service to compile_targets. This is done after filtering compile | 557 # Add crash_service to compile_targets. This is done after filtering compile |
| 555 # targets out because crash_service should always be there on windows. | 558 # targets out because crash_service should always be there on windows. |
| 556 # TODO(akuegel): Need to solve this in a better way. crbug.com/478053 | 559 # TODO(akuegel): Need to solve this in a better way. crbug.com/478053 |
| 557 if (self.m.platform.is_win and compile_targets and | 560 if (self.m.platform.is_win and compile_targets and |
| 558 'crash_service' not in compile_targets and not use_mb): | 561 'crash_service' not in compile_targets and not use_mb): |
| 559 compile_targets.extend(['crash_service']) | 562 compile_targets.extend(['crash_service']) |
| 560 | 563 |
| 561 # Emit more detailed output useful for debugging. | 564 # Emit more detailed output useful for debugging. |
| 562 analyze_details = { | 565 analyze_details = { |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 678 def get_compile_targets_for_scripts(self): | 681 def get_compile_targets_for_scripts(self): |
| 679 return self.m.python( | 682 return self.m.python( |
| 680 name='get compile targets for scripts', | 683 name='get compile targets for scripts', |
| 681 script=self.m.path['checkout'].join( | 684 script=self.m.path['checkout'].join( |
| 682 'testing', 'scripts', 'get_compile_targets.py'), | 685 'testing', 'scripts', 'get_compile_targets.py'), |
| 683 args=[ | 686 args=[ |
| 684 '--output', self.m.json.output(), | 687 '--output', self.m.json.output(), |
| 685 '--', | 688 '--', |
| 686 ] + self.get_common_args_for_scripts(), | 689 ] + self.get_common_args_for_scripts(), |
| 687 step_test_data=lambda: self.m.json.test_api.output({})) | 690 step_test_data=lambda: self.m.json.test_api.output({})) |
| OLD | NEW |