Bug 1691109 [wpt PR 27513] - Increase timeout duration for wpt/fetch/api/basic/keepal...
[gecko.git] / dom / bindings / mach_commands.py
blob28d278015691a6387d0397d6a7623cda9b57f91a
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
10 from mach.decorators import (
11 CommandArgument,
12 CommandProvider,
13 Command,
16 from mozbuild.base import MachCommandBase
17 from mozbuild.util import mkdir
20 def get_test_parser():
21 import runtests
23 return runtests.get_parser
26 @CommandProvider
27 class WebIDLProvider(MachCommandBase):
28 @Command(
29 "webidl-example",
30 category="misc",
31 description="Generate example files for a WebIDL interface.",
33 @CommandArgument(
34 "interface", nargs="+", help="Interface(s) whose examples to generate."
36 def webidl_example(self, interface):
37 from mozwebidlcodegen import BuildSystemWebIDL
39 manager = self._spawn(BuildSystemWebIDL).manager
40 for i in interface:
41 manager.generate_example_files(i)
43 @Command(
44 "webidl-parser-test",
45 category="testing",
46 parser=get_test_parser,
47 description="Run WebIDL tests (Interface Browser parser).",
49 def webidl_test(self, **kwargs):
50 sys.path.insert(0, os.path.join(self.topsrcdir, "other-licenses", "ply"))
52 # Ensure the topobjdir exists. On a Taskcluster test run there won't be
53 # an objdir yet.
54 mkdir(self.topobjdir)
56 # Make sure we drop our cached grammar bits in the objdir, not
57 # wherever we happen to be running from.
58 os.chdir(self.topobjdir)
60 if kwargs["verbose"] is None:
61 kwargs["verbose"] = False
63 # Now we're going to create the cached grammar file in the
64 # objdir. But we're going to try loading it as a python
65 # module, so we need to make sure the objdir is in our search
66 # path.
67 sys.path.insert(0, self.topobjdir)
69 import runtests
71 return runtests.run_tests(kwargs["tests"], verbose=kwargs["verbose"])