Bug 810617 - Pass browser app directory to xpcshell test harness. r=ted

This commit is contained in:
Jim Mathies 2012-11-30 15:14:27 -06:00
parent d75ca73e40
commit 69b84bb4b7
3 changed files with 22 additions and 0 deletions

View File

@ -39,6 +39,10 @@ def build_dict(env=os.environ):
# Widget toolkit, just pass the value directly through.
d["toolkit"] = env["MOZ_WIDGET_TOOLKIT"]
# Application name
if 'MOZ_APP_NAME' in env:
d["appname"] = env["MOZ_APP_NAME"]
# processor
p = env["TARGET_CPU"]
# for universal mac builds, put in a special value

View File

@ -8938,6 +8938,7 @@ MOZ_DEBUG=${MOZ_DEBUG} \
MOZ_WIDGET_TOOLKIT=${MOZ_WIDGET_TOOLKIT} \
UNIVERSAL_BINARY=${UNIVERSAL_BINARY} \
MOZ_CRASHREPORTER=${MOZ_CRASHREPORTER} \
MOZ_APP_NAME=${MOZ_APP_NAME} \
MOZ_PER_WINDOW_PRIVATE_BROWSING=${MOZ_PER_WINDOW_PRIVATE_BROWSING} \
$PYTHON ${_topsrcdir}/config/writemozinfo.py ./mozinfo.json.tmp
if cmp -s ./mozinfo.json.tmp ./mozinfo.json; then

View File

@ -730,6 +730,14 @@ class XPCShellTests(object):
self.mozInfo = parse_json(open(mozInfoFile).read())
mozinfo.update(self.mozInfo)
# The appDirKey is a optional entry in either the default or individual test
# sections that defines a relative application directory for test runs. If
# defined we pass 'grePath/$appDirKey' for the -a parameter of the xpcshell
# test harness.
appDirKey = None
if "appname" in self.mozInfo:
appDirKey = self.mozInfo["appname"] + "-appdir"
# We have to do this before we build the test list so we know whether or
# not to run tests that depend on having the node spdy server
self.trySetupNode()
@ -777,6 +785,15 @@ class XPCShellTests(object):
# Check for known-fail tests
expected = test['expected'] == 'pass'
# By default self.appPath will equal the gre dir. If specified in the
# xpcshell.ini file, set a different app dir for this test.
if appDirKey != None and appDirKey in test:
relAppDir = test[appDirKey]
relAppDir = os.path.join(self.xrePath, relAppDir)
self.appPath = os.path.abspath(relAppDir)
else:
self.appPath = None
testdir = os.path.dirname(name)
self.buildXpcsCmd(testdir)
testHeadFiles, testTailFiles = self.getHeadAndTailFiles(test)