summaryrefslogtreecommitdiff
path: root/chromium/tools/bisect-builds.py
diff options
context:
space:
mode:
authorAndras Becsi <andras.becsi@digia.com>2014-03-18 13:16:26 +0100
committerFrederik Gladhorn <frederik.gladhorn@digia.com>2014-03-20 15:55:39 +0100
commit3f0f86b0caed75241fa71c95a5d73bc0164348c5 (patch)
tree92b9fb00f2e9e90b0be2262093876d4f43b6cd13 /chromium/tools/bisect-builds.py
parente90d7c4b152c56919d963987e2503f9909a666d2 (diff)
downloadqtwebengine-chromium-3f0f86b0caed75241fa71c95a5d73bc0164348c5.tar.gz
Update to new stable branch 1750
This also includes an updated ninja and chromium dependencies needed on Windows. Change-Id: Icd597d80ed3fa4425933c9f1334c3c2e31291c42 Reviewed-by: Zoltan Arvai <zarvai@inf.u-szeged.hu> Reviewed-by: Zeno Albisser <zeno.albisser@digia.com>
Diffstat (limited to 'chromium/tools/bisect-builds.py')
-rwxr-xr-xchromium/tools/bisect-builds.py149
1 files changed, 117 insertions, 32 deletions
diff --git a/chromium/tools/bisect-builds.py b/chromium/tools/bisect-builds.py
index 2ab9dc3f89c..00128fbd161 100755
--- a/chromium/tools/bisect-builds.py
+++ b/chromium/tools/bisect-builds.py
@@ -29,7 +29,7 @@ OFFICIAL_CHANGELOG_URL = 'http://omahaproxy.appspot.com/'\
'changelog?old_version=%s&new_version=%s'
# DEPS file URL.
-DEPS_FILE= 'http://src.chromium.org/viewvc/chrome/trunk/src/DEPS?revision=%d'
+DEPS_FILE = 'http://src.chromium.org/viewvc/chrome/trunk/src/DEPS?revision=%d'
# Blink Changelogs URL.
BLINK_CHANGELOG_URL = 'http://build.chromium.org/f/chromium/' \
'perf/dashboard/ui/changelog_blink.html?' \
@@ -43,11 +43,10 @@ DONE_MESSAGE_GOOD_MAX = 'You are probably looking for a change made after %s ' \
###############################################################################
import json
-import math
import optparse
import os
-import pipes
import re
+import shlex
import shutil
import subprocess
import sys
@@ -63,7 +62,7 @@ class PathContext(object):
"""A PathContext is used to carry the information used to construct URLs and
paths when dealing with the storage server and archives."""
def __init__(self, base_url, platform, good_revision, bad_revision,
- is_official, is_aura):
+ is_official, is_aura, flash_path = None):
super(PathContext, self).__init__()
# Store off the input parameters.
self.base_url = base_url
@@ -72,6 +71,7 @@ class PathContext(object):
self.bad_revision = bad_revision
self.is_official = is_official
self.is_aura = is_aura
+ self.flash_path = flash_path
# The name of the ZIP file in a revision directory on the server.
self.archive_name = None
@@ -221,9 +221,31 @@ class PathContext(object):
# Download the revlist and filter for just the range between good and bad.
minrev = min(self.good_revision, self.bad_revision)
maxrev = max(self.good_revision, self.bad_revision)
- revlist = map(int, self.ParseDirectoryIndex())
- revlist = [x for x in revlist if x >= int(minrev) and x <= int(maxrev)]
+ revlist_all = map(int, self.ParseDirectoryIndex())
+
+ revlist = [x for x in revlist_all if x >= int(minrev) and x <= int(maxrev)]
revlist.sort()
+
+ # Set good and bad revisions to be legit revisions.
+ if revlist:
+ if self.good_revision < self.bad_revision:
+ self.good_revision = revlist[0]
+ self.bad_revision = revlist[-1]
+ else:
+ self.bad_revision = revlist[0]
+ self.good_revision = revlist[-1]
+
+ # Fix chromium rev so that the deps blink revision matches REVISIONS file.
+ if self.base_url == WEBKIT_BASE_URL:
+ revlist_all.sort()
+ self.good_revision = FixChromiumRevForBlink(revlist,
+ revlist_all,
+ self,
+ self.good_revision)
+ self.bad_revision = FixChromiumRevForBlink(revlist,
+ revlist_all,
+ self,
+ self.bad_revision)
return revlist
def GetOfficialBuildsList(self):
@@ -264,16 +286,16 @@ class PathContext(object):
pass
return final_list
-def UnzipFilenameToDir(filename, dir):
- """Unzip |filename| to directory |dir|."""
+def UnzipFilenameToDir(filename, directory):
+ """Unzip |filename| to |directory|."""
cwd = os.getcwd()
if not os.path.isabs(filename):
filename = os.path.join(cwd, filename)
zf = zipfile.ZipFile(filename)
# Make base.
- if not os.path.isdir(dir):
- os.mkdir(dir)
- os.chdir(dir)
+ if not os.path.isdir(directory):
+ os.mkdir(directory)
+ os.chdir(directory)
# Extract files.
for info in zf.infolist():
name = info.filename
@@ -281,9 +303,9 @@ def UnzipFilenameToDir(filename, dir):
if not os.path.isdir(name):
os.makedirs(name)
else: # file
- dir = os.path.dirname(name)
- if not os.path.isdir(dir):
- os.makedirs(dir)
+ directory = os.path.dirname(name)
+ if not os.path.isdir(directory):
+ os.makedirs(directory)
out = open(name, 'wb')
out.write(zf.read(name))
out.close()
@@ -340,11 +362,18 @@ def RunRevision(context, revision, zipfile, profile, num_runs, command, args):
# Run the build as many times as specified.
testargs = ['--user-data-dir=%s' % profile] + args
# The sandbox must be run as root on Official Chrome, so bypass it.
- if context.is_official and context.platform.startswith('linux'):
+ if ((context.is_official or context.flash_path) and
+ context.platform.startswith('linux')):
testargs.append('--no-sandbox')
+ if context.flash_path:
+ testargs.append('--ppapi-flash-path=%s' % context.flash_path)
+ # We have to pass a large enough Flash version, which currently needs not
+ # be correct. Instead of requiring the user of the script to figure out and
+ # pass the correct version we just spoof it.
+ testargs.append('--ppapi-flash-version=99.9.999.999')
runcommand = []
- for token in command.split():
+ for token in shlex.split(command):
if token == "%a":
runcommand.extend(testargs)
else:
@@ -429,6 +458,7 @@ def Bisect(base_url,
command="%p %a",
try_args=(),
profile=None,
+ flash_path=None,
evaluate=AskIsGoodBuild):
"""Given known good and known bad revisions, run a binary search on all
archived revisions to determine the last known good revision.
@@ -462,7 +492,7 @@ def Bisect(base_url,
profile = 'profile'
context = PathContext(base_url, platform, good_rev, bad_rev,
- official_builds, is_aura)
+ official_builds, is_aura, flash_path)
cwd = os.getcwd()
print "Downloading list of known revisions..."
@@ -531,7 +561,7 @@ def Bisect(base_url,
command,
try_args)
except Exception, e:
- print >>sys.stderr, e
+ print >> sys.stderr, e
# Call the evaluate function to see if the current revision is good or bad.
# On that basis, kill one of the background downloads and complete the
@@ -608,10 +638,24 @@ def Bisect(base_url,
return (revlist[minrev], revlist[maxrev])
-def GetBlinkRevisionForChromiumRevision(self, rev):
+def GetBlinkDEPSRevisionForChromiumRevision(rev):
"""Returns the blink revision that was in REVISIONS file at
chromium revision |rev|."""
# . doesn't match newlines without re.DOTALL, so this is safe.
+ blink_re = re.compile(r'webkit_revision\D*(\d+)')
+ url = urllib.urlopen(DEPS_FILE % rev)
+ m = blink_re.search(url.read())
+ url.close()
+ if m:
+ return int(m.group(1))
+ else:
+ raise Exception('Could not get Blink revision for Chromium rev %d'
+ % rev)
+
+
+def GetBlinkRevisionForChromiumRevision(self, rev):
+ """Returns the blink revision that was in REVISIONS file at
+ chromium revision |rev|."""
file_url = "%s/%s%d/REVISIONS" % (self.base_url,
self._listing_platform_dir, rev)
url = urllib.urlopen(file_url)
@@ -622,6 +666,24 @@ def GetBlinkRevisionForChromiumRevision(self, rev):
else:
raise Exception('Could not get blink revision for cr rev %d' % rev)
+def FixChromiumRevForBlink(revisions_final, revisions, self, rev):
+ """Returns the chromium revision that has the correct blink revision
+ for blink bisect, DEPS and REVISIONS file might not match since
+ blink snapshots point to tip of tree blink.
+ Note: The revisions_final variable might get modified to include
+ additional revisions."""
+
+ blink_deps_rev = GetBlinkDEPSRevisionForChromiumRevision(rev)
+
+ while (GetBlinkRevisionForChromiumRevision(self, rev) > blink_deps_rev):
+ idx = revisions.index(rev)
+ if idx > 0:
+ rev = revisions[idx-1]
+ if rev not in revisions_final:
+ revisions_final.insert(0, rev)
+
+ revisions_final.sort()
+ return rev
def GetChromiumRevision(url):
"""Returns the chromium revision read from given URL."""
@@ -666,6 +728,11 @@ def main():
help = 'A bad revision to start bisection. ' +
'May be earlier or later than the good revision. ' +
'Default is HEAD.')
+ parser.add_option('-f', '--flash_path', type = 'str',
+ help = 'Absolute path to a recent Adobe Pepper Flash ' +
+ 'binary to be used in this bisection (e.g. ' +
+ 'on Windows C:\...\pepflashplayer.dll and on Linux ' +
+ '/opt/google/chrome/PepperFlash/libpepflashplayer.so).')
parser.add_option('-g', '--good', type = 'str',
help = 'A good revision to start bisection. ' +
'May be earlier or later than the bad revision. ' +
@@ -683,7 +750,7 @@ def main():
'Use %s to specify all extra arguments as one string. ' +
'Defaults to "%p %a". Note that any extra paths ' +
'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',
@@ -713,7 +780,7 @@ def main():
# Create the context. Initialize 0 for the revisions as they are set below.
context = PathContext(base_url, opts.archive, 0, 0,
- opts.official_builds, opts.aura)
+ opts.official_builds, opts.aura, None)
# Pick a starting point, try to get HEAD for this.
if opts.bad:
bad_rev = opts.bad
@@ -728,6 +795,11 @@ def main():
else:
good_rev = '0.0.0.0' if opts.official_builds else 0
+ if opts.flash_path:
+ flash_path = opts.flash_path
+ msg = 'Could not find Flash binary at %s' % flash_path
+ assert os.path.exists(flash_path), msg
+
if opts.official_builds:
good_rev = LooseVersion(good_rev)
bad_rev = LooseVersion(bad_rev)
@@ -743,7 +815,7 @@ def main():
(min_chromium_rev, max_chromium_rev) = Bisect(
base_url, opts.archive, opts.official_builds, opts.aura, good_rev,
- bad_rev, opts.times, opts.command, args, opts.profile)
+ bad_rev, opts.times, opts.command, args, opts.profile, opts.flash_path)
# Get corresponding blink revisions.
try:
@@ -755,20 +827,33 @@ def main():
# Silently ignore the failure.
min_blink_rev, max_blink_rev = 0, 0
- # We're done. Let the user know the results in an official manner.
- if good_rev > bad_rev:
- print DONE_MESSAGE_GOOD_MAX % (str(min_chromium_rev), str(max_chromium_rev))
- else:
- print DONE_MESSAGE_GOOD_MIN % (str(min_chromium_rev), str(max_chromium_rev))
+ if opts.blink:
+ # We're done. Let the user know the results in an official manner.
+ if good_rev > bad_rev:
+ print DONE_MESSAGE_GOOD_MAX % (str(min_blink_rev), str(max_blink_rev))
+ else:
+ print DONE_MESSAGE_GOOD_MIN % (str(min_blink_rev), str(max_blink_rev))
- if min_blink_rev != max_blink_rev:
print 'BLINK CHANGELOG URL:'
print ' ' + BLINK_CHANGELOG_URL % (max_blink_rev, min_blink_rev)
- print 'CHANGELOG URL:'
- if opts.official_builds:
- print OFFICIAL_CHANGELOG_URL % (min_chromium_rev, max_chromium_rev)
+
else:
- print ' ' + CHANGELOG_URL % (min_chromium_rev, max_chromium_rev)
+ # We're done. Let the user know the results in an official manner.
+ if good_rev > bad_rev:
+ print DONE_MESSAGE_GOOD_MAX % (str(min_chromium_rev),
+ str(max_chromium_rev))
+ else:
+ print DONE_MESSAGE_GOOD_MIN % (str(min_chromium_rev),
+ str(max_chromium_rev))
+ if min_blink_rev != max_blink_rev:
+ print ("NOTE: There is a Blink roll in the range, "
+ "you might also want to do a Blink bisect.")
+
+ print 'CHANGELOG URL:'
+ if opts.official_builds:
+ print OFFICIAL_CHANGELOG_URL % (min_chromium_rev, max_chromium_rev)
+ else:
+ print ' ' + CHANGELOG_URL % (min_chromium_rev, max_chromium_rev)
if __name__ == '__main__':
sys.exit(main())