Bug 938706 - (2) Put Android xpcshell minidumps in a separate directory; r=ted

This commit is contained in:
Geoff Brown 2013-11-21 10:22:18 -07:00
parent 5fe9f49fab
commit e47f6639e2
2 changed files with 33 additions and 4 deletions

View File

@ -93,7 +93,7 @@ try {
let (crashReporter =
Components.classes["@mozilla.org/toolkit/crash-reporter;1"]
.getService(Components.interfaces.nsICrashReporter)) {
crashReporter.minidumpPath = do_get_tempdir();
crashReporter.minidumpPath = do_get_minidumpdir();
}
}
}
@ -1099,6 +1099,26 @@ function do_get_tempdir() {
return file;
}
/**
* Returns the directory for crashreporter minidumps.
*
* @return nsILocalFile of the minidump directory
*/
function do_get_minidumpdir() {
let env = Components.classes["@mozilla.org/process/environment;1"]
.getService(Components.interfaces.nsIEnvironment);
// the python harness may set this in the environment for us
let path = env.get("XPCSHELL_MINIDUMP_DIR");
if (path) {
let file = Components.classes["@mozilla.org/file/local;1"]
.createInstance(Components.interfaces.nsILocalFile);
file.initWithPath(path);
return file;
} else {
return do_get_tempdir();
}
}
/**
* Registers a directory with the profile service,
* and return the directory as an nsILocalFile.

View File

@ -139,10 +139,10 @@ class RemoteXPCShellTestThread(xpcshell.XPCShellTestThread):
symbols_path,
test_name=None):
with mozfile.TemporaryDirectory() as dumpDir:
self.device.getDirectory(self.remoteTmpDir, dumpDir)
self.device.getDirectory(self.remoteMinidumpDir, dumpDir)
crashed = xpcshell.XPCShellTestThread.checkForCrashes(self, dumpDir, symbols_path, test_name)
self.device.removeDir(self.remoteTmpDir)
self.device.mkDir(self.remoteTmpDir)
self.device.removeDir(self.remoteMinidumpDir)
self.device.mkDir(self.remoteMinidumpDir)
return crashed
def communicate(self, proc):
@ -210,6 +210,7 @@ class XPCShellRemote(xpcshell.XPCShellTests, object):
self.remoteScriptsDir = self.remoteTestRoot
self.remoteComponentsDir = remoteJoin(self.remoteTestRoot, "c")
self.remoteModulesDir = remoteJoin(self.remoteTestRoot, "m")
self.remoteMinidumpDir = remoteJoin(self.remoteTestRoot, "minidumps")
self.profileDir = remoteJoin(self.remoteTestRoot, "p")
self.remoteDebugger = options.debugger
self.remoteDebuggerArgs = options.debuggerArgs
@ -231,6 +232,7 @@ class XPCShellRemote(xpcshell.XPCShellTests, object):
self.setupUtilities()
self.setupModules()
self.setupTestDir()
self.setupMinidumpDir()
self.remoteAPK = None
if options.localAPK:
self.remoteAPK = remoteJoin(self.remoteBinDir, os.path.basename(options.localAPK))
@ -248,6 +250,7 @@ class XPCShellRemote(xpcshell.XPCShellTests, object):
'pathMapping': self.pathMapping,
'profileDir': self.profileDir,
'remoteTmpDir': self.remoteTmpDir,
'remoteMinidumpDir': self.remoteMinidumpDir,
}
if self.remoteAPK:
self.mobileArgs['remoteAPK'] = self.remoteAPK
@ -287,6 +290,7 @@ class XPCShellRemote(xpcshell.XPCShellTests, object):
self.env["TMPDIR"] = self.remoteTmpDir
self.env["HOME"] = self.profileDir
self.env["XPCSHELL_TEST_TEMP_DIR"] = self.remoteTmpDir
self.env["XPCSHELL_MINIDUMP_DIR"] = self.remoteMinidumpDir
if self.options.setup:
self.pushWrapper()
@ -413,6 +417,11 @@ class XPCShellRemote(xpcshell.XPCShellTests, object):
# Foopies have an older mozdevice ver without retryLimit
self.device.pushDir(self.xpcDir, self.remoteScriptsDir)
def setupMinidumpDir(self):
if self.device.dirExists(self.remoteMinidumpDir):
self.device.removeDir(self.remoteMinidumpDir)
self.device.mkDir(self.remoteMinidumpDir)
def buildTestList(self):
xpcshell.XPCShellTests.buildTestList(self)
uniqueTestPaths = set([])