Backed out changeset 3fc04d8eb32b (bug 1659763) for frame checker crashes. a=backout
[gecko.git] / testing / xpcshell / mach_test_package_commands.py
blob0e882435d8ed130e1cbc2f81f682a33a8d9c519f
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 import os
6 import sys
7 from argparse import Namespace
8 from functools import partial
10 import mozlog
11 from mach.decorators import Command
12 from xpcshellcommandline import parser_desktop
15 def run_xpcshell(context, **kwargs):
16 args = Namespace(**kwargs)
17 args.appPath = args.appPath or os.path.dirname(context.firefox_bin)
18 args.utility_path = context.bin_dir
19 args.testingModulesDir = context.modules_dir
21 if not args.xpcshell:
22 args.xpcshell = os.path.join(args.appPath, "xpcshell")
24 log = mozlog.commandline.setup_logging(
25 "XPCShellTests", args, {"mach": sys.stdout}, {"verbose": True}
28 if args.testPaths:
29 test_root = os.path.join(context.package_root, "xpcshell", "tests")
30 normalize = partial(context.normalize_test_path, test_root)
31 # pylint --py3k: W1636
32 args.testPaths = list(map(normalize, args.testPaths))
34 import runxpcshelltests
36 xpcshell = runxpcshelltests.XPCShellTests(log=log)
37 return xpcshell.runTests(**vars(args))
40 @Command(
41 "xpcshell-test",
42 category="testing",
43 description="Run the xpcshell harness.",
44 parser=parser_desktop,
46 def xpcshell(command_context, **kwargs):
47 command_context._mach_context.activate_mozharness_venv()
48 return run_xpcshell(command_context._mach_context, **kwargs)