Ejemplo n.º 1
0
def main():
    """Run the benchmark per arguments"""
    sum = Summary()
    options, args = getopt(sys.argv[1:], 'a:c:n:',
                           ['list-projects', 'actions=', 'help', 'compiler='])
    opt_actions = actions.default_actions
    set_compilers = []
    opt_repeats = 1

    for opt, optarg in options:
        if opt == '--help':
            show_help()
            return
        elif opt == '--list-projects':
            list_projects()
            return
        elif opt == '--actions' or opt == '-a':
            opt_actions = actions.parse_opt_actions(optarg)
        elif opt == '--compiler' or opt == '-c':
            set_compilers.append(compiler.parse_opt(optarg))
        elif opt == '-n':
            opt_repeats = int(optarg)

    if not set_compilers:
        set_compilers = compiler.default_compilers()

    # Find named projects, or run all by default
    if args:
        chosen_projects = [find_project(name) for name in args]
    else:
        chosen_projects = trees.values()

    for proj in chosen_projects:
        proj.pre_actions(opt_actions)
        for comp in set_compilers:
            build = Build(proj, comp, opt_repeats)
            build.build_actions(opt_actions, sum)

    sum.print_table()
Ejemplo n.º 2
0
def main():
    """Run the benchmark per arguments"""
    sum = Summary()
    options, args = getopt(sys.argv[1:], "a:c:n:", ["list-projects", "actions=", "help", "compiler="])
    opt_actions = actions.default_actions
    set_compilers = []
    opt_repeats = 1

    for opt, optarg in options:
        if opt == "--help":
            show_help()
            return
        elif opt == "--list-projects":
            list_projects()
            return
        elif opt == "--actions" or opt == "-a":
            opt_actions = actions.parse_opt_actions(optarg)
        elif opt == "--compiler" or opt == "-c":
            set_compilers.append(compiler.parse_opt(optarg))
        elif opt == "-n":
            opt_repeats = int(optarg)

    if not set_compilers:
        set_compilers = compiler.default_compilers()

    # Find named projects, or run all by default
    if args:
        chosen_projects = [find_project(name) for name in args]
    else:
        chosen_projects = trees.values()

    for proj in chosen_projects:
        proj.pre_actions(opt_actions)
        for comp in set_compilers:
            build = Build(proj, comp, opt_repeats)
            build.build_actions(opt_actions, sum)

    sum.print_table()
Ejemplo n.º 3
0
def main():
    """Run the benchmark per arguments"""

    # Ensure that stdout and stderr are line buffered, rather than
    # block buffered, as might be the default when running with
    # stdout/stderr redirected to a file; this ensures that the
    # output is prompt, even when the script takes a long time for
    # a single step, and it also avoids confusing intermingling of
    # stdout and stderr.
    sys.stdout = os.fdopen(1, "w", 1)
    sys.stderr = os.fdopen(2, "w", 1)

    sum = Summary()
    options, args = getopt(sys.argv[1:], 'a:c:n:f:',
                           ['list-projects', 'actions=', 'help', 'compiler=',
                            'cc=', 'cxx=', 'output=', 'force='])
    opt_actions = actions.default_actions
    opt_cc = 'cc'
    opt_cxx = 'c++'
    opt_output = None
    opt_compilers = []
    opt_repeats = 1
    opt_force = 1

    for opt, optarg in options:
        if opt == '--help':
            show_help()
            return
        elif opt == '--list-projects':
            list_projects()
            return
        elif opt == '--actions' or opt == '-a':
            opt_actions = actions.parse_opt_actions(optarg)
        elif opt == '--cc':
            opt_cc = optarg
        elif opt == '--cxx':
            opt_cxx = optarg
        elif opt == '--output':
            opt_output = optarg
        elif opt == '--compiler' or opt == '-c':
            opt_compilers.append(optarg)
        elif opt == '-n':
            opt_repeats = int(optarg)
        elif opt == '-f' or opt == '--force':
            opt_force = int(optarg)

    if opt_compilers:
        set_compilers = [compiler.parse_compiler_opt(c, cc=opt_cc, cxx=opt_cxx)
                         for c in opt_compilers]
    else:
        set_compilers = compiler.default_compilers(cc=opt_cc, cxx=opt_cxx)

    # Find named projects, or run all by default
    if args:
        chosen_projects = [find_project(name) for name in args]
    else:
        chosen_projects = trees.values()

    for proj in chosen_projects:
        # Ignore actions we did in a previous benchmark run, absent -f.
        # We only run the project's pre-actions if one of the builds
        # needs it because it hasn't successfully run 'configure' yet.
        project_actions, _ = actions.remove_unnecessary_actions(
                opt_actions, opt_force, proj.did_download(), 0)
        proj.pre_actions(project_actions)

        for comp in set_compilers:
            build = Build(proj, comp, opt_repeats)
            _, build_actions = actions.remove_unnecessary_actions(
                opt_actions, opt_force,
                proj.did_download(), build.did_configure())

            build.build_actions(build_actions, sum)

    sum.print_table()
    # If --output was specified, print the table to the output-file too
    if opt_output:
        old_stdout = sys.stdout
        sys.stdout = open(opt_output, 'w')
        try:
            sum.print_table()
        finally:
            sys.stdout.close()
            sys.stdout = old_stdout