Skip to content
Browse files

Merge branch 'commitbuilder'

Conflicts:
	setup.py
  • Loading branch information...
2 parents 623e202 + 43b79e8 commit bd3102aafbca8cd17d5ad3a523792996c22ffc91 @harthur harthur committed Jun 23, 2011
Showing with 56 additions and 13 deletions.
  1. +45 −8 mozregression/regression.py
  2. +9 −3 mozregression/utils.py
  3. +2 −2 setup.py
View
53 mozregression/regression.py 100644 → 100755
@@ -37,35 +37,72 @@
import datetime
import sys
+import subprocess
from optparse import OptionParser
+from mozcommitbuilder import builder
+
from runnightly import NightlyRunner
-from utils import strsplit, get_date
+from utils import strsplit, get_date, increment_day
class Bisector():
- def __init__(self, runner):
+ def __init__(self, runner):
self.runner = runner
self.goodAppInfo = ''
self.badAppInfo = ''
self.currDate = ''
- def bisect(self, goodDate, badDate):
+ def buildChangesets(self, goodDate, badDate):
+ commitBuilder = builder.Builder()
+
+ # See https://bugzilla.mozilla.org/show_bug.cgi?id=487036 for better future solution
+ lastGoodChangeset = commitBuilder.changesetFromDay(str(goodDate)) #Gets oldest commit from given date
+ firstBadChangeset = commitBuilder.changesetFromDay(increment_day(str(badDate))) #Don't want to miss commits,
+ #widen window by a day
+
+ if self.goodAppInfo:
+ lastGoodChangeset = self.goodAppInfo[1]
+
+ if self.badAppInfo:
+ firstBadchangeset = self.badAppInfo[1]
+
+ if not firstBadChangeset or not lastGoodChangeset:
+ print "Done, not bisecting -- your date range goes into the future. Try one day earlier?"
+ quit()
+
+ elif(goodDate == badDate):
+ firstBadChangeset = commitBuilder.getTip()
+
+ print "\n Narrowed changeset range from " + lastGoodChangeset + " to " + firstBadChangeset +"\n"
+
+ print "Time to do some bisecting and building!"
+ commitBuilder.bisect(lastGoodChangeset, firstBadChangeset)
+ quit()
+
+ def build(self, goodDate, badDate, app="firefox"):
+ if app == "firefox":
+ print "Building changesets:"
+ self.buildChangesets(goodDate, badDate)
+
+ def bisect(self, goodDate, badDate, appname="firefox"):
midDate = goodDate + (badDate - goodDate) / 2
if midDate == badDate or midDate == goodDate:
print "\n\nLast good nightly: " + str(goodDate) + " First bad nightly: " + str(badDate) + "\n"
print "Pushlog: " + self.getPushlogUrl(goodDate, badDate) + "\n"
+ self.build(goodDate, badDate, app=appname)
sys.exit()
-
+
# run the nightly from that date
dest = self.runner.start(midDate)
while not dest:
midDate += datetime.timedelta(days=1)
if midDate == badDate:
print "\n\nLast good nightly: " + str(goodDate) + " First bad nightly: " + str(badDate) + "\n"
print "Pushlog: " + self.getPushlogUrl(goodDate, badDate) + "\n"
+ self.build(goodDate, badDate, app=appname)
sys.exit()
dest = self.runner.start(midDate)
-
+
self.prevDate = self.currDate
self.currDate = midDate
@@ -95,7 +132,7 @@ def getPushlogUrl(self, goodDate, badDate):
(repo, good_chset) = self.goodAppInfo
(repo, bad_chset) = self.badAppInfo
return repo + "/pushloghtml?fromchange=" + good_chset + "&tochange=" + bad_chset
-
+
def cli():
parser = OptionParser()
parser.add_option("-b", "--bad", dest="bad_date",help="first known bad nightly build, default is today",
@@ -114,15 +151,15 @@ def cli():
addons = strsplit(options.addons, ",")
cmdargs = strsplit(options.cmdargs, ",")
-
+
if not options.good_date:
options.good_date = "2009-01-01"
print "No 'good' date specified, using " + options.good_date
runner = NightlyRunner(appname=options.app, addons=addons, repo_name=options.repo_name,
profile=options.profile, cmdargs=cmdargs)
bisector = Bisector(runner)
- bisector.bisect(get_date(options.good_date), get_date(options.bad_date))
+ bisector.bisect(get_date(options.good_date), get_date(options.bad_date), options.app)
if __name__ == "__main__":
View
12 mozregression/utils.py
@@ -37,7 +37,7 @@
import httplib2
import datetime
import platform
-
+
def get_platform():
uname = platform.uname()
name = uname[0]
@@ -73,7 +73,7 @@ def strsplit(string, sep):
if len(strlist) == 1 and strlist[0] == '': # python's split function is ridiculous
return []
return strlist
-
+
def download_url(url, dest=None):
h = httplib2.Http()
resp, content = h.request(url, "GET")
@@ -91,4 +91,10 @@ def get_date(dateString):
if not m:
print "Incorrect date format"
return
- return datetime.date(int(m.group(1)), int(m.group(2)), int(m.group(3)))
+ return datetime.date(int(m.group(1)), int(m.group(2)), int(m.group(3)))
+
+def increment_day(date):
+ s = date.split("-")
+ delta = datetime.timedelta(days=1)
+ nextDate = datetime.date(int(s[0]),int(s[1]),int(s[2])) + delta
+ return str(nextDate)
View
4 setup.py
@@ -4,7 +4,7 @@
summ = """Interactive regression range finder for Mozilla nightly builds"""
setup(name="mozregression",
- version="0.3.8",
+ version="0.5",
description=desc,
long_description=summ,
author='Heather Arthur',
@@ -18,7 +18,7 @@
moznightly = mozregression:nightlycli
""",
platforms =['Any'],
- install_requires = ['httplib2 >= 0.6.0', 'mozrunner >= 2.5.1', 'BeautifulSoup >= 3.0.4'],
+ install_requires = ['httplib2 >= 0.6.0', 'mozrunner >= 2.5.1', 'BeautifulSoup >= 3.0.4', 'mozcommitbuilder >= 0.3.9'],
classifiers=['Development Status :: 4 - Beta',
'Environment :: Console',
'Intended Audience :: Developers',

0 comments on commit bd3102a

Please sign in to comment.
Something went wrong with that request. Please try again.