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/.
7 from argparse
import Namespace
8 from functools
import partial
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
22 args
.xpcshell
= os
.path
.join(args
.appPath
, "xpcshell")
24 log
= mozlog
.commandline
.setup_logging(
25 "XPCShellTests", args
, {"mach": sys
.stdout
}, {"verbose": True}
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
))
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
)