Bug 1755973 - Try implied arr+[0] in GetUniformIndices. r=gfx-reviewers,bradwerth
[gecko.git] / testing / xpcshell / mach_test_package_commands.py
blob89c9deb8b2794956c19c0f1ddd0e0699ac50c2b4
1 # This Source Code Form is subject to the terms of the Mozilla Public
2 # License, v. 2.0. If a copy of the MPL was not distributed with this
3 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
5 from __future__ import absolute_import, unicode_literals
7 import os
8 import sys
9 from argparse import Namespace
10 from functools import partial
13 import mozlog
14 from xpcshellcommandline import parser_desktop
16 from mach.decorators import (
17 Command,
21 def run_xpcshell(context, **kwargs):
22 args = Namespace(**kwargs)
23 args.appPath = args.appPath or os.path.dirname(context.firefox_bin)
24 args.utility_path = context.bin_dir
25 args.testingModulesDir = context.modules_dir
27 if not args.xpcshell:
28 args.xpcshell = os.path.join(args.appPath, "xpcshell")
30 if not args.pluginsPath:
31 for path in context.ancestors(args.appPath, depth=2):
32 test = os.path.join(path, "plugins")
33 if os.path.isdir(test):
34 args.pluginsPath = test
35 break
37 log = mozlog.commandline.setup_logging(
38 "XPCShellTests", args, {"mach": sys.stdout}, {"verbose": True}
41 if args.testPaths:
42 test_root = os.path.join(context.package_root, "xpcshell", "tests")
43 normalize = partial(context.normalize_test_path, test_root)
44 # pylint --py3k: W1636
45 args.testPaths = list(map(normalize, args.testPaths))
47 import runxpcshelltests
49 xpcshell = runxpcshelltests.XPCShellTests(log=log)
50 return xpcshell.runTests(**vars(args))
53 @Command(
54 "xpcshell-test",
55 category="testing",
56 description="Run the xpcshell harness.",
57 parser=parser_desktop,
59 def xpcshell(command_context, **kwargs):
60 command_context._mach_context.activate_mozharness_venv()
61 return run_xpcshell(command_context._mach_context, **kwargs)