mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 05:41:12 +00:00
Bug 1171602 - Run mochitest using mach from a tests.zip, r=chmanchester
--HG-- extra : commitid : 7UHH28yy81E extra : rebase_source : e6800f9d6ff6336991f1d4b8f2d975083b9f7751
This commit is contained in:
parent
42888ae5f5
commit
4cea585419
41
testing/mochitest/mach_test_package_commands.py
Normal file
41
testing/mochitest/mach_test_package_commands.py
Normal file
@ -0,0 +1,41 @@
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from argparse import Namespace
|
||||
import os
|
||||
|
||||
from mach.decorators import (
|
||||
CommandProvider,
|
||||
Command,
|
||||
)
|
||||
|
||||
|
||||
def run_mochitest(context, **kwargs):
|
||||
args = Namespace(**kwargs)
|
||||
args.certPath = context.certs_dir
|
||||
args.utilityPath = context.bin_dir
|
||||
args.extraProfileFiles.append(os.path.join(context.bin_dir, 'plugins'))
|
||||
|
||||
from runtests import run_test_harness
|
||||
return run_test_harness(args)
|
||||
|
||||
|
||||
def setup_argument_parser():
|
||||
from mochitest_options import MochitestArgumentParser
|
||||
return MochitestArgumentParser(app='generic')
|
||||
|
||||
|
||||
@CommandProvider
|
||||
class MochitestCommands(object):
|
||||
|
||||
def __init__(self, context):
|
||||
self.context = context
|
||||
|
||||
@Command('mochitest', category='testing',
|
||||
description='Run the mochitest harness.',
|
||||
parser=setup_argument_parser)
|
||||
def mochitest(self, **kwargs):
|
||||
return run_mochitest(self.context, **kwargs)
|
@ -77,7 +77,7 @@ class MochitestArguments(ArgumentContainer):
|
||||
"help": "Override the default binary used to run tests with the path provided, e.g "
|
||||
"/usr/bin/firefox. If you have run ./mach package beforehand, you can "
|
||||
"specify 'dist' to run tests against the distribution bundle's binary.",
|
||||
"suppress": True,
|
||||
"suppress": build_obj is not None,
|
||||
}],
|
||||
[["--utility-path"],
|
||||
{"dest": "utilityPath",
|
||||
@ -585,7 +585,9 @@ class MochitestArguments(ArgumentContainer):
|
||||
"could not find xre directory, --xre-path must be specified")
|
||||
|
||||
# allow relative paths
|
||||
options.xrePath = self.get_full_path(options.xrePath, parser.oldcwd)
|
||||
if options.xrePath:
|
||||
options.xrePath = self.get_full_path(options.xrePath, parser.oldcwd)
|
||||
|
||||
if options.profilePath:
|
||||
options.profilePath = self.get_full_path(options.profilePath, parser.oldcwd)
|
||||
|
||||
@ -1150,7 +1152,7 @@ container_map = {
|
||||
|
||||
class MochitestArgumentParser(ArgumentParser):
|
||||
"""
|
||||
Usage instructions for runtests.py.
|
||||
Usage instructions for Mochitest.
|
||||
|
||||
All arguments are optional.
|
||||
If --chrome is specified, chrome tests will be run instead of web content tests.
|
||||
|
@ -58,6 +58,7 @@ TEST_HARNESS_FILES.testing.mochitest += [
|
||||
'jetpack-addon-overlay.xul',
|
||||
'jetpack-package-harness.js',
|
||||
'jetpack-package-overlay.xul',
|
||||
'mach_test_package_commands.py',
|
||||
'manifest.webapp',
|
||||
'manifestLibrary.js',
|
||||
'mochitest_options.py',
|
||||
|
@ -11,11 +11,28 @@ import time
|
||||
|
||||
|
||||
SEARCH_PATHS = [
|
||||
'mochitest',
|
||||
'mozbase/mozcrash',
|
||||
'mozbase/mozdebug',
|
||||
'mozbase/mozdevice',
|
||||
'mozbase/mozfile',
|
||||
'mozbase/mozhttpd',
|
||||
'mozbase/mozlog',
|
||||
'mozbase/moznetwork',
|
||||
'mozbase/mozprocess',
|
||||
'mozbase/mozprofile',
|
||||
'mozbase/mozrunner',
|
||||
'mozbase/mozsystemmonitor',
|
||||
'mozbase/mozinfo',
|
||||
'mozbase/moztest',
|
||||
'mozbase/mozversion',
|
||||
'mozbase/manifestparser',
|
||||
'tools/mach',
|
||||
]
|
||||
|
||||
# Individual files providing mach commands.
|
||||
MACH_MODULES = [
|
||||
'mochitest/mach_test_package_commands.py',
|
||||
'tools/mach/mach/commands/commandinfo.py',
|
||||
]
|
||||
|
||||
@ -60,6 +77,10 @@ def bootstrap(test_package_root):
|
||||
import mach.main
|
||||
|
||||
def populate_context(context, key=None):
|
||||
context.package_root = test_package_root
|
||||
context.certs_dir = os.path.join(test_package_root, 'certs')
|
||||
context.bin_dir = os.path.join(test_package_root, 'bin')
|
||||
context.modules_dir = os.path.join(test_package_root, 'modules')
|
||||
return context
|
||||
|
||||
mach = mach.main.Mach(os.getcwd())
|
||||
|
Loading…
Reference in New Issue
Block a user