def check_args(kwargs):
    from mozrunner import cli

    set_from_config(kwargs)

    for test_paths in kwargs["test_paths"].itervalues():
        if not ("tests_path" in test_paths and "metadata_path" in test_paths):
            print "Fatal: must specify both a test path and metadata path"
            sys.exit(1)
        for key, path in test_paths.iteritems():
            name = key.split("_", 1)[0]

            if not os.path.exists(path):
                print "Fatal: %s path %s does not exist" % (name, path)
                sys.exit(1)

            if not os.path.isdir(path):
                print "Fatal: %s path %s is not a directory" % (name, path)
                sys.exit(1)

    if kwargs["serve_root"] is None:
        if "/" in kwargs["test_paths"]:
            kwargs["serve_root"] = kwargs["test_paths"]["/"]["tests_path"]
    else:
        print >> sys.stderr, "Unable to determine server root path"
        sys.exit(1)

    if kwargs["run_info"] is None:
        kwargs["run_info"] = kwargs["config_path"]

    if kwargs["this_chunk"] > 1:
        require_arg(kwargs, "total_chunks",
                    lambda x: x >= kwargs["this_chunk"])

    if kwargs["chunk_type"] is None:
        if kwargs["total_chunks"] > 1:
            kwargs["chunk_type"] = "equal_time"
        else:
            kwargs["chunk_type"] = "none"

    if kwargs["debugger"] is not None:
        debug_args, interactive = cli.debugger_arguments(
            kwargs["debugger"], kwargs["debugger_args"])
        if interactive:
            require_arg(kwargs, "processes", lambda x: x == 1)
            kwargs["no_capture_stdio"] = True
        kwargs["interactive"] = interactive
        kwargs["debug_args"] = debug_args
    else:
        kwargs["interactive"] = False
        kwargs["debug_args"] = None

    if kwargs["binary"] is not None:
        if not os.path.exists(kwargs["binary"]):
            print >> sys.stderr, "Binary path %s does not exist" % kwargs[
                "binary"]
            sys.exit(1)

    return kwargs
Ejemplo n.º 2
0
def check_args(kwargs):
    from mozrunner import cli

    set_from_config(kwargs)

    for test_paths in kwargs["test_paths"].itervalues():
        if not ("tests_path" in test_paths and "metadata_path" in test_paths):
            print "Fatal: must specify both a test path and metadata path"
            sys.exit(1)
        for key, path in test_paths.iteritems():
            name = key.split("_", 1)[0]

            if not os.path.exists(path):
                print "Fatal: %s path %s does not exist" % (name, path)
                sys.exit(1)

            if not os.path.isdir(path):
                print "Fatal: %s path %s is not a directory" % (name, path)
                sys.exit(1)

    if kwargs["serve_root"] is None:
        if "/" in kwargs["test_paths"]:
            kwargs["serve_root"] = kwargs["test_paths"]["/"]["tests_path"]
    else:
        print >> sys.stderr, "Unable to determine server root path"
        sys.exit(1)

    if kwargs["run_info"] is None:
        kwargs["run_info"] = kwargs["config_path"]

    if kwargs["this_chunk"] > 1:
        require_arg(kwargs, "total_chunks", lambda x: x >= kwargs["this_chunk"])

    if kwargs["chunk_type"] is None:
        if kwargs["total_chunks"] > 1:
            kwargs["chunk_type"] = "equal_time"
        else:
            kwargs["chunk_type"] = "none"

    if kwargs["debugger"] is not None:
        debug_args, interactive = cli.debugger_arguments(kwargs["debugger"], kwargs["debugger_args"])
        if interactive:
            require_arg(kwargs, "processes", lambda x: x == 1)
            kwargs["no_capture_stdio"] = True
        kwargs["interactive"] = interactive
        kwargs["debug_args"] = debug_args
    else:
        kwargs["interactive"] = False
        kwargs["debug_args"] = None

    if kwargs["binary"] is not None:
        if not os.path.exists(kwargs["binary"]):
            print >> sys.stderr, "Binary path %s does not exist" % kwargs["binary"]
            sys.exit(1)

    return kwargs
Ejemplo n.º 3
0
def check_args(kwargs):
    from mozrunner import cli

    set_from_config(kwargs)

    for key in ["tests_root", "metadata_root"]:
        name = key.split("_", 1)[0]
        path = kwargs[key]

        if not os.path.exists(path):
            print "Fatal: %s path %s does not exist" % (name, path)
            sys.exit(1)

        if not os.path.isdir(path):
            print "Fatal: %s path %s is not a directory" % (name, path)
            sys.exit(1)

    if kwargs["this_chunk"] > 1:
        require_arg(kwargs, "total_chunks",
                    lambda x: x >= kwargs["this_chunk"])

    if kwargs["chunk_type"] is None:
        if kwargs["total_chunks"] > 1:
            kwargs["chunk_type"] = "equal_time"
        else:
            kwargs["chunk_type"] = "none"

    if kwargs["debugger"] is not None:
        debug_args, interactive = cli.debugger_arguments(
            kwargs["debugger"], kwargs["debugger_args"])
        if interactive:
            require_arg(kwargs, "processes", lambda x: x == 1)
            kwargs["no_capture_stdio"] = True
        kwargs["interactive"] = interactive
        kwargs["debug_args"] = debug_args
    else:
        kwargs["interactive"] = False
        kwargs["debug_args"] = None

    if kwargs["binary"] is not None:
        if not os.path.exists(kwargs["binary"]):
            print >> sys.stderr, "Binary path %s does not exist" % kwargs[
                "binary"]
            sys.exit(1)

    return kwargs
Ejemplo n.º 4
0
def check_args(kwargs):
    from mozrunner import cli

    set_from_config(kwargs)

    for key in ["tests_root", "metadata_root"]:
        name = key.split("_", 1)[0]
        path = kwargs[key]

        if not os.path.exists(path):
            print "Fatal: %s path %s does not exist" % (name, path)
            sys.exit(1)

        if not os.path.isdir(path):
            print "Fatal: %s path %s is not a directory" % (name, path)
            sys.exit(1)

    if kwargs["this_chunk"] > 1:
        require_arg(kwargs, "total_chunks", lambda x: x >= kwargs["this_chunk"])

    if kwargs["chunk_type"] is None:
        if kwargs["total_chunks"] > 1:
            kwargs["chunk_type"] = "equal_time"
        else:
            kwargs["chunk_type"] = "none"

    if kwargs["debugger"] is not None:
        debug_args, interactive = cli.debugger_arguments(kwargs["debugger"],
                                                         kwargs["debugger_args"])
        if interactive:
            require_arg(kwargs, "processes", lambda x: x == 1)
            kwargs["no_capture_stdio"] = True
        kwargs["interactive"] = interactive
        kwargs["debug_args"] = debug_args
    else:
        kwargs["interactive"] = False
        kwargs["debug_args"] = None

    if kwargs["binary"] is not None:
        if not os.path.exists(kwargs["binary"]):
            print >> sys.stderr, "Binary path %s does not exist" % kwargs["binary"]
            sys.exit(1)

    return kwargs