Bug 1842773 - Part 18: Update TypedArray length, byteLength, and byteOffset accesses...
[gecko.git] / dom / bindings / mach_commands.py
blob6f6b29bcbfad5e234996160d1ed419211cb293fa
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
8 from mach.decorators import Command, CommandArgument
9 from mozbuild.util import mkdir
12 def get_test_parser():
13 import runtests
15 return runtests.get_parser
18 @Command(
19 "webidl-example",
20 category="misc",
21 description="Generate example files for a WebIDL interface.",
23 @CommandArgument(
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()
30 for i in interface:
31 manager.generate_example_files(i)
34 @Command(
35 "webidl-parser-test",
36 category="testing",
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
44 # an objdir yet.
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
57 # path.
58 sys.path.insert(0, command_context.topobjdir)
60 import runtests
62 return runtests.run_tests(kwargs["tests"], verbose=kwargs["verbose"])