1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/addon-sdk/mach_commands.py Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,38 @@ 1.4 +# This Source Code Form is subject to the terms of the Mozilla Public 1.5 +# License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 +# file, You can obtain one at http://mozilla.org/MPL/2.0/. 1.7 + 1.8 +# Integrates the xpcshell test runner with mach. 1.9 + 1.10 +import os 1.11 +import sys 1.12 + 1.13 +from mozbuild.base import ( 1.14 + MachCommandBase, 1.15 + MozbuildObject, 1.16 +) 1.17 + 1.18 +from mach.decorators import ( 1.19 + CommandArgument, 1.20 + CommandProvider, 1.21 + Command, 1.22 +) 1.23 + 1.24 +class JetpackRunner(MozbuildObject): 1.25 + """Run jetpack tests.""" 1.26 + def run_tests(self, **kwargs): 1.27 + self._run_make(target='jetpack-tests') 1.28 + 1.29 +@CommandProvider 1.30 +class MachCommands(MachCommandBase): 1.31 + @Command('jetpack-test', category='testing', 1.32 + description='Runs the jetpack test suite.') 1.33 + def run_jetpack_test(self, **params): 1.34 + # We should probably have a utility function to ensure the tree is 1.35 + # ready to run tests. Until then, we just create the state dir (in 1.36 + # case the tree wasn't built with mach). 1.37 + self._ensure_state_subdir_exists('.') 1.38 + 1.39 + jetpack = self._spawn(JetpackRunner) 1.40 + 1.41 + jetpack.run_tests(**params)