Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(349)

Side by Side Diff: tools/auto_bisect/bisect_printer.py

Issue 697713003: Aborting bisect early when the bug specified in the bisect config is closed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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: %(metrics)s
24 Relative Change: %(change)s 24 Relative Change: %(change)s
25 Estimated Confidence: %(confidence).02f%%""" 25 Estimated Confidence: %(confidence).02f%%"""
26 26
27 # When the bisect was aborted without a bisect failure the following template
28 # is used.
29 ABORT_REASON_TEMPLATE = """
30 ===== BISECTION ABORTED =====
31 The bisect was aborted because %(abort_reason)s
32 Please contact the the team (see below) if you believe this is in error.
33
34 Bug ID: %(bug_id)s
35
36 Test Command: %(command)s
37 Test Metric: %(metric)s
38 Good revision: %(good_revision)s
39 Bad revision: %(bad_revision)s """
40
27 # The perf dashboard specifically looks for the string 41 # The perf dashboard specifically looks for the string
28 # "Author : " to parse out who to cc on a bug. If you change the 42 # "Author : " to parse out who to cc on a bug. If you change the
29 # formatting here, please update the perf dashboard as well. 43 # formatting here, please update the perf dashboard as well.
30 RESULTS_REVISION_INFO = """ 44 RESULTS_REVISION_INFO = """
31 ===== SUSPECTED CL(s) ===== 45 ===== SUSPECTED CL(s) =====
32 Subject : %(subject)s 46 Subject : %(subject)s
33 Author : %(author)s%(commit_info)s 47 Author : %(author)s%(commit_info)s
34 Commit : %(cl)s 48 Commit : %(cl)s
35 Date : %(cl_date)s""" 49 Date : %(cl_date)s"""
36 50
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 self.depot_registry = depot_registry 94 self.depot_registry = depot_registry
81 95
82 def FormatAndPrintResults(self, bisect_results): 96 def FormatAndPrintResults(self, bisect_results):
83 """Prints the results from a bisection run in a readable format. 97 """Prints the results from a bisection run in a readable format.
84 98
85 Also prints annotations creating buildbot step "Results". 99 Also prints annotations creating buildbot step "Results".
86 100
87 Args: 101 Args:
88 bisect_results: BisectResult object containing results to be printed. 102 bisect_results: BisectResult object containing results to be printed.
89 """ 103 """
104 if bisect_results.abort_reason:
105 self._PrintAbortResults(bisect_results.abort_reason)
106 return
107
90 if self.opts.output_buildbot_annotations: 108 if self.opts.output_buildbot_annotations:
91 bisect_utils.OutputAnnotationStepStart('Build Status Per Revision') 109 bisect_utils.OutputAnnotationStepStart('Build Status Per Revision')
92 110
93 print 111 print
94 print 'Full results of bisection:' 112 print 'Full results of bisection:'
95 for revision_state in bisect_results.state.GetRevisionStates(): 113 for revision_state in bisect_results.state.GetRevisionStates():
96 build_status = revision_state.passed 114 build_status = revision_state.passed
97 115
98 if type(build_status) is bool: 116 if type(build_status) is bool:
99 if build_status: 117 if build_status:
(...skipping 30 matching lines...) Expand all
130 if self.opts.output_buildbot_annotations: 148 if self.opts.output_buildbot_annotations:
131 bisect_utils.OutputAnnotationStepClosed() 149 bisect_utils.OutputAnnotationStepClosed()
132 150
133 def PrintPartialResults(self, bisect_state): 151 def PrintPartialResults(self, bisect_state):
134 revision_states = bisect_state.GetRevisionStates() 152 revision_states = bisect_state.GetRevisionStates()
135 first_working_rev, last_broken_rev = BisectResults.FindBreakingRevRange( 153 first_working_rev, last_broken_rev = BisectResults.FindBreakingRevRange(
136 revision_states) 154 revision_states)
137 self._PrintTestedCommitsTable(revision_states, first_working_rev, 155 self._PrintTestedCommitsTable(revision_states, first_working_rev,
138 last_broken_rev, 100, final_step=False) 156 last_broken_rev, 100, final_step=False)
139 157
158 def _PrintAbortResults(self, abort_reason):
159
160 if self.opts.output_buildbot_annotations:
161 bisect_utils.OutputAnnotationStepStart('Results')
162 print ABORT_REASON_TEMPLATE % {
163 'abort_reason': abort_reason,
164 'bug_id': self.opts.bug_id or 'NOT SPECIFIED',
165 'command': self.opts.command,
166 'metric': '/'.join(self.opts.metric),
167 'good_revision': self.opts.good_revision,
168 'bad_revision': self.opts.bad_revision,
169 }
170 self._PrintThankYou()
171 if self.opts.output_buildbot_annotations:
172 bisect_utils.OutputAnnotationStepClosed()
173
140 @staticmethod 174 @staticmethod
141 def _PrintThankYou(): 175 def _PrintThankYou():
142 print RESULTS_THANKYOU 176 print RESULTS_THANKYOU
143 177
144 @staticmethod 178 @staticmethod
145 def _PrintStepTime(revision_states): 179 def _PrintStepTime(revision_states):
146 """Prints information about how long various steps took. 180 """Prints information about how long various steps took.
147 181
148 Args: 182 Args:
149 revision_states: Ordered list of revision states.""" 183 revision_states: Ordered list of revision states."""
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 413
380 @staticmethod 414 @staticmethod
381 def _PrintWarnings(warnings): 415 def _PrintWarnings(warnings):
382 """Prints a list of warning strings if there are any.""" 416 """Prints a list of warning strings if there are any."""
383 if not warnings: 417 if not warnings:
384 return 418 return
385 print 419 print
386 print 'WARNINGS:' 420 print 'WARNINGS:'
387 for w in set(warnings): 421 for w in set(warnings):
388 print ' ! %s' % w 422 print ' ! %s' % w
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698