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 """An interface for holding state and result of revisions in a bisect job. | 5 """An interface for holding state and result of revisions in a bisect job. |
6 | 6 |
7 When implementing support for tests other than perf, one should extend this | 7 When implementing support for tests other than perf, one should extend this |
8 class so that the bisect module and recipe can use it. | 8 class so that the bisect module and recipe can use it. |
9 | 9 |
10 See perf_revision_state for an example. | 10 See perf_revision_state for an example. |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 self._do_test() | 147 self._do_test() |
148 self.status = RevisionState.TESTING | 148 self.status = RevisionState.TESTING |
149 | 149 |
150 def deps_change(self): | 150 def deps_change(self): |
151 """Uses `git show` to see if a given commit contains a DEPS change.""" | 151 """Uses `git show` to see if a given commit contains a DEPS change.""" |
152 # Avoid checking DEPS changes for dependency repo revisions. | 152 # Avoid checking DEPS changes for dependency repo revisions. |
153 # crbug.com/580681 | 153 # crbug.com/580681 |
154 if self.needs_patch: # pragma: no cover | 154 if self.needs_patch: # pragma: no cover |
155 return False | 155 return False |
156 api = self.bisector.api | 156 api = self.bisector.api |
157 cwd = api.m.infra_paths['slave_build'].join( | 157 cwd = api.m.path['slave_build'].join( |
158 depot_config.DEPOT_DEPS_NAME[self.depot_name]['src']) | 158 depot_config.DEPOT_DEPS_NAME[self.depot_name]['src']) |
159 name = 'Checking DEPS for ' + self.commit_hash | 159 name = 'Checking DEPS for ' + self.commit_hash |
160 step_result = api.m.git( | 160 step_result = api.m.git( |
161 'show', '--name-only', '--pretty=format:', | 161 'show', '--name-only', '--pretty=format:', |
162 self.commit_hash, cwd=cwd, stdout=api.m.raw_io.output(), name=name) | 162 self.commit_hash, cwd=cwd, stdout=api.m.raw_io.output(), name=name) |
163 if self.bisector.dummy_builds and not self.commit_hash.startswith('dcdc'): | 163 if self.bisector.dummy_builds and not self.commit_hash.startswith('dcdc'): |
164 return False | 164 return False |
165 if 'DEPS' in step_result.stdout.splitlines(): # pragma: no cover | 165 if 'DEPS' in step_result.stdout.splitlines(): # pragma: no cover |
166 return True | 166 return True |
167 return False # pragma: no cover | 167 return False # pragma: no cover |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 if (self.bisector.good_rev != self and self.bisector.bad_rev != self and | 377 if (self.bisector.good_rev != self and self.bisector.bad_rev != self and |
378 check_revision_goodness): | 378 check_revision_goodness): |
379 if self._check_revision_good(): | 379 if self._check_revision_good(): |
380 self.good = True | 380 self.good = True |
381 else: | 381 else: |
382 self.bad = True | 382 self.bad = True |
383 | 383 |
384 def _write_deps_patch_file(self, build_name): | 384 def _write_deps_patch_file(self, build_name): |
385 """Saves the DEPS patch in a temp location and returns the file path.""" | 385 """Saves the DEPS patch in a temp location and returns the file path.""" |
386 api = self.bisector.api | 386 api = self.bisector.api |
387 file_name = str(api.m.path['tmp'].join(build_name + '.diff')) | 387 file_name = str(api.m.path['tmp_base'].join(build_name + '.diff')) |
388 api.m.file.write('Saving diff patch for ' + self.commit_hash, | 388 api.m.file.write('Saving diff patch for ' + self.commit_hash, |
389 file_name, self.deps_patch + self.deps_sha_patch) | 389 file_name, self.deps_patch + self.deps_sha_patch) |
390 return file_name | 390 return file_name |
391 | 391 |
392 def _request_build(self): | 392 def _request_build(self): |
393 """Posts a request to buildbot to build this revision and archive it.""" | 393 """Posts a request to buildbot to build this revision and archive it.""" |
394 # TODO: Rewrite using the trigger module. | 394 # TODO: Rewrite using the trigger module. |
395 api = self.bisector.api | 395 api = self.bisector.api |
396 bot_name = self.bisector.get_builder_bot_for_this_platform() | 396 bot_name = self.bisector.get_builder_bot_for_this_platform() |
397 if self.bisector.bisect_config.get('dummy_job_names'): | 397 if self.bisector.bisect_config.get('dummy_job_names'): |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
602 else: | 602 else: |
603 next_revision_to_test.retest() | 603 next_revision_to_test.retest() |
604 | 604 |
605 def __repr__(self): | 605 def __repr__(self): |
606 if self.overall_return_code is not None: | 606 if self.overall_return_code is not None: |
607 return ('RevisionState(rev=%s, values=%r, overall_return_code=%r, ' | 607 return ('RevisionState(rev=%s, values=%r, overall_return_code=%r, ' |
608 'std_dev=%r)') % (self.revision_string(), self.values, | 608 'std_dev=%r)') % (self.revision_string(), self.values, |
609 self.overall_return_code, self.std_dev) | 609 self.overall_return_code, self.std_dev) |
610 return ('RevisionState(rev=%s, values=%r, mean_value=%r, std_dev=%r)' % ( | 610 return ('RevisionState(rev=%s, values=%r, mean_value=%r, std_dev=%r)' % ( |
611 self.revision_string(), self.values, self.mean_value, self.std_dev)) | 611 self.revision_string(), self.values, self.mean_value, self.std_dev)) |
OLD | NEW |