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 collections | 5 import collections |
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 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
645 if deapply_patch: | 645 if deapply_patch: |
646 self.m.test_utils.determine_new_failures(api, tests, deapply_patch_fn) | 646 self.m.test_utils.determine_new_failures(api, tests, deapply_patch_fn) |
647 else: | 647 else: |
648 failing_tests = self.m.test_utils.run_tests_with_patch(api, tests) | 648 failing_tests = self.m.test_utils.run_tests_with_patch(api, tests) |
649 if failing_tests: | 649 if failing_tests: |
650 self.m.python.failing_step( | 650 self.m.python.failing_step( |
651 'test results', | 651 'test results', |
652 'TESTS FAILED; retries without patch disabled (%s)' | 652 'TESTS FAILED; retries without patch disabled (%s)' |
653 % deapply_patch_reason) | 653 % deapply_patch_reason) |
654 | 654 |
| 655 def get_files_affected_by_patch(self, relative_to='src/'): |
| 656 """Returns list of POSIX paths of files affected by patch for "analyze". |
| 657 |
| 658 Paths are relative to `relative_to` which for analyze should be 'src/'. |
| 659 """ |
| 660 patch_root = self.m.gclient.calculate_patch_root( |
| 661 self.m.properties.get('patch_project')) |
| 662 affected_files = self.m.tryserver.get_files_affected_by_patch(patch_root) |
| 663 for i, path in enumerate(affected_files): |
| 664 path = str(path) |
| 665 assert path.startswith(relative_to) |
| 666 affected_files[i] = path[len(relative_to):] |
| 667 return affected_files |
| 668 |
655 def analyze(self, affected_files, test_targets, additional_compile_targets, | 669 def analyze(self, affected_files, test_targets, additional_compile_targets, |
656 config_file_name, mb_mastername=None, mb_buildername=None, | 670 config_file_name, mb_mastername=None, mb_buildername=None, |
657 additional_names=None): | 671 additional_names=None): |
658 """Runs "analyze" step to determine targets affected by the patch. | 672 """Runs "analyze" step to determine targets affected by the patch. |
659 | 673 |
660 Returns a tuple of: | 674 Returns a tuple of: |
661 - list of targets that are needed to run tests (see filter recipe module) | 675 - list of targets that are needed to run tests (see filter recipe module) |
662 - list of targets that need to be compiled (see filter recipe module)""" | 676 - list of targets that need to be compiled (see filter recipe module)""" |
663 | 677 |
664 if additional_names is None: | 678 if additional_names is None: |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
806 def get_compile_targets_for_scripts(self): | 820 def get_compile_targets_for_scripts(self): |
807 return self.m.python( | 821 return self.m.python( |
808 name='get compile targets for scripts', | 822 name='get compile targets for scripts', |
809 script=self.m.path['checkout'].join( | 823 script=self.m.path['checkout'].join( |
810 'testing', 'scripts', 'get_compile_targets.py'), | 824 'testing', 'scripts', 'get_compile_targets.py'), |
811 args=[ | 825 args=[ |
812 '--output', self.m.json.output(), | 826 '--output', self.m.json.output(), |
813 '--', | 827 '--', |
814 ] + self.get_common_args_for_scripts(), | 828 ] + self.get_common_args_for_scripts(), |
815 step_test_data=lambda: self.m.json.test_api.output({})) | 829 step_test_data=lambda: self.m.json.test_api.output({})) |
OLD | NEW |