Chromium Code Reviews| 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 """This file contains printing-related functionality of the bisect.""" | 5 """This file contains printing-related functionality of the bisect.""" |
| 6 | 6 |
| 7 import datetime | 7 import datetime |
| 8 import re | 8 import re |
| 9 | 9 |
| 10 from bisect_results import BisectResults | 10 from bisect_results import BisectResults |
| 11 import bisect_utils | 11 import bisect_utils |
| 12 import source_control | 12 import source_control |
| 13 | 13 |
| 14 | 14 |
| 15 # The perf dashboard looks for a string like "Estimated Confidence: 95%" | 15 # The perf dashboard looks for a string like "Estimated Confidence: 95%" |
| 16 # to decide whether or not to cc the author(s). If you change this, please | 16 # to decide whether or not to cc the author(s). If you change this, please |
| 17 # update the perf dashboard as well. | 17 # update the perf dashboard as well. |
| 18 RESULTS_BANNER = """ | 18 RESULTS_BANNER = """ |
| 19 ===== BISECT JOB RESULTS ===== | 19 ===== BISECT JOB RESULTS ===== |
| 20 Status: %(status)s | 20 Status: %(status)s |
| 21 | 21 |
| 22 Test Command: %(command)s | 22 Test Command: %(command)s |
| 23 Test Metric: %(metrics)s | 23 Test Metric: %(metric)s |
|
qyearsley
2015/06/18 15:55:25
Renaming metrics -> metric is minor change unrelat
| |
| 24 Relative Change: %(change)s | 24 Relative Change: %(change)s |
| 25 Estimated Confidence: %(confidence).02f%% | 25 Estimated Confidence: %(confidence).02f%% |
| 26 Retested CL with revert: %(retest)s""" | 26 Retested CL with revert: %(retest)s""" |
| 27 | 27 |
| 28 # When the bisect was aborted without a bisect failure the following template | 28 # When the bisect was aborted without a bisect failure the following template |
| 29 # is used. | 29 # is used. |
| 30 ABORT_REASON_TEMPLATE = """ | 30 ABORT_REASON_TEMPLATE = """ |
| 31 ===== BISECTION ABORTED ===== | 31 ===== BISECTION ABORTED ===== |
| 32 The bisect was aborted because %(abort_reason)s | 32 The bisect was aborted because %(abort_reason)s |
| 33 Please contact the the team (see below) if you believe this is in error. | 33 Please contact the the team (see below) if you believe this is in error. |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 305 level = 'high' | 305 level = 'high' |
| 306 else: | 306 else: |
| 307 level = 'low' | 307 level = 'low' |
| 308 warning = ' and warnings' | 308 warning = ' and warnings' |
| 309 if not bisect_results.warnings: | 309 if not bisect_results.warnings: |
| 310 warning = '' | 310 warning = '' |
| 311 return confidence_status % {'level': level, 'warning': warning} | 311 return confidence_status % {'level': level, 'warning': warning} |
| 312 | 312 |
| 313 def _PrintBanner(self, bisect_results): | 313 def _PrintBanner(self, bisect_results): |
| 314 if self.opts.bisect_mode == bisect_utils.BISECT_MODE_RETURN_CODE: | 314 if self.opts.bisect_mode == bisect_utils.BISECT_MODE_RETURN_CODE: |
| 315 metrics = 'N/A' | 315 metric = 'N/A' |
| 316 change = 'Yes' | 316 change = 'Yes' |
| 317 else: | 317 else: |
| 318 metrics = '/'.join(self.opts.metric) | 318 metric = '/'.join(self.opts.metric) |
| 319 change = '%.02f%% (+/-%.02f%%)' % ( | 319 change = '%.02f%% (+/-%.02f%%)' % ( |
| 320 bisect_results.regression_size, bisect_results.regression_std_err) | 320 bisect_results.regression_size, bisect_results.regression_std_err) |
| 321 | 321 if not bisect_results.culprit_revisions: |
| 322 if bisect_results.culprit_revisions and bisect_results.confidence: | 322 change = 'No significant change reproduced.' |
| 323 status = self._ConfidenceLevelStatus(bisect_results) | |
| 324 else: | |
| 325 status = 'Failure, could not reproduce.' | |
| 326 change = 'Bisect could not reproduce a change.' | |
| 327 | |
| 328 retest_text = 'Yes' if bisect_results.retest_results_tot else 'No' | |
| 329 | 323 |
| 330 print RESULTS_BANNER % { | 324 print RESULTS_BANNER % { |
| 331 'status': status, | 325 'status': self._StatusMessage(bisect_results), |
| 332 'command': self.opts.command, | 326 'command': self.opts.command, |
| 333 'metrics': metrics, | 327 'metric': metric, |
| 334 'change': change, | 328 'change': change, |
| 335 'confidence': bisect_results.confidence, | 329 'confidence': bisect_results.confidence, |
| 336 'retest': retest_text, | 330 'retest': 'Yes' if bisect_results.retest_results_tot else 'No', |
| 337 } | 331 } |
| 338 | 332 |
| 339 @staticmethod | 333 @staticmethod |
| 334 def _StatusMessage(bisect_results): | |
| 335 if bisect_results.confidence >= bisect_utils.HIGH_CONFIDENCE: | |
| 336 return 'Positive: Reproduced a change.' | |
| 337 elif bisect_results.culprit_revisions: | |
| 338 return 'Negative: Found possible suspect(s), but with low confidence.' | |
| 339 return 'Negative: Did not reproduce a change.' | |
| 340 | |
| 341 @staticmethod | |
| 340 def _PrintWarnings(warnings): | 342 def _PrintWarnings(warnings): |
| 341 """Prints a list of warning strings if there are any.""" | 343 """Prints a list of warning strings if there are any.""" |
| 342 if not warnings: | 344 if not warnings: |
| 343 return | 345 return |
| 344 print | 346 print |
| 345 print 'WARNINGS:' | 347 print 'WARNINGS:' |
| 346 for w in set(warnings): | 348 for w in set(warnings): |
| 347 print ' ! %s' % w | 349 print ' ! %s' % w |
| OLD | NEW |