Bug 671562 - Allow to pass an application directory to xpcshell tests. r=ted
authorMike Hommey <mh+mozilla@glandium.org>
Fri, 22 Jul 2011 08:48:01 +0200
changeset 73186 6fa75d9287a788c34e619e03fdfe88605cd15090
parent 73185 631c9b13ec1dfb2d09a23594f9de13a484ed96a4
child 73187 c3906fd66ba0ed354db7c8c81864d1f5dc5f2c44
push id706
push usermh@glandium.org
push dateFri, 22 Jul 2011 06:49:39 +0000
treeherdermozilla-inbound@c3906fd66ba0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 671562 - Allow to pass an application directory to xpcshell tests. r=ted
--- a/testing/xpcshell/runxpcshelltests.py
+++ b/testing/xpcshell/runxpcshelltests.py
@@ -215,17 +215,19 @@ class XPCShellTests(object):
   def buildXpcsCmd(self, testdir):
       Load the root head.js file as the first file in our test path, before other head, test, and tail files.
       On a remote system, we overload this to add additional command line arguments, so this gets overloaded.
     # - NOTE: if you rename/add any of the constants set here, update
     #   do_load_child_test_harness() in head.js
-    self.xpcsCmd = [self.xpcshell, '-g', self.xrePath, '-r', self.httpdManifest, '-j', '-s'] + \
+    if not self.appPath:
+        self.appPath = self.xrePath
+    self.xpcsCmd = [self.xpcshell, '-g', self.xrePath, '-a', self.appPath, '-r', self.httpdManifest, '-j', '-s'] + \
         ['-e', 'const _HTTPD_JS_PATH = "%s";' % self.httpdJSPath,
          '-e', 'const _HEAD_JS_PATH = "%s";' % self.headJSPath,
          '-f', os.path.join(self.testharnessdir, 'head.js')]
     if self.debuggerInfo:
       self.xpcsCmd = [self.debuggerInfo["path"]] + self.debuggerInfo["args"] + self.xpcsCmd
   def buildTestPath(self):
@@ -374,26 +376,27 @@ class XPCShellTests(object):
                    for f in headfiles])
     cmdT = ", ".join(['"' + replaceBackSlashes(f) + '"'
                    for f in tailfiles])
     return xpcscmd + \
             ['-e', 'const _SERVER_ADDR = "localhost"',
              '-e', 'const _HEAD_FILES = [%s];' % cmdH,
              '-e', 'const _TAIL_FILES = [%s];' % cmdT]
-  def runTests(self, xpcshell, xrePath=None, symbolsPath=None,
+  def runTests(self, xpcshell, xrePath=None, appPath=None, symbolsPath=None,
                manifest=None, testdirs=[], testPath=None,
                interactive=False, verbose=False, keepGoing=False, logfiles=True,
                thisChunk=1, totalChunks=1, debugger=None,
                debuggerArgs=None, debuggerInteractive=False,
                profileName=None, mozInfo=None):
     """Run xpcshell tests.
     |xpcshell|, is the xpcshell executable to use to run the tests.
     |xrePath|, if provided, is the path to the XRE to use.
+    |appPath|, if provided, is the path to an application directory.
     |symbolsPath|, if provided is the path to a directory containing
       breakpad symbols for processing crashes in tests.
     |manifest|, if provided, is a file containing a list of
       test directories to run.
     |testdirs|, if provided, is a list of absolute paths of test directories.
       No-manifest only option.
     |testPath|, if provided, indicates a single path and/or test to run.
     |interactive|, if set to True, indicates to provide an xpcshell prompt
@@ -408,16 +411,17 @@ class XPCShellTests(object):
       directory if running only a subset of tests.
     |mozInfo|, if set, specifies specifies build configuration information, either as a filename containing JSON, or a dict.
     global gotSIGINT 
     self.xpcshell = xpcshell
     self.xrePath = xrePath
+    self.appPath = appPath
     self.symbolsPath = symbolsPath
     self.manifest = manifest
     self.testdirs = testdirs
     self.testPath = testPath
     self.interactive = interactive
     self.verbose = verbose
     self.keepGoing = keepGoing
     self.logfiles = logfiles
@@ -572,16 +576,19 @@ INFO | Todo: %d""" % (self.passCount, se
     return self.failCount == 0
 class XPCShellOptions(OptionParser):
   def __init__(self):
     """Process command line arguments and call runTests() to do the real work."""
+    self.add_option("--app-path",
+                    type="string", dest="appPath", default=None,
+                    help="application directory (as opposed to XRE directory)")
                     action="store_true", dest="interactive", default=False,
                     help="don't automatically run tests, drop to an xpcshell prompt")
                     action="store_true", dest="verbose", default=False,
                     help="always print stdout and stderr from tests")
                     action="store_true", dest="keepGoing", default=False,