def main():
    if sys.version_info < (2, 7):
        print("Error: You must use python version 2.7 or newer but less than 3.0", file=sys.stderr)
        sys.exit(1)

    parser = parser_remote()
    options = parser.parse_args()

    options = verifyRemoteOptions(parser, options)
    log = commandline.setup_logging("Remote XPCShell",
                                    options,
                                    {"tbpl": sys.stdout})

    if options['interactive'] and not options['testPath']:
        print("Error: You must specify a test filename in interactive mode!", file=sys.stderr)
        sys.exit(1)

    if options['xpcshell'] is None:
        options['xpcshell'] = "xpcshell"

    xpcsh = XPCShellRemote(options, log)

    # we don't run concurrent tests on mobile
    options['sequential'] = True

    if not xpcsh.runTests(options,
                          testClass=RemoteXPCShellTestThread,
                          mobileArgs=xpcsh.mobileArgs):
        sys.exit(1)
Example #2
0
def get_parser():
    build_obj = MozbuildObject.from_environment(cwd=here)
    if (conditions.is_android(build_obj)
            or build_obj.substs.get("MOZ_BUILD_APP") == "b2g"):
        return parser_remote()
    else:
        return parser_desktop()
Example #3
0
def main():
    if sys.version_info < (2, 7):
        print(
            "Error: You must use python version 2.7 or newer but less than 3.0",
            file=sys.stderr,
        )
        sys.exit(1)

    parser = parser_remote()
    options = parser.parse_args()

    options = verifyRemoteOptions(parser, options)
    log = commandline.setup_logging("Remote XPCShell", options, {"tbpl": sys.stdout})

    if options["interactive"] and not options["testPath"]:
        print(
            "Error: You must specify a test filename in interactive mode!",
            file=sys.stderr,
        )
        sys.exit(1)

    if options["xpcshell"] is None:
        options["xpcshell"] = "xpcshell"

    # The threadCount depends on the emulator rather than the host machine and
    # empirically 10 seems to yield the best performance.
    options["threadCount"] = min(options["threadCount"], 10)

    xpcsh = XPCShellRemote(options, log)

    if not xpcsh.runTests(
        options, testClass=RemoteXPCShellTestThread, mobileArgs=xpcsh.mobileArgs
    ):
        sys.exit(1)
Example #4
0
def get_parser():
    build_obj = MozbuildObject.from_environment(cwd=here)
    if conditions.is_android(build_obj):
        return parser_remote()
    elif conditions.is_b2g(build_obj):
        return parser_b2g()
    else:
        return parser_desktop()
Example #5
0
def get_parser():
    build_obj = MozbuildObject.from_environment(cwd=here)
    if conditions.is_android(build_obj):
        return parser_remote()
    elif conditions.is_b2g(build_obj):
        return parser_b2g()
    else:
        return parser_desktop()
Example #6
0
def main():
    if sys.version_info < (2, 7):
        print >> sys.stderr, "Error: You must use python version 2.7 or newer but less than 3.0"
        sys.exit(1)

    parser = parser_remote()
    options = parser.parse_args()
    if not options.localAPK:
        for file in os.listdir(os.path.join(options.objdir, "dist")):
            if (file.endswith(".apk") and file.startswith("fennec")):
                options.localAPK = os.path.join(options.objdir, "dist")
                options.localAPK = os.path.join(options.localAPK, file)
                print >> sys.stderr, "using APK: " + options.localAPK
                break
        else:
            print >> sys.stderr, "Error: please specify an APK"
            sys.exit(1)

    options = verifyRemoteOptions(parser, options)
    log = commandline.setup_logging("Remote XPCShell", options,
                                    {"tbpl": sys.stdout})

    if options.dm_trans == "adb":
        if options.deviceIP:
            dm = mozdevice.DroidADB(options.deviceIP,
                                    options.devicePort,
                                    packageName=None,
                                    deviceRoot=options.remoteTestRoot)
        else:
            dm = mozdevice.DroidADB(packageName=None,
                                    deviceRoot=options.remoteTestRoot)
    else:
        if not options.deviceIP:
            print "Error: you must provide a device IP to connect to via the --device option"
            sys.exit(1)
        dm = mozdevice.DroidSUT(options.deviceIP,
                                options.devicePort,
                                deviceRoot=options.remoteTestRoot)

    if options.interactive and not options.testPath:
        print >> sys.stderr, "Error: You must specify a test filename in interactive mode!"
        sys.exit(1)

    if options.xpcshell is None:
        options.xpcshell = "xpcshell"

    xpcsh = XPCShellRemote(dm, options, log)

    # we don't run concurrent tests on mobile
    options.sequential = True

    if not xpcsh.runTests(testClass=RemoteXPCShellTestThread,
                          mobileArgs=xpcsh.mobileArgs,
                          **vars(options)):
        sys.exit(1)
