diff --git a/testing/mochitest/mochitest_options.py b/testing/mochitest/mochitest_options.py index 4eb2524edd9e..5518b8bf42d8 100644 --- a/testing/mochitest/mochitest_options.py +++ b/testing/mochitest/mochitest_options.py @@ -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 diff --git a/testing/mochitest/runtests.py b/testing/mochitest/runtests.py index 14daa8d4b954..62ae7612c4a7 100644 --- a/testing/mochitest/runtests.py +++ b/testing/mochitest/runtests.py @@ -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 diff --git a/testing/mochitest/runtestsremote.py b/testing/mochitest/runtestsremote.py index 09dbe3dc51f3..43ca96b3e690 100644 --- a/testing/mochitest/runtestsremote.py +++ b/testing/mochitest/runtestsremote.py @@ -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)