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 math | 5 import math |
6 import os | 6 import os |
7 | 7 |
8 import bisect_utils | 8 import bisect_utils |
9 import math_utils | 9 import math_utils |
10 import source_control | 10 import source_control |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 second option creates an error result. | 49 second option creates an error result. |
50 | 50 |
51 Args: | 51 Args: |
52 bisect_state: BisectState object representing latest bisect state. | 52 bisect_state: BisectState object representing latest bisect state. |
53 depot_registry: DepotDirectoryRegistry object with information on each | 53 depot_registry: DepotDirectoryRegistry object with information on each |
54 repository in the bisect_state. | 54 repository in the bisect_state. |
55 opts: Options passed to the bisect run. | 55 opts: Options passed to the bisect run. |
56 runtime_warnings: A list of warnings from the bisect run. | 56 runtime_warnings: A list of warnings from the bisect run. |
57 error: Error message. When error is not None, other arguments are ignored. | 57 error: Error message. When error is not None, other arguments are ignored. |
58 """ | 58 """ |
| 59 # Setting these attributes so that bisect printer does not break when the |
| 60 # regression cannot be reproduced (no broken revision was found) |
| 61 self.regression_size = 0 |
| 62 self.regression_std_err = 0 |
| 63 self.confidence = 0 |
| 64 self.culprit_revisions = [] |
| 65 |
59 self.error = error | 66 self.error = error |
60 self.abort_reason = abort_reason | 67 self.abort_reason = abort_reason |
61 if error is not None or abort_reason is not None: | 68 if error is not None or abort_reason is not None: |
62 return | 69 return |
63 | 70 |
64 assert (bisect_state is not None and depot_registry is not None and | 71 assert (bisect_state is not None and depot_registry is not None and |
65 opts is not None and runtime_warnings is not None), ( | 72 opts is not None and runtime_warnings is not None), ( |
66 'Incorrect use of the BisectResults constructor. ' | 73 'Incorrect use of the BisectResults constructor. ' |
67 'When error is None, all other arguments are required.') | 74 'When error is None, all other arguments are required.') |
68 | 75 |
(...skipping 15 matching lines...) Expand all Loading... |
84 | 91 |
85 self.regression_size = statistics['regression_size'] | 92 self.regression_size = statistics['regression_size'] |
86 self.regression_std_err = statistics['regression_std_err'] | 93 self.regression_std_err = statistics['regression_std_err'] |
87 self.confidence = statistics['confidence'] | 94 self.confidence = statistics['confidence'] |
88 | 95 |
89 self.culprit_revisions = self._FindCulpritRevisions( | 96 self.culprit_revisions = self._FindCulpritRevisions( |
90 rev_states, depot_registry, first_working_rev, last_broken_rev) | 97 rev_states, depot_registry, first_working_rev, last_broken_rev) |
91 | 98 |
92 self.warnings += self._GetResultBasedWarnings( | 99 self.warnings += self._GetResultBasedWarnings( |
93 self.culprit_revisions, opts, self.confidence) | 100 self.culprit_revisions, opts, self.confidence) |
94 elif first_working_rev is not None: | |
95 # Setting these attributes so that bisect printer does not break when the | |
96 # regression cannot be reproduced (no broken revision was found) | |
97 self.regression_size = 0 | |
98 self.regression_std_err = 0 | |
99 self.confidence = 0 | |
100 self.culprit_revisions = [] | |
101 | 101 |
102 def AddRetestResults(self, results_tot, results_reverted): | 102 def AddRetestResults(self, results_tot, results_reverted): |
103 if not results_tot or not results_reverted: | 103 if not results_tot or not results_reverted: |
104 self.warnings.append( | 104 self.warnings.append( |
105 'Failed to re-test reverted culprit CL against ToT.') | 105 'Failed to re-test reverted culprit CL against ToT.') |
106 return | 106 return |
107 | 107 |
108 confidence = BisectResults.ConfidenceScore( | 108 confidence = BisectResults.ConfidenceScore( |
109 results_reverted[0]['values'], | 109 results_reverted[0]['values'], |
110 results_tot[0]['values']) | 110 results_tot[0]['values']) |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 confidence = cls.ConfidenceScore( | 253 confidence = cls.ConfidenceScore( |
254 sum([first_working_rev.value['values']], []), | 254 sum([first_working_rev.value['values']], []), |
255 sum([last_broken_rev.value['values']], [])) | 255 sum([last_broken_rev.value['values']], [])) |
256 | 256 |
257 bad_greater_than_good = mean_of_bad_runs > mean_of_good_runs | 257 bad_greater_than_good = mean_of_bad_runs > mean_of_good_runs |
258 | 258 |
259 return {'regression_size': regression_size, | 259 return {'regression_size': regression_size, |
260 'regression_std_err': regression_std_err, | 260 'regression_std_err': regression_std_err, |
261 'confidence': confidence, | 261 'confidence': confidence, |
262 'bad_greater_than_good': bad_greater_than_good} | 262 'bad_greater_than_good': bad_greater_than_good} |
OLD | NEW |