Bug 940637 - part 1 - add dump options to runtests.py and propagate to mochitests; r=jmaher

This commit is contained in:
Nathan Froyd 2013-11-21 11:33:43 -05:00
parent 8fdefc9de9
commit 1fc80bff31
3 changed files with 39 additions and 0 deletions

View File

@ -357,6 +357,26 @@ class MochitestOptions(optparse.OptionParser):
"dest": "dmdPath",
"help": "Specifies the path to the directory containing the shared library for DMD.",
}],
[["--dump-output-directory"],
{ "action": "store",
"default": None,
"dest": "dumpOutputDirectory",
"help": "Specifies the directory in which to place dumped memory reports.",
}],
[["--dump-about-memory-after-test"],
{ "action": "store_true",
"default": False,
"dest": "dumpAboutMemoryAfterTest",
"help": "Produce an about:memory dump after each test in the directory specified "
"by --dump-output-directory."
}],
[["--dump-dmd-after-test"],
{ "action": "store_true",
"default": False,
"dest": "dumpDMDAfterTest",
"help": "Produce a DMD dump after each test in the directory specified "
"by --dump-output-directory."
}],
]
def __init__(self, **kwargs):
@ -505,6 +525,14 @@ class MochitestOptions(optparse.OptionParser):
if not options.repeat:
options.repeat = 29
if options.dumpOutputDirectory is None:
options.dumpOutputDirectory = tempfile.gettempdir()
if options.dumpAboutMemoryAfterTest or options.dumpDMDAfterTest:
if not os.path.isdir(options.dumpOutputDirectory):
self.error('--dump-output-directory not a directory: %s' %
options.dumpOutputDirectory)
return options

View File

@ -344,6 +344,12 @@ class MochitestUtilsMixin(object):
self.urlOpts.append("runSlower=true")
if options.debugOnFailure:
self.urlOpts.append("debugOnFailure=true")
if options.dumpOutputDirectory:
self.urlOpts.append("dumpOutputDirectory=%s" % encodeURIComponent(options.dumpOutputDirectory))
if options.dumpAboutMemoryAfterTest:
self.urlOpts.append("dumpAboutMemoryAfterTest=true")
if options.dumpDMDAfterTest:
self.urlOpts.append("dumpDMDAfterTest=true")
def buildTestPath(self, options):
""" Build the url path to the specific test harness and test file or directory

View File

@ -212,6 +212,9 @@ class RemoteOptions(MochitestOptions):
tempPort = options.httpPort
tempSSL = options.sslPort
tempIP = options.webServer
# We are going to override this option later anyway, just pretend
# like it's not set for verification purposes.
options.dumpOutputDirectory = None
options = MochitestOptions.verifyOptions(self, options, mochitest)
options.webServer = tempIP
options.app = temp
@ -588,6 +591,8 @@ def main():
dm.pushFile(os.path.join(options.dmdPath, dmdLibrary), dmdPathOnDevice)
options.dmdPath = deviceRoot
options.dumpOutputDirectory = deviceRoot
procName = options.app.split('/')[-1]
if (dm.processExist(procName)):
dm.killProcess(procName)