bug 515436 - Electrolysis test runs need a special LD_LIBRARY_PATH. fix automation.py and various consumers to not overwrite LD_LIBRARY_PATH. r=bsmedberg
authorTed Mielczarek <ted.mielczarek@gmail.com>
Thu, 08 Oct 2009 14:10:47 -0400
changeset 33678 b65bcf3fa240c8f1538332471a671132bf0616ea
parent 33677 11450d26ff4dfc1066bb6c4a887331574856543f
child 33679 ccb86dc8e0da73064cf16018648377d1139dcdf8
push id9624
push usertmielczarek@mozilla.com
push dateThu, 08 Oct 2009 18:11:07 +0000
treeherdermozilla-central@ccb86dc8e0da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbsmedberg
bugs515436
milestone1.9.3a1pre
bug 515436 - Electrolysis test runs need a special LD_LIBRARY_PATH. fix automation.py and various consumers to not overwrite LD_LIBRARY_PATH. r=bsmedberg
build/automation.py.in
build/leaktest.py.in
build/pgo/profileserver.py.in
layout/tools/reftest/runreftest.py
testing/mochitest/runtests.py.in
--- a/build/automation.py.in
+++ b/build/automation.py.in
@@ -408,41 +408,44 @@ def environment(env = None, xrePath = DI
   if env == None:
     env = dict(os.environ)
 
   ldLibraryPath = os.path.abspath(os.path.join(SCRIPT_DIR, xrePath))
   if UNIXISH or IS_MAC:
     envVar = "LD_LIBRARY_PATH"
     if IS_MAC:
       envVar = "DYLD_LIBRARY_PATH"
+    else: # unixish
+      env['MOZILLA_FIVE_HOME'] = xrePath
     if envVar in env:
       ldLibraryPath = ldLibraryPath + ":" + env[envVar]
     env[envVar] = ldLibraryPath
   elif IS_WIN32:
     env["PATH"] = env["PATH"] + ";" + ldLibraryPath
 
   if crashreporter:
     env['MOZ_CRASHREPORTER_NO_REPORT'] = '1'
     env['MOZ_CRASHREPORTER'] = '1'
-
+  env['GNOME_DISABLE_CRASH_DIALOG'] = "1"
   return env
 
 
 ###############
 # RUN THE APP #
 ###############
 
 def runApp(testURL, env, app, profileDir, extraArgs,
            runSSLTunnel = False, utilityPath = DIST_BIN,
            xrePath = DIST_BIN, certPath = CERTS_SRC_DIR,
            debuggerInfo = None, symbolsPath = SYMBOLS_PATH):
   "Run the app, log the duration it took to execute, return the status code."
 
   # copy env so we don't munge the caller's environment
   env = dict(env);
+  env["NO_EM_RESTART"] = "1"
 
   if IS_TEST_BUILD and runSSLTunnel:
     # create certificate database for the profile
     certificateStatus = fillCertificateDB(profileDir, certPath, utilityPath, xrePath)
     if certificateStatus != 0:
       log.info("TEST-UNEXPECTED FAIL | automation.py | Certificate integration failed")
       return certificateStatus
 
--- a/build/leaktest.py.in
+++ b/build/leaktest.py.in
@@ -67,23 +67,17 @@ if __name__ == '__main__':
                                 "ONLY logging to stdout.")
 
     httpd = EasyServer(("", PORT), SimpleHTTPServer.SimpleHTTPRequestHandler)
     t = threading.Thread(target=httpd.serve_forever)
     t.setDaemon(True)
     t.start()
 
     automation.initializeProfile(PROFILE_DIRECTORY)
-    browserEnv = dict(os.environ)
+    browserEnv = automation.environment()
 
-    browserEnv["NO_EM_RESTART"] = "1"
     if not "XPCOM_DEBUG_BREAK" in browserEnv:
         browserEnv["XPCOM_DEBUG_BREAK"] = "stack"
-    if automation.UNIXISH:
-        browserEnv["LD_LIBRARY_PATH"] = os.path.join(SCRIPT_DIR, DIST_BIN)
-        browserEnv["MOZILLA_FIVE_HOME"] = os.path.join(SCRIPT_DIR, DIST_BIN)
-        browserEnv["GNOME_DISABLE_CRASH_DIALOG"] = "1"
-
     url = "http://localhost:%d/bloatcycle.html" % PORT
     appPath = os.path.join(SCRIPT_DIR, automation.DEFAULT_APP)
     status = automation.runApp(url, browserEnv, appPath, PROFILE_DIRECTORY,
                                extraArgs)
     sys.exit(status)
--- a/build/pgo/profileserver.py.in
+++ b/build/pgo/profileserver.py.in
@@ -58,22 +58,15 @@ class EasyServer(SocketServer.TCPServer)
 
 if __name__ == '__main__':
   httpd = EasyServer(("", PORT), SimpleHTTPServer.SimpleHTTPRequestHandler)
   t = threading.Thread(target=httpd.serve_forever)
   t.setDaemon(True) # don't hang on exit
   t.start()
 
   automation.initializeProfile(PROFILE_DIRECTORY)
