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/.
8 from mach
.decorators
import Command
, CommandArgument
9 from mozbuild
.util
import mkdir
12 def get_test_parser():
15 return runtests
.get_parser
21 description
="Generate example files for a WebIDL interface.",
24 "interface", nargs
="+", help="Interface(s) whose examples to generate."
26 def webidl_example(command_context
, interface
):
27 from mozwebidlcodegen
import create_build_system_manager
29 manager
= create_build_system_manager()
31 manager
.generate_example_files(i
)
37 parser
=get_test_parser
,
38 description
="Run WebIDL tests (Interface Browser parser).",
40 def webidl_test(command_context
, **kwargs
):
41 sys
.path
.insert(0, os
.path
.join(command_context
.topsrcdir
, "other-licenses", "ply"))
43 # Ensure the topobjdir exists. On a Taskcluster test run there won't be
45 mkdir(command_context
.topobjdir
)
47 # Make sure we drop our cached grammar bits in the objdir, not
48 # wherever we happen to be running from.
49 os
.chdir(command_context
.topobjdir
)
51 if kwargs
["verbose"] is None:
52 kwargs
["verbose"] = False
54 # Now we're going to create the cached grammar file in the
55 # objdir. But we're going to try loading it as a python
56 # module, so we need to make sure the objdir is in our search
58 sys
.path
.insert(0, command_context
.topobjdir
)
62 return runtests
.run_tests(kwargs
["tests"], verbose
=kwargs
["verbose"])