michael@0: # This Source Code Form is subject to the terms of the Mozilla Public michael@0: # License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: # file, You can obtain one at http://mozilla.org/MPL/2.0/. michael@0: michael@0: # Integrates the xpcshell test runner with mach. michael@0: michael@0: import os michael@0: import sys michael@0: michael@0: from mozbuild.base import ( michael@0: MachCommandBase, michael@0: MozbuildObject, michael@0: ) michael@0: michael@0: from mach.decorators import ( michael@0: CommandArgument, michael@0: CommandProvider, michael@0: Command, michael@0: ) michael@0: michael@0: class JetpackRunner(MozbuildObject): michael@0: """Run jetpack tests.""" michael@0: def run_tests(self, **kwargs): michael@0: self._run_make(target='jetpack-tests') michael@0: michael@0: @CommandProvider michael@0: class MachCommands(MachCommandBase): michael@0: @Command('jetpack-test', category='testing', michael@0: description='Runs the jetpack test suite.') michael@0: def run_jetpack_test(self, **params): michael@0: # We should probably have a utility function to ensure the tree is michael@0: # ready to run tests. Until then, we just create the state dir (in michael@0: # case the tree wasn't built with mach). michael@0: self._ensure_state_subdir_exists('.') michael@0: michael@0: jetpack = self._spawn(JetpackRunner) michael@0: michael@0: jetpack.run_tests(**params)