| 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 itertools | 7 import itertools |
| 8 import json | 8 import json |
| 9 | 9 |
| 10 from recipe_engine.types import freeze | 10 from recipe_engine.types import freeze |
| (...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 687 if deapply_patch: | 687 if deapply_patch: |
| 688 self.m.test_utils.determine_new_failures(api, tests, deapply_patch_fn) | 688 self.m.test_utils.determine_new_failures(api, tests, deapply_patch_fn) |
| 689 else: | 689 else: |
| 690 failing_tests = self.m.test_utils.run_tests_with_patch(api, tests) | 690 failing_tests = self.m.test_utils.run_tests_with_patch(api, tests) |
| 691 if failing_tests: | 691 if failing_tests: |
| 692 self.m.python.failing_step( | 692 self.m.python.failing_step( |
| 693 'test results', | 693 'test results', |
| 694 'TESTS FAILED; retries without patch disabled (%s)' | 694 'TESTS FAILED; retries without patch disabled (%s)' |
| 695 % deapply_patch_reason) | 695 % deapply_patch_reason) |
| 696 | 696 |
| 697 def get_files_affected_by_patch(self, relative_to='src/'): | 697 def get_files_affected_by_patch(self, relative_to='src/', cwd=None): |
| 698 """Returns list of POSIX paths of files affected by patch for "analyze". | 698 """Returns list of POSIX paths of files affected by patch for "analyze". |
| 699 | 699 |
| 700 Paths are relative to `relative_to` which for analyze should be 'src/'. | 700 Paths are relative to `relative_to` which for analyze should be 'src/'. |
| 701 """ | 701 """ |
| 702 patch_root = self.m.gclient.calculate_patch_root( | 702 patch_root = self.m.gclient.calculate_patch_root( |
| 703 self.m.properties.get('patch_project')) | 703 self.m.properties.get('patch_project')) |
| 704 cwd = self._working_dir.join(patch_root) if self._working_dir else None | 704 if not cwd: |
| 705 cwd = self._working_dir.join(patch_root) if self._working_dir else None |
| 705 files = self.m.tryserver.get_files_affected_by_patch(patch_root, cwd=cwd) | 706 files = self.m.tryserver.get_files_affected_by_patch(patch_root, cwd=cwd) |
| 706 for i, path in enumerate(files): | 707 for i, path in enumerate(files): |
| 707 path = str(path) | 708 path = str(path) |
| 708 assert path.startswith(relative_to) | 709 assert path.startswith(relative_to) |
| 709 files[i] = path[len(relative_to):] | 710 files[i] = path[len(relative_to):] |
| 710 return files | 711 return files |
| 711 | 712 |
| 712 # TODO(phajdan.jr): fix callers and remove chromium_tests.configure_swarming. | 713 # TODO(phajdan.jr): fix callers and remove chromium_tests.configure_swarming. |
| 713 def configure_swarming(self, project_name, precommit, mastername=None): | 714 def configure_swarming(self, project_name, precommit, mastername=None): |
| 714 return self.m.chromium_swarming.configure_swarming( # pragma: no cover | 715 return self.m.chromium_swarming.configure_swarming( # pragma: no cover |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 817 | 818 |
| 818 if not tests: | 819 if not tests: |
| 819 return | 820 return |
| 820 | 821 |
| 821 api.chromium_swarming.configure_swarming( | 822 api.chromium_swarming.configure_swarming( |
| 822 'chromium', precommit=False, mastername=mastername) | 823 'chromium', precommit=False, mastername=mastername) |
| 823 test_runner = api.chromium_tests.create_test_runner( | 824 test_runner = api.chromium_tests.create_test_runner( |
| 824 api, tests, serialize_tests=bot_config.get('serialize_tests')) | 825 api, tests, serialize_tests=bot_config.get('serialize_tests')) |
| 825 with api.chromium_tests.wrap_chromium_tests(bot_config, tests): | 826 with api.chromium_tests.wrap_chromium_tests(bot_config, tests): |
| 826 test_runner() | 827 test_runner() |
| OLD | NEW |