Example #7
0
def main():
    if sys.version_info < (2, 7):
        print(
            "Error: You must use python version 2.7 or newer but less than 3.0",
            file=sys.stderr)
        sys.exit(1)

    parser = parser_remote()
    options = parser.parse_args()
    if not options.localAPK:
        for file in os.listdir(os.path.join(options.objdir, "dist")):
            if (file.endswith(".apk") and file.startswith("fennec")):
                options.localAPK = os.path.join(options.objdir, "dist")
                options.localAPK = os.path.join(options.localAPK, file)
                print("using APK: " + options.localAPK, file=sys.stderr)
                break
        else:
            print("Error: please specify an APK", file=sys.stderr)
            sys.exit(1)

    options = verifyRemoteOptions(parser, options)
    log = commandline.setup_logging("Remote XPCShell", options,
                                    {"tbpl": sys.stdout})

    dm_args = {'deviceRoot': options['remoteTestRoot']}
    if options['deviceIP']:
        dm_args['host'] = options['deviceIP']
        dm_args['port'] = options['devicePort']
    if options['log_tbpl_level'] == 'debug' or options[
            'log_mach_level'] == 'debug':
        dm_args['logLevel'] = logging.DEBUG
    if options['adbPath']:
        dm_args['adbPath'] = options['adbPath']
    dm = mozdevice.DroidADB(**dm_args)

    if options['interactive'] and not options['testPath']:
        print("Error: You must specify a test filename in interactive mode!",
              file=sys.stderr)
        sys.exit(1)

    if options['xpcshell'] is None:
        options['xpcshell'] = "xpcshell"

    xpcsh = XPCShellRemote(dm, options, log)

    # we don't run concurrent tests on mobile
    options['sequential'] = True

    if not xpcsh.runTests(options,
                          testClass=RemoteXPCShellTestThread,
                          mobileArgs=xpcsh.mobileArgs):
        sys.exit(1)
def main():
    if sys.version_info < (2,7):
        print >>sys.stderr, "Error: You must use python version 2.7 or newer but less than 3.0"
        sys.exit(1)

    parser = parser_remote()
    options = parser.parse_args()
    if not options.localAPK:
        for file in os.listdir(os.path.join(options.objdir, "dist")):
            if (file.endswith(".apk") and file.startswith("fennec")):
                options.localAPK = os.path.join(options.objdir, "dist")
                options.localAPK = os.path.join(options.localAPK, file)
                print >>sys.stderr, "using APK: " + options.localAPK
                break
        else:
            print >>sys.stderr, "Error: please specify an APK"
            sys.exit(1)

    options = verifyRemoteOptions(parser, options)
    log = commandline.setup_logging("Remote XPCShell",
                                    options,
                                    {"tbpl": sys.stdout})

    if options.dm_trans == "adb":
        if options.deviceIP:
            dm = mozdevice.DroidADB(options.deviceIP, options.devicePort, packageName=None, deviceRoot=options.remoteTestRoot)
        else:
            dm = mozdevice.DroidADB(packageName=None, deviceRoot=options.remoteTestRoot)
    else:
        if not options.deviceIP:
            print "Error: you must provide a device IP to connect to via the --device option"
            sys.exit(1)
        dm = mozdevice.DroidSUT(options.deviceIP, options.devicePort, deviceRoot=options.remoteTestRoot)

    if options.interactive and not options.testPath:
        print >>sys.stderr, "Error: You must specify a test filename in interactive mode!"
        sys.exit(1)

    if options.xpcshell is None:
        options.xpcshell = "xpcshell"

    xpcsh = XPCShellRemote(dm, options, log)

    # we don't run concurrent tests on mobile
    options.sequential = True

    if not xpcsh.runTests(testClass=RemoteXPCShellTestThread,
                          mobileArgs=xpcsh.mobileArgs,
                          **vars(options)):
        sys.exit(1)
def main():
    if sys.version_info < (2,7):
        print >>sys.stderr, "Error: You must use python version 2.7 or newer but less than 3.0"
        sys.exit(1)

    parser = parser_remote()
    options = parser.parse_args()
    if not options.localAPK:
        for file in os.listdir(os.path.join(options.objdir, "dist")):
            if (file.endswith(".apk") and file.startswith("fennec")):
                options.localAPK = os.path.join(options.objdir, "dist")
                options.localAPK = os.path.join(options.localAPK, file)
                print >>sys.stderr, "using APK: " + options.localAPK
                break
        else:
            print >>sys.stderr, "Error: please specify an APK"
            sys.exit(1)

    options = verifyRemoteOptions(parser, options)
    log = commandline.setup_logging("Remote XPCShell",
                                    options,
                                    {"tbpl": sys.stdout})

    dm_args = {'deviceRoot': options.remoteTestRoot}
    if options.deviceIP:
        dm_args['host'] = options.deviceIP
        dm_args['port'] = options.devicePort
    if options.log_tbpl_level == 'debug' or options.log_mach_level == 'debug':
        dm_args['logLevel'] = logging.DEBUG
    dm = mozdevice.DroidADB(**dm_args)

    if options.interactive and not options.testPath:
        print >>sys.stderr, "Error: You must specify a test filename in interactive mode!"
        sys.exit(1)

    if options.xpcshell is None:
        options.xpcshell = "xpcshell"

    xpcsh = XPCShellRemote(dm, options, log)

    # we don't run concurrent tests on mobile
    options.sequential = True

    if not xpcsh.runTests(testClass=RemoteXPCShellTestThread,
                          mobileArgs=xpcsh.mobileArgs,
                          **vars(options)):
        sys.exit(1)