| 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 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 532 either direction, this is expected to timeout eventually. This scenario | 532 either direction, this is expected to timeout eventually. This scenario |
| 533 should be rather rare, since it is expected that the fkbr and lkgr are | 533 should be rather rare, since it is expected that the fkbr and lkgr are |
| 534 significantly different as a precondition. | 534 significantly different as a precondition. |
| 535 | 535 |
| 536 Returns: | 536 Returns: |
| 537 True if the results of testing this revision are significantly different | 537 True if the results of testing this revision are significantly different |
| 538 from those of testing the earliest known bad revision. | 538 from those of testing the earliest known bad revision. |
| 539 False if they are instead significantly different form those of testing | 539 False if they are instead significantly different form those of testing |
| 540 the latest knwon good revision. | 540 the latest knwon good revision. |
| 541 """ | 541 """ |
| 542 lkgr = self.bisector.lkgr |
| 543 fkbr = self.bisector.fkbr |
| 542 | 544 |
| 543 if self.bisector.is_return_code_mode(): | 545 if self.bisector.is_return_code_mode(): |
| 544 return self.overall_return_code == self.bisector.lkgr.overall_return_code | 546 return self.overall_return_code == lkgr.overall_return_code |
| 545 | 547 |
| 546 while True: | 548 while True: |
| 547 diff_from_good = self.bisector.significantly_different( | 549 diff_from_good = self.bisector.significantly_different( |
| 548 self.bisector.lkgr.values, self.values) | 550 lkgr.values[:len(fkbr.values)], self.values) |
| 549 diff_from_bad = self.bisector.significantly_different( | 551 diff_from_bad = self.bisector.significantly_different( |
| 550 self.bisector.fkbr.values, self.values) | 552 fkbr.values[:len(lkgr.values)], self.values) |
| 551 | 553 |
| 552 if diff_from_good and diff_from_bad: | 554 if diff_from_good and diff_from_bad: |
| 553 # Multiple regressions. | 555 # Multiple regressions. |
| 554 # For now, proceed bisecting the biggest difference of the means. | 556 # For now, proceed bisecting the biggest difference of the means. |
| 555 dist_from_good = abs(self.mean_value - self.bisector.lkgr.mean_value) | 557 dist_from_good = abs(self.mean_value - lkgr.mean_value) |
| 556 dist_from_bad = abs(self.mean_value - self.bisector.fkbr.mean_value) | 558 dist_from_bad = abs(self.mean_value - fkbr.mean_value) |
| 557 if dist_from_good > dist_from_bad: | 559 if dist_from_good > dist_from_bad: |
| 558 # TODO(robertocn): Add way to handle the secondary regression | 560 # TODO(robertocn): Add way to handle the secondary regression |
| 559 #self.bisector.handle_secondary_regression(self, self.bisector.fkbr) | 561 #self.bisector.handle_secondary_regression(self, fkbr) |
| 560 return False | 562 return False |
| 561 else: | 563 else: |
| 562 #self.bisector.handle_secondary_regression(self.bisector.lkgr, self) | 564 #self.bisector.handle_secondary_regression(lkgr, self) |
| 563 return True | 565 return True |
| 564 | 566 |
| 565 if diff_from_good or diff_from_bad: # pragma: no cover | 567 if diff_from_good or diff_from_bad: # pragma: no cover |
| 566 return diff_from_bad | 568 return diff_from_bad |
| 567 | 569 |
| 568 self._next_retest() # pragma: no cover | 570 self._next_retest() # pragma: no cover |
| 569 | 571 |
| 570 def revision_string(self): | 572 def revision_string(self): |
| 571 if self._rev_str: | 573 if self._rev_str: |
| 572 return self._rev_str | 574 return self._rev_str |
| (...skipping 26 matching lines...) Expand all Loading... |
| 599 else: | 601 else: |
| 600 next_revision_to_test.retest() | 602 next_revision_to_test.retest() |
| 601 | 603 |
| 602 def __repr__(self): | 604 def __repr__(self): |
| 603 if self.overall_return_code is not None: | 605 if self.overall_return_code is not None: |
| 604 return ('RevisionState(rev=%s, values=%r, overall_return_code=%r, ' | 606 return ('RevisionState(rev=%s, values=%r, overall_return_code=%r, ' |
| 605 'std_dev=%r)') % (self.revision_string(), self.values, | 607 'std_dev=%r)') % (self.revision_string(), self.values, |
| 606 self.overall_return_code, self.std_dev) | 608 self.overall_return_code, self.std_dev) |
| 607 return ('RevisionState(rev=%s, values=%r, mean_value=%r, std_dev=%r)' % ( | 609 return ('RevisionState(rev=%s, values=%r, mean_value=%r, std_dev=%r)' % ( |
| 608 self.revision_string(), self.values, self.mean_value, self.std_dev)) | 610 self.revision_string(), self.values, self.mean_value, self.std_dev)) |
| OLD | NEW |