| OLD | NEW |
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 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 """API for the bisect recipe module. | 5 """API for the bisect recipe module. |
| 6 | 6 |
| 7 This API is meant to enable the bisect recipe to bisect any chromium-supported | 7 This API is meant to enable the bisect recipe to bisect any chromium-supported |
| 8 platform for any test that can be run via buildbot, perf or otherwise. | 8 platform for any test that can be run via buildbot, perf or otherwise. |
| 9 """ | 9 """ |
| 10 | 10 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 """ | 48 """ |
| 49 self.override_poll_interval = bisect_config_dict.get('poll_sleep') | 49 self.override_poll_interval = bisect_config_dict.get('poll_sleep') |
| 50 revision_class = self._get_revision_class(bisect_config_dict['test_type']) | 50 revision_class = self._get_revision_class(bisect_config_dict['test_type']) |
| 51 return bisector.Bisector(self, bisect_config_dict, revision_class, | 51 return bisector.Bisector(self, bisect_config_dict, revision_class, |
| 52 init_revisions=not dummy_mode) | 52 init_revisions=not dummy_mode) |
| 53 | 53 |
| 54 def _get_revision_class(self, test_type): | 54 def _get_revision_class(self, test_type): |
| 55 """Gets the particular subclass of Revision needed for the test type.""" | 55 """Gets the particular subclass of Revision needed for the test type.""" |
| 56 if test_type == 'perf': | 56 if test_type == 'perf': |
| 57 return perf_revision_state.PerfRevisionState | 57 return perf_revision_state.PerfRevisionState |
| 58 else: #pragma: no cover | 58 else: # pragma: no cover |
| 59 raise NotImplementedError() | 59 raise NotImplementedError() |
| 60 | 60 |
| 61 def gsutil_file_exists(self, path): | 61 def gsutil_file_exists(self, path): |
| 62 """Returns True if a file exists at the given GS path.""" | 62 """Returns True if a file exists at the given GS path.""" |
| 63 try: | 63 try: |
| 64 self.m.gsutil(['ls', path]) | 64 self.m.gsutil(['ls', path]) |
| 65 except self.m.step.StepFailure: #pragma: no cover | 65 except self.m.step.StepFailure: # pragma: no cover |
| 66 return False | 66 return False |
| 67 return True | 67 return True |
| 68 | 68 |
| 69 def query_revision_info(self, revision, git_checkout_dir=None): | 69 def query_revision_info(self, revision, git_checkout_dir=None): |
| 70 """Gathers information on a particular revision, such as author's name, | 70 """Gathers information on a particular revision, such as author's name, |
| 71 email, subject, and date. | 71 email, subject, and date. |
| 72 | 72 |
| 73 Args: | 73 Args: |
| 74 revision (str): Revision you want to gather information on; a git | 74 revision (str): Revision you want to gather information on; a git |
| 75 commit hash. | 75 commit hash. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 92 separator = 'S3P4R4T0R' | 92 separator = 'S3P4R4T0R' |
| 93 formats = separator.join(['%aN', '%aE', '%s', '%cD', '%b']) | 93 formats = separator.join(['%aN', '%aE', '%s', '%cD', '%b']) |
| 94 targets = ['author', 'email', 'subject', 'date', 'body'] | 94 targets = ['author', 'email', 'subject', 'date', 'body'] |
| 95 command_parts = ['log', '--format=%s' % formats, '-1', revision] | 95 command_parts = ['log', '--format=%s' % formats, '-1', revision] |
| 96 | 96 |
| 97 step_result = self.m.git(*command_parts, | 97 step_result = self.m.git(*command_parts, |
| 98 name='Reading culprit cl information.', | 98 name='Reading culprit cl information.', |
| 99 cwd=git_checkout_dir, | 99 cwd=git_checkout_dir, |
| 100 stdout=self.m.raw_io.output()) | 100 stdout=self.m.raw_io.output()) |
| 101 return dict(zip(targets, step_result.stdout.split(separator))) | 101 return dict(zip(targets, step_result.stdout.split(separator))) |
| OLD | NEW |