bug 421611 - Need to be able to run tests on arbitrary build - add --xre-path argument to runreftest.py. r=bsmedberg
authorTed Mielczarek <ted.mielczarek@gmail.com>
Sat, 21 Mar 2009 11:21:07 -0400
changeset 23957 917aa449b42e877645f3a543b30dbe36da1165e0
parent 23956 fd94b9aed9b469154212fe01e2de649898cea9bd
child 23958 386b3b40aaef440cd9cdd752c887d896eca32b3b
push id1004
push usertmielczarek@mozilla.com
push dateFri, 27 Mar 2009 13:23:22 +0000
reviewersbsmedberg
bugs421611
milestone1.9.1b4pre
bug 421611 - Need to be able to run tests on arbitrary build - add --xre-path argument to runreftest.py. r=bsmedberg
layout/tools/reftest/runreftest.py
--- a/layout/tools/reftest/runreftest.py
+++ b/layout/tools/reftest/runreftest.py
@@ -75,16 +75,20 @@ def createReftestProfile(profileDir):
   extFile.close()
 
 def main():
   parser = OptionParser()
   parser.add_option("--appname",
                     action = "store", type = "string", dest = "app",
                     default = os.path.join(SCRIPT_DIRECTORY, automation.DEFAULT_APP),
                     help = "absolute path to application, overriding default")
+  parser.add_option("--xre-path",
+                    action = "store", type = "string", dest = "xrePath",
+                    default = None, # default is set below
+                    help = "absolute path to directory containing XRE (probably xulrunner)")
   parser.add_option("--extra-profile-file",
                     action = "append", dest = "extraProfileFiles",
                     default = [],
                     help = "copy specified files/dirs to testing profile")
   parser.add_option("--symbols-path",
                     action = "store", type = "string", dest = "symbolsPath",
                     default = automation.SYMBOLS_PATH,
                     help = "absolute path to directory containing breakpad symbols")
@@ -96,33 +100,38 @@ def main():
 
   options.app = getFullPath(options.app)
   if not os.path.exists(options.app):
     print """Error: Path %(app)s doesn't exist.
 Are you executing $objdir/_tests/reftest/runreftest.py?""" \
         % {"app": options.app}
     sys.exit(1)
 
+  if options.xrePath is None:
+    options.xrePath = os.path.dirname(options.app)
+  else:
+    # allow relative paths
+    options.xrePath = getFullPath(options.xrePath)
+
   profileDir = None
   try:
     profileDir = mkdtemp()
     createReftestProfile(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.
     browserEnv["NO_EM_RESTART"] = "1"
     browserEnv["XPCOM_DEBUG_BREAK"] = "warn"
-    appDir = os.path.dirname(options.app)
     if automation.UNIXISH:
-      browserEnv["LD_LIBRARY_PATH"] = appDir
-      browserEnv["MOZILLA_FIVE_HOME"] = appDir
+      browserEnv["LD_LIBRARY_PATH"] = options.xrePath
+      browserEnv["MOZILLA_FIVE_HOME"] = options.xrePath
       browserEnv["GNOME_DISABLE_CRASH_DIALOG"] = "1"
 
     # Retrieve the logger where to report the leaks to.
     log = logging.getLogger()
 
     # Enable leaks (only) detection to its own log file.
     leakLogFile = os.path.join(profileDir, "runreftest_leaks.log")
     browserEnv["XPCOM_MEM_LEAK_LOG"] = leakLogFile