addon-sdk/mach_commands.py
author Ed Morley <emorley@mozilla.com>
Thu, 25 Apr 2013 13:41:17 +0100
changeset 129860 b49b5f42be79bf9290a0beca397e4ec7fbe054f4
parent 122390 18fa6e840300a79004c0c87108de235efffcc245
child 131325 dac8cb02fd216d408a9da4329b9d0ee1cb940b7a
permissions -rw-r--r--
Bug 863091 - Make auto clobbering opt-in rather than opt-out; r=glandium To avoid surprises for devs building locally, auto clobbering is now opt-in, via the use of |mk_add_options AUTOCLOBBER=1| in the mozconfig. Our automation uses build/mozconfig.common which specifies this, so auto clobber will remain enabled for our buildbot machines.

# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

# Integrates the xpcshell test runner with mach.

import os
import sys

from mozbuild.base import (
    MachCommandBase,
    MozbuildObject,
)

from mach.decorators import (
    CommandArgument,
    CommandProvider,
    Command,
)

class JetpackRunner(MozbuildObject):
    """Run jetpack tests."""
    def run_tests(self, **kwargs):
        self._run_make(target='jetpack-tests')

@CommandProvider
class MachCommands(MachCommandBase):
    @Command('jetpack-test', help='Runs the jetpack test suite.')
    def run_jetpack_test(self, **params):
        # We should probably have a utility function to ensure the tree is
        # ready to run tests. Until then, we just create the state dir (in
        # case the tree wasn't built with mach).
        self._ensure_state_subdir_exists('.')

        jetpack = self._spawn(JetpackRunner)

        jetpack.run_tests(**params)