Bug 1312739 - Use ALL_FLAVORS dict when running mochitest from an interactive loaner, r?jmaher
MozReview-Commit-ID: Kpxepe9KecV
--- a/testing/mochitest/mach_test_package_commands.py
+++ b/testing/mochitest/mach_test_package_commands.py
@@ -13,22 +13,33 @@ from mach.decorators import (
Command,
)
here = os.path.abspath(os.path.dirname(__file__))
parser = None
def run_mochitest(context, **kwargs):
+ from mochitest_options import ALL_FLAVORS
+ flavor = kwargs.get('flavor') or 'mochitest'
+ if flavor not in ALL_FLAVORS:
+ for fname, fobj in ALL_FLAVORS.iteritems():
+ if flavor in fobj['aliases']:
+ flavor = fname
+ break
+ fobj = ALL_FLAVORS[flavor]
+ kwargs.update(fobj.get('extra_args', {}))
+
args = Namespace(**kwargs)
args.e10s = context.mozharness_config.get('e10s', args.e10s)
args.certPath = context.certs_dir
if args.test_paths:
- test_root = os.path.join(context.package_root, 'mochitest', 'tests')
+ install_subdir = fobj.get('install_subdir', fobj['suite'])
+ test_root = os.path.join(context.package_root, 'mochitest', install_subdir)
normalize = partial(context.normalize_test_path, test_root)
args.test_paths = map(normalize, args.test_paths)
import mozinfo
if mozinfo.info.get('buildapp') == 'mobile/android':
return run_mochitest_android(context, args)
return run_mochitest_desktop(context, args)
--- a/testing/mochitest/mochitest_options.py
+++ b/testing/mochitest/mochitest_options.py
@@ -34,17 +34,18 @@ except ImportError:
# Maps test flavors to data needed to run them
ALL_FLAVORS = {
'mochitest': {
'suite': 'plain',
'aliases': ('plain', 'mochitest'),
'enabled_apps': ('firefox', 'android'),
'extra_args': {
'flavor': 'plain',
- }
+ },
+ 'install_subdir': 'tests',
},
'chrome': {
'suite': 'chrome',
'aliases': ('chrome', 'mochitest-chrome'),
'enabled_apps': ('firefox', 'android'),
'extra_args': {
'flavor': 'chrome',
}