diff options
-rwxr-xr-x | tools/bisect-builds.py | 60 |
1 files changed, 57 insertions, 3 deletions
diff --git a/tools/bisect-builds.py b/tools/bisect-builds.py index 2ab9dc3..75afbf9 100755 --- a/tools/bisect-builds.py +++ b/tools/bisect-builds.py @@ -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): @@ -608,10 +630,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 +658,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.""" |