Adding annotation output for trybot.

BUG=
NOTRY=true


Review URL: https://chromiumcodereview.appspot.com/12254022

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@182474 0039d316-1c4b-4281-b951-d872f2087c98
parent d6d8dc82
...@@ -126,6 +126,24 @@ def IsStringInt(string_to_check): ...@@ -126,6 +126,24 @@ def IsStringInt(string_to_check):
return False return False
def OutputAnnotationStepStart(name):
"""Outputs appropriate annotation to signal the start of a step to
a trybot.
Args:
name: The name of the step.
"""
print '@@@SEED_STEP %s@@@' % name
print '@@@STEP_CURSOR %s@@@' % name
print '@@@STEP_STARTED@@@'
def OutputAnnotationStepClosed():
"""Outputs appropriate annotation to signal the closing of a step to
a trybot."""
print '@@@STEP_CLOSED@@@'
def RunProcess(command): def RunProcess(command):
"""Run an arbitrary command, returning its output and return code. """Run an arbitrary command, returning its output and return code.
...@@ -779,12 +797,20 @@ class BisectPerformanceMetrics(object): ...@@ -779,12 +797,20 @@ class BisectPerformanceMetrics(object):
'sort' : i + sort + 1} 'sort' : i + sort + 1}
def PrintRevisionsToBisectMessage(self, revision_list, depot): def PrintRevisionsToBisectMessage(self, revision_list, depot):
if self.opts.output_buildbot_annotations:
step_name = 'Bisection Range: [%s - %s]' % (
revision_list[len(revision_list)-1], revision_list[0])
OutputAnnotationStepStart(step_name)
print print
print 'Revisions to bisect on [%s]:' % depot print 'Revisions to bisect on [%s]:' % depot
for revision_id in revision_list: for revision_id in revision_list:
print ' -> %s' % (revision_id, ) print ' -> %s' % (revision_id, )
print print
if self.opts.output_buildbot_annotations:
OutputAnnotationStepClosed()
def Run(self, command_to_run, bad_revision_in, good_revision_in, metric): def Run(self, command_to_run, bad_revision_in, good_revision_in, metric):
"""Given known good and bad revisions, run a binary search on all """Given known good and bad revisions, run a binary search on all
intermediate revisions to determine the CL where the performance regression intermediate revisions to determine the CL where the performance regression
...@@ -846,11 +872,17 @@ class BisectPerformanceMetrics(object): ...@@ -846,11 +872,17 @@ class BisectPerformanceMetrics(object):
results['error'] = 'Could\'t resolve [%s] to SHA1.' % (good_revision_in,) results['error'] = 'Could\'t resolve [%s] to SHA1.' % (good_revision_in,)
return results return results
if self.opts.output_buildbot_annotations:
OutputAnnotationStepStart('Gathering Revisions')
print 'Gathering revision range for bisection.' print 'Gathering revision range for bisection.'
# Retrieve a list of revisions to do bisection on. # Retrieve a list of revisions to do bisection on.
src_revision_list = self.GetRevisionList(bad_revision, good_revision) src_revision_list = self.GetRevisionList(bad_revision, good_revision)
if self.opts.output_buildbot_annotations:
OutputAnnotationStepClosed()
if src_revision_list: if src_revision_list:
# revision_data will store information about a revision such as the # revision_data will store information about a revision such as the
# depot it came from, the webkit/V8 revision at that time, # depot it came from, the webkit/V8 revision at that time,
...@@ -877,6 +909,9 @@ class BisectPerformanceMetrics(object): ...@@ -877,6 +909,9 @@ class BisectPerformanceMetrics(object):
self.PrintRevisionsToBisectMessage(revision_list, 'src') self.PrintRevisionsToBisectMessage(revision_list, 'src')
if self.opts.output_buildbot_annotations:
OutputAnnotationStepStart('Gathering Reference Values')
print 'Gathering reference values for bisection.' print 'Gathering reference values for bisection.'
# Perform the performance tests on the good and bad revisions, to get # Perform the performance tests on the good and bad revisions, to get
...@@ -886,6 +921,9 @@ class BisectPerformanceMetrics(object): ...@@ -886,6 +921,9 @@ class BisectPerformanceMetrics(object):
command_to_run, command_to_run,
metric) metric)
if self.opts.output_buildbot_annotations:
OutputAnnotationStepClosed()
if bad_results[1]: if bad_results[1]:
results['error'] = bad_results[0] results['error'] = bad_results[0]
return results return results
...@@ -985,6 +1023,10 @@ class BisectPerformanceMetrics(object): ...@@ -985,6 +1023,10 @@ class BisectPerformanceMetrics(object):
self.ChangeToDepotWorkingDirectory(next_revision_depot) self.ChangeToDepotWorkingDirectory(next_revision_depot)
if self.opts.output_buildbot_annotations:
step_name = 'Working on [%s]' % next_revision_id
OutputAnnotationStepStart(step_name)
print 'Working on revision: [%s]' % next_revision_id print 'Working on revision: [%s]' % next_revision_id
run_results = self.SyncBuildAndRunRevision(next_revision_id, run_results = self.SyncBuildAndRunRevision(next_revision_id,
...@@ -992,6 +1034,9 @@ class BisectPerformanceMetrics(object): ...@@ -992,6 +1034,9 @@ class BisectPerformanceMetrics(object):
command_to_run, command_to_run,
metric) metric)
if self.opts.output_buildbot_annotations:
OutputAnnotationStepClosed()
# If the build is successful, check whether or not the metric # If the build is successful, check whether or not the metric
# had regressed. # had regressed.
if not run_results[1]: if not run_results[1]:
...@@ -1033,6 +1078,9 @@ class BisectPerformanceMetrics(object): ...@@ -1033,6 +1078,9 @@ class BisectPerformanceMetrics(object):
revision_data_sorted = sorted(revision_data.iteritems(), revision_data_sorted = sorted(revision_data.iteritems(),
key = lambda x: x[1]['sort']) key = lambda x: x[1]['sort'])
if self.opts.output_buildbot_annotations:
OutputAnnotationStepStart('Results')
print print
print 'Full results of bisection:' print 'Full results of bisection:'
for current_id, current_data in revision_data_sorted: for current_id, current_data in revision_data_sorted:
...@@ -1057,7 +1105,7 @@ class BisectPerformanceMetrics(object): ...@@ -1057,7 +1105,7 @@ class BisectPerformanceMetrics(object):
last_broken_revision = k last_broken_revision = k
if last_broken_revision != None and first_working_revision != None: if last_broken_revision != None and first_working_revision != None:
print 'Results: Regression was detected as a result of changes on:' print 'Results: Regression may have occurred in range:'
print ' -> First Bad Revision: [%s] [%s]' %\ print ' -> First Bad Revision: [%s] [%s]' %\
(last_broken_revision, (last_broken_revision,
revision_data[last_broken_revision]['depot']) revision_data[last_broken_revision]['depot'])
...@@ -1065,6 +1113,9 @@ class BisectPerformanceMetrics(object): ...@@ -1065,6 +1113,9 @@ class BisectPerformanceMetrics(object):
(first_working_revision, (first_working_revision,
revision_data[first_working_revision]['depot']) revision_data[first_working_revision]['depot'])
if self.opts.output_buildbot_annotations:
OutputAnnotationStepClosed()
def DetermineAndCreateSourceControl(): def DetermineAndCreateSourceControl():
"""Attempts to determine the underlying source control workflow and returns """Attempts to determine the underlying source control workflow and returns
...@@ -1112,6 +1163,9 @@ def main(): ...@@ -1112,6 +1163,9 @@ def main():
parser.add_option('--use_goma', parser.add_option('--use_goma',
action="store_true", action="store_true",
help='Add a bunch of extra threads for goma.') help='Add a bunch of extra threads for goma.')
parser.add_option('--output_buildbot_annotations',
action="store_true",
help='Add extra annotation output for buildbot.')
parser.add_option('--debug_ignore_build', parser.add_option('--debug_ignore_build',
action="store_true", action="store_true",
help='DEBUG: Don\'t perform builds.') help='DEBUG: Don\'t perform builds.')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment