def run_marionette(tests, b2g_path=None, emulator=None, testtype=None,
    address=None, bin=None, topsrcdir=None):
    from marionette.runtests import (
        MarionetteTestRunner,
        BaseMarionetteOptions,
        startTestRunner
    )

    parser = BaseMarionetteOptions()
    options, args = parser.parse_args()

    if not tests:
        tests = [os.path.join(topsrcdir,
                    'testing/marionette/client/marionette/tests/unit-tests.ini')]

    options.type = testtype
    if b2g_path:
        options.homedir = b2g_path
        if emulator:
            options.emulator = emulator
    else:
        options.bin = bin
        path, exe = os.path.split(options.bin)

    options.address = address

    parser.verify_usage(options, tests)

    runner = startTestRunner(MarionetteTestRunner, options, tests)
    if runner.failed > 0:
        return 1

    return 0
Beispiel #2
0
    def run_marionette(self,
                       tests,
                       emulator=None,
                       address=None,
                       b2g_path=None,
                       testtype=None):
        from marionette.runtests import (MarionetteTestRunner,
                                         MarionetteTestOptions,
                                         startTestRunner)

        parser = MarionetteTestOptions()
        options, args = parser.parse_args()

        if not tests:
            tests = [
                'testing/marionette/client/marionette/tests/unit-tests.ini'
            ]

        options.type = testtype
        if emulator:
            if b2g_path:
                options.homedir = b2g_path
            if not testtype:
                options.type = "b2g"
        else:
            if not testtype:
                options.type = "browser"
            try:
                bin = self.get_binary_path('app')
                options.bin = bin
            except Exception as e:
                print("It looks like your program isn't built.",
                      "You can run |mach build| to build it.")
                print(e)
                return 1
            path, exe = os.path.split(options.bin)
            if 'b2g' in exe:
                options.app = 'b2gdesktop'

        if not emulator:
            if self.substs.get('ENABLE_MARIONETTE') != '1':
                print("Marionette doesn't appear to be enabled; please "
                      "add ENABLE_MARIONETTE=1 to your mozconfig and "
                      "perform a clobber build.")
                return 1

        options.address = address

        parser.verify_usage(options, tests)

        runner = startTestRunner(MarionetteTestRunner, options, tests)
        if runner.failed > 0:
            return 1

        return 0
Beispiel #3
0
    def run_marionette(self, tests, emulator=None, address=None, b2g_path=None,
            testtype=None):
        from marionette.runtests import (
            MarionetteTestRunner,
            MarionetteTestOptions,
            startTestRunner
        )

        parser = MarionetteTestOptions()
        options, args = parser.parse_args()

        if not tests:
            tests = ['testing/marionette/client/marionette/tests/unit-tests.ini']

        options.type = testtype
        if emulator:
            if b2g_path:
                options.homedir = b2g_path
            if not testtype:
                options.type = "b2g"
        else:
            if not testtype:
                options.type = "browser"
            try:
                bin = self.get_binary_path('app')
                options.bin = bin
            except Exception as e:
                print("It looks like your program isn't built.",
                      "You can run |mach build| to build it.")
                print(e)
                return 1
            path, exe = os.path.split(options.bin)
            if 'b2g' in exe:
                options.app = 'b2gdesktop'

        if not emulator:
            if self.substs.get('ENABLE_MARIONETTE') != '1':
                print("Marionette doesn't appear to be enabled; please "
                      "add ENABLE_MARIONETTE=1 to your mozconfig and "
                      "perform a clobber build.")
                return 1

        options.address = address

        parser.verify_usage(options, tests)

        runner = startTestRunner(MarionetteTestRunner, options, tests)
        if runner.failed > 0:
            return 1

        return 0
Beispiel #4
0
def run_marionette(tests,
                   b2g_path=None,
                   emulator=None,
                   testtype=None,
                   address=None,
                   binary=None,
                   topsrcdir=None,
                   **kwargs):

    from marionette.runtests import (MarionetteTestRunner,
                                     BaseMarionetteArguments, startTestRunner)

    parser = BaseMarionetteArguments()
    commandline.add_logging_group(parser)
    args = parser.parse_args()

    if not tests:
        tests = [
            os.path.join(
                topsrcdir,
                'testing/marionette/client/marionette/tests/unit-tests.ini')
        ]
    args.tests = tests

    if b2g_path:
        args.homedir = b2g_path
        if emulator:
            args.emulator = emulator
    else:
        args.binary = binary
        path, exe = os.path.split(args.binary)

    for k, v in kwargs.iteritems():
        setattr(args, k, v)

    parser.verify_usage(args)

    args.logger = commandline.setup_logging("Marionette Unit Tests", args,
                                            {"mach": sys.stdout})

    runner = startTestRunner(MarionetteTestRunner, args)
    if runner.failed > 0:
        return 1

    return 0
Beispiel #5
0
def run_marionette(tests,
                   b2g_path=None,
                   emulator=None,
                   testtype=None,
                   address=None,
                   binary=None,
                   topsrcdir=None,
                   **kwargs):
    from marionette.runtests import (MarionetteTestRunner,
                                     BaseMarionetteOptions, startTestRunner)

    parser = BaseMarionetteOptions()
    commandline.add_logging_group(parser)
    options, args = parser.parse_args()

    if not tests:
        tests = [
            os.path.join(
                topsrcdir,
                'testing/marionette/client/marionette/tests/unit-tests.ini')
        ]

    options.type = testtype
    if b2g_path:
        options.homedir = b2g_path
        if emulator:
            options.emulator = emulator
    else:
        options.binary = binary
        path, exe = os.path.split(options.binary)

    options.address = address

    parser.verify_usage(options, tests)

    options.logger = commandline.setup_logging("Marionette Unit Tests",
                                               options, {"mach": sys.stdout})

    runner = startTestRunner(MarionetteTestRunner, options, tests)
    if runner.failed > 0:
        return 1

    return 0
Beispiel #6
0
def run_marionette(tests, b2g_path=None, emulator=None, testtype=None,
    address=None, binary=None, topsrcdir=None, **kwargs):
    from mozlog.structured import commandline

    from marionette.runtests import (
        MarionetteTestRunner,
        BaseMarionetteArguments,
        startTestRunner
    )

    parser = BaseMarionetteArguments()
    commandline.add_logging_group(parser)
    args = parser.parse_args()

    if not tests:
        tests = [os.path.join(topsrcdir,
                 'testing/marionette/client/marionette/tests/unit-tests.ini')]
    args.tests = tests

    if b2g_path:
        args.homedir = b2g_path
        if emulator:
            args.emulator = emulator
    else:
        args.binary = binary
        path, exe = os.path.split(args.binary)

    for k, v in kwargs.iteritems():
        setattr(args, k, v)

    parser.verify_usage(args)

    args.logger = commandline.setup_logging("Marionette Unit Tests",
                                            args,
                                            {"mach": sys.stdout})

    runner = startTestRunner(MarionetteTestRunner, args)
    if runner.failed > 0:
        return 1

    return 0
Beispiel #7
0
def run_marionette(tests, b2g_path=None, emulator=None, testtype=None,
    address=None, binary=None, topsrcdir=None, **kwargs):
    from marionette.runtests import (
        MarionetteTestRunner,
        BaseMarionetteOptions,
        startTestRunner
    )

    parser = BaseMarionetteOptions()
    commandline.add_logging_group(parser)
    options, args = parser.parse_args()

    if not tests:
        tests = [os.path.join(topsrcdir,
                    'testing/marionette/client/marionette/tests/unit-tests.ini')]

    options.type = testtype
    if b2g_path:
        options.homedir = b2g_path
        if emulator:
            options.emulator = emulator
    else:
        options.binary = binary
        path, exe = os.path.split(options.binary)

    options.address = address

    parser.verify_usage(options, tests)

    options.logger = commandline.setup_logging("Marionette Unit Tests",
                                               options,
                                               {"mach": sys.stdout})

    runner = startTestRunner(MarionetteTestRunner, options, tests)
    if runner.failed > 0:
        return 1

    return 0