Bug 1312739 - Use ALL_FLAVORS dict when running mochitest from an interactive loaner, r?jmaher draft
authorAndrew Halberstadt <ahalberstadt@mozilla.com>
Tue, 20 Dec 2016 11:24:33 -0500
changeset 454673 7b63c121b334cd4c506352264b005e3e5793f5b8
parent 454672 fa88870077bc85d7e1047e2dc120eed2dcb932dd
child 540771 d7c5adaf4afa114020ba47b199b76ae1e011debe
push id39997
push userahalberstadt@mozilla.com
push dateThu, 29 Dec 2016 22:27:12 +0000
reviewersjmaher
bugs1312739
milestone53.0a1
Bug 1312739 - Use ALL_FLAVORS dict when running mochitest from an interactive loaner, r?jmaher MozReview-Commit-ID: Kpxepe9KecV
testing/mochitest/mach_test_package_commands.py
testing/mochitest/mochitest_options.py
--- 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',
         }