Exemple #1
0
    def __init__(self, b2g_home, *args, **kwargs):
        MozrunnerHandler.__init__(self, *args, **kwargs)

        process_args = {'processOutputLine': [lambda x: x[:1]]}
        self.runner = B2GEmulatorRunner(b2g_home=b2g_home,
                                        process_args=process_args)
        self.runner.device.start()
def main():
    parser = RemoteCPPUnittestOptions()
    mozlog.commandline.add_logging_group(parser)
    options, args = parser.parse_args()
    if not args:
        print >>sys.stderr, """Usage: %s <test binary> [<test binary>...]""" % sys.argv[0]
        sys.exit(1)
    if options.local_lib is not None and not os.path.isdir(options.local_lib):
        print >>sys.stderr, """Error: --localLib directory %s not found""" % options.local_lib
        sys.exit(1)
    if options.local_apk is not None and not os.path.isfile(options.local_apk):
        print >>sys.stderr, """Error: --apk file %s not found""" % options.local_apk
        sys.exit(1)
    if not options.xre_path:
        print >>sys.stderr, """Error: --xre-path is required"""
        sys.exit(1)
    if options.with_b2g_emulator:
        from mozrunner import B2GEmulatorRunner
        runner = B2GEmulatorRunner(b2g_home=options.with_b2g_emulator)
        runner.start()
    if options.dm_trans == "adb":
        if options.with_b2g_emulator:
            # because we just started the emulator, we need more than the
            # default number of retries here.
            retryLimit = 50
        else:
            retryLimit = 5
        try:
            if options.device_ip:
                dm = devicemanagerADB.DeviceManagerADB(options.device_ip, options.device_port, packageName=None, deviceRoot=options.remote_test_root, retryLimit=retryLimit)
            else:
                dm = devicemanagerADB.DeviceManagerADB(packageName=None, deviceRoot=options.remote_test_root, retryLimit=retryLimit)
        except:
            if options.with_b2g_emulator:
                runner.cleanup()
                runner.wait()
            raise
    else:
        dm = devicemanagerSUT.DeviceManagerSUT(options.device_ip, options.device_port, deviceRoot=options.remote_test_root)
        if not options.device_ip:
            print "Error: you must provide a device IP to connect to via the --deviceIP option"
            sys.exit(1)

    log = mozlog.commandline.setup_logging("remotecppunittests", options,
                                           {"tbpl": sys.stdout})

    options.xre_path = os.path.abspath(options.xre_path)
    cppunittests.update_mozinfo()
    progs = cppunittests.extract_unittests_from_args(args,
                                                     mozinfo.info,
                                                     options.manifest_path)
    tester = RemoteCPPUnitTests(dm, options, [item[0] for item in progs])
    try:
        result = tester.run_tests(progs, options.xre_path, options.symbols_path)
    except Exception, e:
        log.error(str(e))
        result = False
Exemple #3
0
def run_test_harness(options, args):
    if options.with_b2g_emulator:
        from mozrunner import B2GEmulatorRunner
        runner = B2GEmulatorRunner(arch=options.emulator,
                                   b2g_home=options.with_b2g_emulator)
        runner.start()
    if options.dm_trans == "adb":
        if options.with_b2g_emulator:
            # because we just started the emulator, we need more than the
            # default number of retries here.
            retryLimit = 50
        else:
            retryLimit = 5
        try:
            if options.device_ip:
                dm = devicemanagerADB.DeviceManagerADB(
                    options.device_ip,
                    options.device_port,
                    packageName=None,
                    deviceRoot=options.remote_test_root,
                    retryLimit=retryLimit)
            else:
                dm = devicemanagerADB.DeviceManagerADB(
                    packageName=None,
                    deviceRoot=options.remote_test_root,
                    retryLimit=retryLimit)
        except:
            if options.with_b2g_emulator:
                runner.cleanup()
                runner.wait()
            raise
    else:
        dm = devicemanagerSUT.DeviceManagerSUT(
            options.device_ip,
            options.device_port,
            deviceRoot=options.remote_test_root)
        if not options.device_ip:
            print "Error: you must provide a device IP to connect to via the --deviceIP option"
            sys.exit(1)

    options.xre_path = os.path.abspath(options.xre_path)
    cppunittests.update_mozinfo()
    progs = cppunittests.extract_unittests_from_args(args, mozinfo.info,
                                                     options.manifest_path)
    tester = RemoteCPPUnitTests(dm, options, [item[0] for item in progs])
    try:
        result = tester.run_tests(progs, options.xre_path,
                                  options.symbols_path)
    finally:
        if options.with_b2g_emulator:
            runner.cleanup()
            runner.wait()
    return result
def run_test_harness(options, args):
    if options.with_b2g_emulator:
        from mozrunner import B2GEmulatorRunner
        runner = B2GEmulatorRunner(arch=options.emulator,
                                   b2g_home=options.with_b2g_emulator)
        runner.start()
        # because we just started the emulator, we need more than the
        # default number of retries here.
        retryLimit = 50
    else:
        retryLimit = 5
    try:
        dm_args = {'deviceRoot': options.remote_test_root}
        dm_args['retryLimit'] = retryLimit
        if options.device_ip:
            dm_args['host'] = options.device_ip
            dm_args['port'] = options.device_port
        if options.adb_path:
            dm_args['adbPath'] = options.adb_path
        if options.log_tbpl_level == 'debug' or options.log_mach_level == 'debug':
            dm_args['logLevel'] = logging.DEBUG  # noqa python 2 / 3
        dm = devicemanagerADB.DeviceManagerADB(**dm_args)
    except:
        if options.with_b2g_emulator:
            runner.cleanup()
            runner.wait()
        raise

    options.xre_path = os.path.abspath(options.xre_path)
    cppunittests.update_mozinfo()
    progs = cppunittests.extract_unittests_from_args(args, mozinfo.info,
                                                     options.manifest_path)
    tester = RemoteCPPUnitTests(dm, options, [item[0] for item in progs])
    try:
        result = tester.run_tests(progs, options.xre_path,
                                  options.symbols_path)
    finally:
        if options.with_b2g_emulator:
            runner.cleanup()
            runner.wait()
    return result
Exemple #5
0
    def __init__(self, b2g_home, *args, **kwargs):
        MozrunnerHandler.__init__(self, *args, **kwargs)

        self.runner = B2GEmulatorRunner(b2g_home=b2g_home,
                                        **self.common_runner_args)
        self.runner.device.start()