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 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
670 'TESTS FAILED; retries without patch disabled (%s)' | 670 'TESTS FAILED; retries without patch disabled (%s)' |
671 % deapply_patch_reason) | 671 % deapply_patch_reason) |
672 | 672 |
673 def get_files_affected_by_patch(self, relative_to='src/'): | 673 def get_files_affected_by_patch(self, relative_to='src/'): |
674 """Returns list of POSIX paths of files affected by patch for "analyze". | 674 """Returns list of POSIX paths of files affected by patch for "analyze". |
675 | 675 |
676 Paths are relative to `relative_to` which for analyze should be 'src/'. | 676 Paths are relative to `relative_to` which for analyze should be 'src/'. |
677 """ | 677 """ |
678 patch_root = self.m.gclient.calculate_patch_root( | 678 patch_root = self.m.gclient.calculate_patch_root( |
679 self.m.properties.get('patch_project')) | 679 self.m.properties.get('patch_project')) |
680 affected_files = self.m.tryserver.get_files_affected_by_patch(patch_root) | 680 cwd = self._working_dir.join(patch_root) if self._working_dir else None |
681 for i, path in enumerate(affected_files): | 681 files = self.m.tryserver.get_files_affected_by_patch(patch_root, cwd=cwd) |
| 682 for i, path in enumerate(files): |
682 path = str(path) | 683 path = str(path) |
683 assert path.startswith(relative_to) | 684 assert path.startswith(relative_to) |
684 affected_files[i] = path[len(relative_to):] | 685 files[i] = path[len(relative_to):] |
685 return affected_files | 686 return files |
686 | 687 |
687 def analyze(self, affected_files, test_targets, additional_compile_targets, | 688 def analyze(self, affected_files, test_targets, additional_compile_targets, |
688 config_file_name, mb_mastername=None, mb_buildername=None, | 689 config_file_name, mb_mastername=None, mb_buildername=None, |
689 additional_names=None): | 690 additional_names=None): |
690 """Runs "analyze" step to determine targets affected by the patch. | 691 """Runs "analyze" step to determine targets affected by the patch. |
691 | 692 |
692 Returns a tuple of: | 693 Returns a tuple of: |
693 - list of targets that are needed to run tests (see filter recipe module) | 694 - list of targets that are needed to run tests (see filter recipe module) |
694 - list of targets that need to be compiled (see filter recipe module)""" | 695 - list of targets that need to be compiled (see filter recipe module)""" |
695 | 696 |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
838 def get_compile_targets_for_scripts(self): | 839 def get_compile_targets_for_scripts(self): |
839 return self.m.python( | 840 return self.m.python( |
840 name='get compile targets for scripts', | 841 name='get compile targets for scripts', |
841 script=self.m.path['checkout'].join( | 842 script=self.m.path['checkout'].join( |
842 'testing', 'scripts', 'get_compile_targets.py'), | 843 'testing', 'scripts', 'get_compile_targets.py'), |
843 args=[ | 844 args=[ |
844 '--output', self.m.json.output(), | 845 '--output', self.m.json.output(), |
845 '--', | 846 '--', |
846 ] + self.get_common_args_for_scripts(), | 847 ] + self.get_common_args_for_scripts(), |
847 step_test_data=lambda: self.m.json.test_api.output({})) | 848 step_test_data=lambda: self.m.json.test_api.output({})) |
OLD | NEW |