Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fennec #40

Merged
merged 6 commits into from Oct 2, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -28,7 +28,7 @@ Find regression range on Thunderbird nightlies:


Find regression range on Firefox mobile nightlies: Find regression range on Firefox mobile nightlies:


mozregression --app=mobile mozregression --app=fennec


Other branches/repos: Other branches/repos:


Expand All @@ -41,4 +41,4 @@ profile, addons, and browser arguments.


mozregression uses mozcommitbuilder: mozregression uses mozcommitbuilder:


https://github.com/mozilla/mozcommitbuilder https://github.com/mozilla/mozcommitbuilder
2 changes: 1 addition & 1 deletion mozregression/mozInstall.py
Expand Up @@ -292,7 +292,7 @@ def installExe(self):
1.9", metavar="BRANCH") 1.9", metavar="BRANCH")
parser.add_option("-p", "--Product", dest="product", parser.add_option("-p", "--Product", dest="product",
help="Product name - optional should be all lowercase if\ help="Product name - optional should be all lowercase if\
specified: firefox, mobile, thunderbird, etc", specified: firefox, fennec, thunderbird, etc",
metavar="PRODUCT") metavar="PRODUCT")
parser.add_option("-o", "--Operation", dest="op", parser.add_option("-o", "--Operation", dest="op",
help="The operation you would like the script to perform.\ help="The operation you would like the script to perform.\
Expand Down
4 changes: 2 additions & 2 deletions mozregression/regression.py
Expand Up @@ -168,8 +168,8 @@ def cli():
parser.add_option("-p", "--profile", dest="profile", help="profile to use with nightlies", metavar="PATH") parser.add_option("-p", "--profile", dest="profile", help="profile to use with nightlies", metavar="PATH")
parser.add_option("-a", "--args", dest="cmdargs", help="command-line arguments to pass to the application", parser.add_option("-a", "--args", dest="cmdargs", help="command-line arguments to pass to the application",
metavar="ARG1,ARG2", default="") metavar="ARG1,ARG2", default="")
parser.add_option("-n", "--app", dest="app", help="application name (firefox, mobile or thunderbird)", parser.add_option("-n", "--app", dest="app", help="application name (firefox, fennec or thunderbird)",
metavar="[firefox|mobile|thunderbird]", default="firefox") metavar="[firefox|fennec|thunderbird]", default="firefox")
parser.add_option("-r", "--repo", dest="repo_name", help="repository name on ftp.mozilla.org", parser.add_option("-r", "--repo", dest="repo_name", help="repository name on ftp.mozilla.org",
metavar="[tracemonkey|mozilla-1.9.2]", default=None) metavar="[tracemonkey|mozilla-1.9.2]", default=None)
(options, args) = parser.parse_args() (options, args) = parser.parse_args()
Expand Down
70 changes: 52 additions & 18 deletions mozregression/runnightly.py
Expand Up @@ -106,6 +106,7 @@ def install(self):
rmdirRecursive("moznightlyapp") rmdirRecursive("moznightlyapp")
subprocess._cleanup = lambda : None # mikeal's fix for subprocess threading bug subprocess._cleanup = lambda : None # mikeal's fix for subprocess threading bug
MozInstaller(src=self.dest, dest="moznightlyapp", dest_app="Mozilla.app") MozInstaller(src=self.dest, dest="moznightlyapp", dest_app="Mozilla.app")
return True


@staticmethod @staticmethod
def urlLinks(url): def urlLinks(url):
Expand Down Expand Up @@ -165,6 +166,22 @@ def getAppInfo(self):
except: except:
return ("", "") return ("", "")


def start(self, profile, addons, cmdargs):
if profile:
profile = self.profileClass(profile=profile, addons=addons)
elif len(addons):
profile = self.profileClass(addons=addons)
else:
profile = self.profileClass()

self.runner = Runner(binary=self.binary, cmdargs=cmdargs, profile=profile)
self.runner.names = [self.processName]
self.runner.start()
return True

def stop(self):
self.runner.stop()

class ThunderbirdNightly(Nightly): class ThunderbirdNightly(Nightly):
appName = 'thunderbird' appName = 'thunderbird'
name = 'thunderbird' name = 'thunderbird'
Expand Down Expand Up @@ -203,15 +220,38 @@ class FennecNightly(Nightly):
name = 'fennec' name = 'fennec'
profileClass = FirefoxProfile profileClass = FirefoxProfile


def __init__(self, repo_name=None):
Nightly.__init__(self, repo_name)
self.buildRegex = 'fennec-.*\.apk'
self.processName = 'org.mozilla.fennec'
self.binary = 'org.mozilla.fennec/.App'
if "y" != raw_input("WARNING: bisecting nightly fennec builds will clobber your existing nightly profile. Continue? (y or n)"):
raise Exception("Aborting!")

def getRepoName(self, date): def getRepoName(self, date):
return "mozilla-central-linux" return "mozilla-central-android"

def install(self):
subprocess.check_call(["adb", "uninstall", "org.mozilla.fennec"])
subprocess.check_call(["adb", "install", self.dest])
return True

def start(self, profile, addons, cmdargs):
subprocess.check_call(["adb", "shell", "am start -n %s" % self.binary])
return True

def stop(self):
# TODO: kill fennec (don't really care though since uninstalling it kills it)
# PID = $(adb shell ps | grep org.mozilla.fennec | awk '{ print $2 }')
# adb shell run-as org.mozilla.fennec kill $PID
return True


class NightlyRunner(object): class NightlyRunner(object):
def __init__(self, addons=None, appname="firefox", repo_name=None, def __init__(self, addons=None, appname="firefox", repo_name=None,
profile=None, cmdargs=[]): profile=None, cmdargs=[]):
if appname.lower() == 'thunderbird': if appname.lower() == 'thunderbird':
self.app = ThunderbirdNightly(repo_name=repo_name) self.app = ThunderbirdNightly(repo_name=repo_name)
elif appname.lower() == 'mobile': elif appname.lower() == 'fennec':
self.app = FennecNightly(repo_name=repo_name) self.app = FennecNightly(repo_name=repo_name)
else: else:
self.app = FirefoxNightly(repo_name=repo_name) self.app = FirefoxNightly(repo_name=repo_name)
Expand All @@ -223,25 +263,19 @@ def install(self, date=datetime.date.today()):
if not self.app.download(date=date): if not self.app.download(date=date):
print "could not find nightly from " + str(date) print "could not find nightly from " + str(date)
return False # download failed return False # download failed
print "Starting nightly\n" print "Installing nightly\n"
self.app.install() return self.app.install()


def start(self, date=datetime.date.today()): def start(self, date=datetime.date.today()):
self.install(date) if not self.install(date):
if self.profile: return False
profile = self.app.profileClass(profile=self.profile, addons=self.addons) print "Starting nightly\n"
elif len(self.addons): if not self.app.start(self.profile, self.addons, self.cmdargs):
profile = self.app.profileClass(addons=self.addons) return False
else:
profile = self.app.profileClass()

self.runner = Runner(binary=self.app.binary, cmdargs=self.cmdargs, profile=profile)
self.runner.names = [self.app.processName]
self.runner.start()
return True return True


def stop(self): def stop(self):
self.runner.stop() self.app.stop()


def getAppInfo(self): def getAppInfo(self):
return self.app.getAppInfo() return self.app.getAppInfo()
Expand All @@ -253,8 +287,8 @@ def cli():
parser.add_option("-a", "--addons", dest="addons", help="list of addons to install", parser.add_option("-a", "--addons", dest="addons", help="list of addons to install",
metavar="PATH1,PATH2", default="") metavar="PATH1,PATH2", default="")
parser.add_option("-p", "--profile", dest="profile", help="path to profile to user", metavar="PATH") parser.add_option("-p", "--profile", dest="profile", help="path to profile to user", metavar="PATH")
parser.add_option("-n", "--app", dest="app", help="application name (firefox or thunderbird)", parser.add_option("-n", "--app", dest="app", help="application name (firefox, thunderbird, or fennec)",
metavar="[firefox|thunderbird]", default="firefox") metavar="[firefox|thunderbird|fennec]", default="firefox")
parser.add_option("-r", "--repo", dest="repo_name", help="repository name on ftp.mozilla.org", parser.add_option("-r", "--repo", dest="repo_name", help="repository name on ftp.mozilla.org",
metavar="[tracemonkey|mozilla-1.9.2]", default=None) metavar="[tracemonkey|mozilla-1.9.2]", default=None)
(options, args) = parser.parse_args() (options, args) = parser.parse_args()
Expand Down