Bug 748490 - Part 2: Register testing modules with xpcshell test runner; r=ted

This commit is contained in:
Gregory Szorc
2012-05-10 10:10:14 -07:00
parent 833e0eb96e
commit d1e47e3825
5 changed files with 60 additions and 10 deletions

View File

@@ -222,10 +222,26 @@ class XPCShellTests(object):
# do_load_child_test_harness() in head.js
if not self.appPath:
self.appPath = self.xrePath
self.xpcsCmd = [self.xpcshell, '-g', self.xrePath, '-a', self.appPath, '-r', self.httpdManifest, '-m', '-n', '-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')]
self.xpcsCmd = [
self.xpcshell,
'-g', self.xrePath,
'-a', self.appPath,
'-r', self.httpdManifest,
'-m',
'-n',
'-s',
'-e', 'const _HTTPD_JS_PATH = "%s";' % self.httpdJSPath,
'-e', 'const _HEAD_JS_PATH = "%s";' % self.headJSPath
]
if self.testingModulesDir is not None:
self.xpcsCmd.extend([
'-e',
'const _TESTING_MODULES_DIR = "%s";' % self.testingModulesDir
])
self.xpcsCmd.extend(['-f', os.path.join(self.testharnessdir, 'head.js')])
if self.debuggerInfo:
self.xpcsCmd = [self.debuggerInfo["path"]] + self.debuggerInfo["args"] + self.xpcsCmd
@@ -553,7 +569,7 @@ class XPCShellTests(object):
debuggerArgs=None, debuggerInteractive=False,
profileName=None, mozInfo=None, shuffle=False,
testsRootDir=None, xunitFilename=None, xunitName=None,
**otherOptions):
testingModulesDir=None, **otherOptions):
"""Run xpcshell tests.
|xpcshell|, is the xpcshell executable to use to run the tests.
@@ -584,6 +600,8 @@ class XPCShellTests(object):
results.
|xunitName|, if outputting an xUnit XML file, the str value to use for the
testsuite name.
|testingModulesDir|, if provided, specifies where JS modules reside.
xpcshell will register a resource handler mapping this path.
|otherOptions| may be present for the convenience of subclasses
"""
@@ -603,6 +621,10 @@ class XPCShellTests(object):
raise Exception("testsRootDir path does not exists: %s" %
testsRootDir)
if testingModulesDir is not None:
if not os.path.isabs(testingModulesDir):
testingModulesDir = os.path.abspath(testingModulesDir)
self.xpcshell = xpcshell
self.xrePath = xrePath
self.appPath = appPath
@@ -619,6 +641,7 @@ class XPCShellTests(object):
self.debuggerInfo = getDebuggerInfo(self.oldcwd, debugger, debuggerArgs, debuggerInteractive)
self.profileName = profileName or "xpcshell"
self.mozInfo = mozInfo
self.testingModulesDir = testingModulesDir
# If we have an interactive debugger, disable ctrl-c.
if self.debuggerInfo and self.debuggerInfo["interactive"]:
@@ -877,6 +900,9 @@ class XPCShellOptions(OptionParser):
self.add_option("--tests-root-dir",
type="string", dest="testsRootDir", default=None,
help="absolute path to directory where all tests are located. this is typically $(objdir)/_tests")
self.add_option("--tests-modules-dir",
dest="testingModulesDir", default=None,
help="Directory where testing modules are located.")
self.add_option("--total-chunks",
type = "int", dest = "totalChunks", default=1,
help = "how many chunks to split the tests up into")