Commit 4c6fec6b authored by karen@chromium.org's avatar karen@chromium.org

add the option to bisect blink builds as well and have blink revisions look in...

add the option to bisect blink builds as well and have blink revisions look in the REVISIONS file and not DEPS

R=rsesek@chromium.org

Review URL: https://codereview.chromium.org/23431026

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@223632 0039d316-1c4b-4281-b951-d872f2087c98
parent e93217a6
...@@ -13,7 +13,8 @@ it will ask you whether it is good or bad before continuing the search. ...@@ -13,7 +13,8 @@ it will ask you whether it is good or bad before continuing the search.
""" """
# The root URL for storage. # The root URL for storage.
BASE_URL = 'http://commondatastorage.googleapis.com/chromium-browser-snapshots' CHROMIUM_BASE_URL = 'http://commondatastorage.googleapis.com/chromium-browser-snapshots'
WEBKIT_BASE_URL = 'http://commondatastorage.googleapis.com/chromium-webkit-snapshots'
# The root URL for official builds. # The root URL for official builds.
OFFICIAL_BASE_URL = 'http://master.chrome.corp.google.com/official_builds' OFFICIAL_BASE_URL = 'http://master.chrome.corp.google.com/official_builds'
...@@ -41,6 +42,7 @@ DONE_MESSAGE_GOOD_MAX = 'You are probably looking for a change made after %s ' \ ...@@ -41,6 +42,7 @@ DONE_MESSAGE_GOOD_MAX = 'You are probably looking for a change made after %s ' \
############################################################################### ###############################################################################
import json
import math import math
import optparse import optparse
import os import os
...@@ -60,10 +62,11 @@ import zipfile ...@@ -60,10 +62,11 @@ import zipfile
class PathContext(object): class PathContext(object):
"""A PathContext is used to carry the information used to construct URLs and """A PathContext is used to carry the information used to construct URLs and
paths when dealing with the storage server and archives.""" paths when dealing with the storage server and archives."""
def __init__(self, platform, good_revision, bad_revision, is_official, def __init__(self, base_url, platform, good_revision, bad_revision,
is_aura): is_official, is_aura):
super(PathContext, self).__init__() super(PathContext, self).__init__()
# Store off the input parameters. # Store off the input parameters.
self.base_url = base_url
self.platform = platform # What's passed in to the '-a/--archive' option. self.platform = platform # What's passed in to the '-a/--archive' option.
self.good_revision = good_revision self.good_revision = good_revision
self.bad_revision = bad_revision self.bad_revision = bad_revision
...@@ -127,8 +130,8 @@ class PathContext(object): ...@@ -127,8 +130,8 @@ class PathContext(object):
marker_param = '' marker_param = ''
if marker: if marker:
marker_param = '&marker=' + str(marker) marker_param = '&marker=' + str(marker)
return BASE_URL + '/?delimiter=/&prefix=' + self._listing_platform_dir + \ return self.base_url + '/?delimiter=/&prefix=' + \
marker_param self._listing_platform_dir + marker_param
def GetDownloadURL(self, revision): def GetDownloadURL(self, revision):
"""Gets the download URL for a build archive of a specific revision.""" """Gets the download URL for a build archive of a specific revision."""
...@@ -137,12 +140,12 @@ class PathContext(object): ...@@ -137,12 +140,12 @@ class PathContext(object):
OFFICIAL_BASE_URL, revision, self._listing_platform_dir, OFFICIAL_BASE_URL, revision, self._listing_platform_dir,
self.archive_name) self.archive_name)
else: else:
return "%s/%s%s/%s" % ( return "%s/%s%s/%s" % (self.base_url, self._listing_platform_dir,
BASE_URL, self._listing_platform_dir, revision, self.archive_name) revision, self.archive_name)
def GetLastChangeURL(self): def GetLastChangeURL(self):
"""Returns a URL to the LAST_CHANGE file.""" """Returns a URL to the LAST_CHANGE file."""
return BASE_URL + '/' + self._listing_platform_dir + 'LAST_CHANGE' return self.base_url + '/' + self._listing_platform_dir + 'LAST_CHANGE'
def GetLaunchPath(self): def GetLaunchPath(self):
"""Returns a relative path (presumably from the archive extraction location) """Returns a relative path (presumably from the archive extraction location)
...@@ -416,7 +419,8 @@ class DownloadJob(object): ...@@ -416,7 +419,8 @@ class DownloadJob(object):
self.thread.join() self.thread.join()
def Bisect(platform, def Bisect(base_url,
platform,
official_builds, official_builds,
is_aura, is_aura,
good_rev=0, good_rev=0,
...@@ -457,11 +461,10 @@ def Bisect(platform, ...@@ -457,11 +461,10 @@ def Bisect(platform,
if not profile: if not profile:
profile = 'profile' profile = 'profile'
context = PathContext(platform, good_rev, bad_rev, official_builds, is_aura) context = PathContext(base_url, platform, good_rev, bad_rev,
official_builds, is_aura)
cwd = os.getcwd() cwd = os.getcwd()
print "Downloading list of known revisions..." print "Downloading list of known revisions..."
_GetDownloadPath = lambda rev: os.path.join(cwd, _GetDownloadPath = lambda rev: os.path.join(cwd,
'%s-%s' % (str(rev), context.archive_name)) '%s-%s' % (str(rev), context.archive_name))
...@@ -605,16 +608,17 @@ def Bisect(platform, ...@@ -605,16 +608,17 @@ def Bisect(platform,
return (revlist[minrev], revlist[maxrev]) return (revlist[minrev], revlist[maxrev])
def GetBlinkRevisionForChromiumRevision(rev): def GetBlinkRevisionForChromiumRevision(self, rev):
"""Returns the blink revision that was in chromium's DEPS file at """Returns the blink revision that was in REVISIONS file at
chromium revision |rev|.""" chromium revision |rev|."""
# . doesn't match newlines without re.DOTALL, so this is safe. # . doesn't match newlines without re.DOTALL, so this is safe.
blink_re = re.compile(r'webkit_revision.:\D*(\d+)') file_url = "%s/%s%d/REVISIONS" % (self.base_url,
url = urllib.urlopen(DEPS_FILE % rev) self._listing_platform_dir, rev)
m = blink_re.search(url.read()) url = urllib.urlopen(file_url)
data = json.loads(url.read())
url.close() url.close()
if m: if 'webkit_revision' in data:
return int(m.group(1)) return data['webkit_revision']
else: else:
raise Exception('Could not get blink revision for cr rev %d' % rev) raise Exception('Could not get blink revision for cr rev %d' % rev)
...@@ -680,6 +684,8 @@ def main(): ...@@ -680,6 +684,8 @@ def main():
'Defaults to "%p %a". Note that any extra paths ' + 'Defaults to "%p %a". Note that any extra paths ' +
'specified should be absolute.', 'specified should be absolute.',
default = '%p %a'); default = '%p %a');
parser.add_option('-l', '--blink', action='store_true',
help = 'Use Blink bisect instead of Chromium. ')
parser.add_option('--aura', parser.add_option('--aura',
dest='aura', dest='aura',
action='store_true', action='store_true',
...@@ -700,8 +706,14 @@ def main(): ...@@ -700,8 +706,14 @@ def main():
'and official builds.' 'and official builds.'
return 1 return 1
if opts.blink:
base_url = WEBKIT_BASE_URL
else:
base_url = CHROMIUM_BASE_URL
# Create the context. Initialize 0 for the revisions as they are set below. # Create the context. Initialize 0 for the revisions as they are set below.
context = PathContext(opts.archive, 0, 0, opts.official_builds, opts.aura) context = PathContext(base_url, opts.archive, 0, 0,
opts.official_builds, opts.aura)
# Pick a starting point, try to get HEAD for this. # Pick a starting point, try to get HEAD for this.
if opts.bad: if opts.bad:
bad_rev = opts.bad bad_rev = opts.bad
...@@ -730,13 +742,15 @@ def main(): ...@@ -730,13 +742,15 @@ def main():
return 1 return 1
(min_chromium_rev, max_chromium_rev) = Bisect( (min_chromium_rev, max_chromium_rev) = Bisect(
opts.archive, opts.official_builds, opts.aura, good_rev, bad_rev, base_url, opts.archive, opts.official_builds, opts.aura, good_rev,
opts.times, opts.command, args, opts.profile) bad_rev, opts.times, opts.command, args, opts.profile)
# Get corresponding blink revisions. # Get corresponding blink revisions.
try: try:
min_blink_rev = GetBlinkRevisionForChromiumRevision(min_chromium_rev) min_blink_rev = GetBlinkRevisionForChromiumRevision(context,
max_blink_rev = GetBlinkRevisionForChromiumRevision(max_chromium_rev) min_chromium_rev)
max_blink_rev = GetBlinkRevisionForChromiumRevision(context,
max_chromium_rev)
except Exception, e: except Exception, e:
# Silently ignore the failure. # Silently ignore the failure.
min_blink_rev, max_blink_rev = 0, 0 min_blink_rev, max_blink_rev = 0, 0
......
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