-  browserEnv = dict(os.environ)
-
-  # These variables are necessary for correct application startup; change
-  # via the commandline at your own risk.
-  browserEnv["NO_EM_RESTART"] = "1"
+  browserEnv = automation.environment()
   browserEnv["XPCOM_DEBUG_BREAK"] = "warn"
-  if automation.UNIXISH:
-    browserEnv["LD_LIBRARY_PATH"] = os.path.join(SCRIPT_DIR, automation.DIST_BIN)
-    browserEnv["MOZILLA_FIVE_HOME"] = os.path.join(SCRIPT_DIR, automation.DIST_BIN)
 
   url = "http://localhost:%d/index.html" % PORT
   appPath = os.path.join(SCRIPT_DIR, automation.DEFAULT_APP)
   status = automation.runApp(url, browserEnv, appPath, PROFILE_DIRECTORY, {})
   sys.exit(status)
--- a/layout/tools/reftest/runreftest.py
+++ b/layout/tools/reftest/runreftest.py
@@ -127,27 +127,18 @@ Are you executing $objdir/_tests/reftest
 
   profileDir = None
   try:
     profileDir = mkdtemp()
     createReftestProfile(options, profileDir)
     copyExtraFilesToProfile(options, profileDir)
 
     # browser environment
-    browserEnv = dict(os.environ)
-
-    # These variables are necessary for correct application startup; change
-    # via the commandline at your own risk.
-    # NO_EM_RESTART: will do a '-silent' run instead.
-    browserEnv["NO_EM_RESTART"] = "1"
+    browserEnv = automation.environment(xrePath = options.xrePath)
     browserEnv["XPCOM_DEBUG_BREAK"] = "stack"
-    if automation.UNIXISH:
-      browserEnv["LD_LIBRARY_PATH"] = options.xrePath
-      browserEnv["MOZILLA_FIVE_HOME"] = options.xrePath
-      browserEnv["GNOME_DISABLE_CRASH_DIALOG"] = "1"
 
     # Enable leaks detection to its own log file.
     leakLogFile = os.path.join(profileDir, "runreftest_leaks.log")
     browserEnv["XPCOM_MEM_BLOAT_LOG"] = leakLogFile
 
     # run once with -silent to let the extension manager do its thing
     # and then exit the app
     automation.log.info("REFTEST INFO | runreftest.py | Performing extension manager registration: start.\n")
--- a/testing/mochitest/runtests.py.in
+++ b/testing/mochitest/runtests.py.in
@@ -278,24 +278,19 @@ class MochitestServer:
   def __init__(self, options):
     self._closeWhenDone = options.closeWhenDone
     self._utilityPath = options.utilityPath
     self._xrePath = options.xrePath
 
   def start(self):
     "Run the Mochitest server, returning the process ID of the server."
     
-    env = dict(os.environ)
-    if automation.UNIXISH:
-      env["LD_LIBRARY_PATH"] = self._xrePath
-      env["MOZILLA_FIVE_HOME"] = self._xrePath
-      env["XPCOM_DEBUG_BREAK"] = "warn"
-    elif automation.IS_MAC:
-      env["DYLD_LIBRARY_PATH"] = self._xrePath
-    elif automation.IS_WIN32:
+    env = automation.environment(xrePath = self._xrePath)
+    env["XPCOM_DEBUG_BREAK"] = "warn"
+    if automation.IS_WIN32:
       env["PATH"] = env["PATH"] + ";" + self._xrePath
 
     args = ["-g", self._xrePath,
             "-v", "170",
             "-f", "./" + "httpd.js",
             "-f", "./" + "server.js"]
 
     xpcshell = os.path.join(self._utilityPath,
@@ -413,28 +408,21 @@ Are you executing $objdir/_tests/testing
     }
 
     if options.debuggerArgs:
       debuggerInfo["args"] = options.debuggerArgs.split()
     if options.debuggerInteractive:
       debuggerInfo["interactive"] = options.debuggerInteractive
 
   # browser environment
-  browserEnv = dict(os.environ)
+  browserEnv = automation.environment(xrePath = options.xrePath)
 
   # These variables are necessary for correct application startup; change
   # via the commandline at your own risk.
-  # NO_EM_RESTART: will do a '-silent' run instead.
-  browserEnv["NO_EM_RESTART"] = "1"
   browserEnv["XPCOM_DEBUG_BREAK"] = "stack"
-  appDir = os.path.dirname(options.app)
-  if automation.UNIXISH:
-    browserEnv["LD_LIBRARY_PATH"] = appDir
-    browserEnv["MOZILLA_FIVE_HOME"] = appDir
-    browserEnv["GNOME_DISABLE_CRASH_DIALOG"] = "1"
 
   for v in options.environment:
     ix = v.find("=")
     if ix <= 0:
       print "Error: syntax error in --setenv=" + v
       sys.exit(1)
     browserEnv[v[:ix]] = v[ix + 1:]