Bug 808764 - Set XPCOM_DEBUG_BREAK and other env vars in Android xpcshell tests; r=jmaher
--- a/testing/xpcshell/remotexpcshelltests.py
+++ b/testing/xpcshell/remotexpcshelltests.py
@@ -219,24 +219,18 @@ class XPCShellRemote(xpcshell.XPCShellTe
return self.profileDir
def logCommand(self, name, completeCmd, testdir):
self.log.info("TEST-INFO | %s | full command: %r" % (name, completeCmd))
self.log.info("TEST-INFO | %s | current directory: %r" % (name, self.remoteHere))
self.log.info("TEST-INFO | %s | environment: %s" % (name, self.env))
def setupLeakLogging(self):
- # Leak logging disabled on Android because it makes the command
- # line too long: bug 752126
-
- # filename = "leaks"
- # leakLogFile = self.remoteJoin(self.profileDir, filename)
- # self.env["XPCOM_MEM_LEAK_LOG"] = leakLogFile
- leakLogFile = ""
- return leakLogFile
+ self.env["XPCOM_MEM_LEAK_LOG"] = self.remoteJoin(self.profileDir, "leaks.log")
+ return self.env["XPCOM_MEM_LEAK_LOG"]
def setLD_LIBRARY_PATH(self, env):
env["LD_LIBRARY_PATH"]=self.remoteBinDir
def pushWrapper(self):
# Rather than executing xpcshell directly, this wrapper script is
# used. By setting environment variables and the cwd in the script,
# the length of the per-test command line is shortened. This is
@@ -255,16 +249,17 @@ class XPCShellRemote(xpcshell.XPCShellTe
f.close()
remoteWrapper = self.remoteJoin(self.remoteBinDir, "xpcw")
self.device.pushFile(localWrapper, remoteWrapper)
os.remove(localWrapper)
self.device.chmodDir(self.remoteBinDir)
def buildEnvironment(self):
self.env = {}
+ self.buildCoreEnvironment()
self.setLD_LIBRARY_PATH(self.env)
self.env["MOZ_LINKER_CACHE"]=self.remoteBinDir
if self.options.localAPK and self.appRoot:
self.env["GRE_HOME"]=self.appRoot
self.env["XPCSHELL_TEST_PROFILE_DIR"]=self.profileDir
self.env["TMPDIR"]=self.remoteTmpDir
self.env["HOME"]=self.profileDir
self.pushWrapper()
--- a/testing/xpcshell/runxpcshelltests.py
+++ b/testing/xpcshell/runxpcshelltests.py
@@ -116,30 +116,35 @@ class XPCShellTests(object):
if self.xrePath is None:
self.xrePath = os.path.dirname(self.xpcshell)
else:
self.xrePath = os.path.abspath(self.xrePath)
if self.mozInfo is None:
self.mozInfo = os.path.join(self.testharnessdir, "mozinfo.json")
- def buildEnvironment(self):
+ def buildCoreEnvironment(self):
"""
- Create and returns a dictionary of self.env to include all the appropriate env variables and values.
- On a remote system, we overload this to set different values and are missing things like os.environ and PATH.
+ Add environment variables likely to be used across all platforms, including remote systems.
"""
- self.env = dict(os.environ)
# Make assertions fatal
self.env["XPCOM_DEBUG_BREAK"] = "stack-and-abort"
# Don't launch the crash reporter client
self.env["MOZ_CRASHREPORTER_NO_REPORT"] = "1"
# Capturing backtraces is very slow on some platforms, and it's
# disabled by automation.py too
self.env["NS_TRACE_MALLOC_DISABLE_STACKS"] = "1"
+ def buildEnvironment(self):
+ """
+ Create and returns a dictionary of self.env to include all the appropriate env variables and values.
+ On a remote system, we overload this to set different values and are missing things like os.environ and PATH.
+ """
+ self.env = dict(os.environ)
+ self.buildCoreEnvironment()
if sys.platform == 'win32':
self.env["PATH"] = self.env["PATH"] + ";" + self.xrePath
elif sys.platform in ('os2emx', 'os2knix'):
os.environ["BEGINLIBPATH"] = self.xrePath + ";" + self.env["BEGINLIBPATH"]
os.environ["LIBPATHSTRICT"] = "T"
elif sys.platform == 'osx' or sys.platform == "darwin":
self.env["DYLD_LIBRARY_PATH"] = self.xrePath
else: # unix or linux?