Bug 1312739 - Use ALL_FLAVORS dict when running mochitest from an interactive loaner, r=jmaher
authorAndrew Halberstadt <ahalberstadt@mozilla.com>
Tue, 20 Dec 2016 11:24:33 -0500
changeset 327805 b5af607d2990cbd7d1ddbad75b3d1b427f3ec34c
parent 327804 7dbc513c553f5c8a3d59284ed97272728e04965c
child 327806 418194476bdd131ddcb679b527a637045bcea933
push id35576
push userahalberstadt@mozilla.com
push dateTue, 03 Jan 2017 15:30:08 +0000
treeherderautoland@b5af607d2990 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjmaher
bugs1312739
milestone53.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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',
         }