Skip to content

Commit

Permalink
Bug 1462489 - Use test addons from dist/xpi-stage when running mochit…
Browse files Browse the repository at this point in the history
…ests locally. r=ahal

MozReview-Commit-ID: IoaxxjtJLhX

--HG--
extra : rebase_source : 39c461649eca73f104b7f7954aa9420048818d58
  • Loading branch information
chmanchester committed May 30, 2018
1 parent a5459b4 commit 4690df6
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 12 deletions.
11 changes: 11 additions & 0 deletions testing/mochitest/mochitest_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,18 @@ def validate(self, parser, options, context):
options.testingModulesDir = p
break

# Paths to specialpowers and mochijar from the tests zip.
options.stagedAddons = [
os.path.join(here, 'extensions', 'specialpowers'),
os.path.join(here, 'mochijar'),
]
if build_obj:
objdir_xpi_stage = os.path.join(build_obj.distdir, 'xpi-stage')
if os.path.isdir(objdir_xpi_stage):
options.stagedAddons = [
os.path.join(objdir_xpi_stage, 'specialpowers'),
os.path.join(objdir_xpi_stage, 'mochijar'),
]
plugins_dir = os.path.join(build_obj.distdir, 'plugins')
if os.path.isdir(plugins_dir) and plugins_dir not in options.extraProfileFiles:
options.extraProfileFiles.append(plugins_dir)
Expand Down
24 changes: 12 additions & 12 deletions testing/mochitest/runtests.py
Original file line number Diff line number Diff line change
Expand Up @@ -838,7 +838,6 @@ class MochitestDesktop(object):
Mochitest class for desktop firefox.
"""
oldcwd = os.getcwd()
mochijar = os.path.join(SCRIPT_DIR, 'mochijar')

# Path to the test script on the server
TEST_PATH = "tests"
Expand All @@ -856,9 +855,10 @@ class MochitestDesktop(object):
# TODO: replace this with 'runtests.py' or 'mochitest' or the like
test_name = 'automation.py'

def __init__(self, flavor, logger_options, quiet=False):
def __init__(self, flavor, logger_options, staged_addons=None, quiet=False):
update_mozinfo()
self.flavor = flavor
self.staged_addons = staged_addons
self.server = None
self.wsserver = None
self.websocketProcessBridge = None
Expand Down Expand Up @@ -1321,11 +1321,6 @@ def addChromeToProfile(self, options):

manifest = self.writeChromeManifest(options)

if not os.path.isdir(self.mochijar):
self.log.error(
"TEST-UNEXPECTED-FAIL | invalid setup: missing mochikit extension")
return None

return manifest

def getExtensionsToInstall(self, options):
Expand Down Expand Up @@ -2258,10 +2253,14 @@ def timeoutHandler():
# install specialpowers and mochikit addons
addons = Addons(self.marionette)

addons.install(create_zip(
os.path.join(here, 'extensions', 'specialpowers')
))
addons.install(create_zip(self.mochijar))
if self.staged_addons:
for addon_path in self.staged_addons:
if not os.path.isdir(addon_path):
self.log.error(
"TEST-UNEXPECTED-FAIL | invalid setup: missing extension at %s" %
addon_path)
return 1, self.lastTestSeen
addons.install(create_zip(addon_path))

self.execute_start_script()

Expand Down Expand Up @@ -3066,7 +3065,8 @@ def run_test_harness(parser, options):
key: value for key, value in vars(options).iteritems()
if key.startswith('log') or key == 'valgrind'}

runner = MochitestDesktop(options.flavor, logger_options, quiet=options.quiet)
runner = MochitestDesktop(options.flavor, logger_options, options.stagedAddons,
quiet=options.quiet)

if hasattr(options, 'log'):
delattr(options, 'log')
Expand Down

0 comments on commit 4690df6

Please sign in to comment.