Esempio n. 1
0
def mutateCommandLine(context, commandline):
    cmd = shellcommand.parse(commandline)
    run_under_cmd = shellcommand.parse(context.config.run_under)

    if (run_under_cmd.stdin is not None or
        run_under_cmd.stdout is not None or
        run_under_cmd.stderr is not None or
        run_under_cmd.workdir is not None or
        run_under_cmd.envvars):
        raise Exception("invalid run_under argument!")

    cmd.wrap(run_under_cmd.executable, run_under_cmd.arguments)

    return cmd.toCommandline()
Esempio n. 2
0
def mutateCommandLine(context, commandline):
    profilefile = context.tmpBase + ".perf_data"
    cmd = shellcommand.parse(commandline)
    cmd.wrap('perf', [
        'record', '-e', 'cycles,cache-misses,branch-misses', '-o', profilefile
    ])
    return cmd.toCommandline()
Esempio n. 3
0
def mutateCommandLine(context, commandline):
    profilefile = context.tmpBase + ".perf_data"
    cmd = shellcommand.parse(commandline)
    cmd.wrap('perf', [
        'record',
        '-e', 'cycles,cache-misses,branch-misses',
        '-o', profilefile
    ])
    return cmd.toCommandline()
Esempio n. 4
0
def _mutateCommandLine(context, commandline):
    timefile = context.tmpBase + ".time"
    config = context.config
    cmd = shellcommand.parse(commandline)

    if config.user_mode_emulation:
        # user_mode_emulation should be true if tests are being run via
        # user-mode emulation (e.g. Qemu) and thus the host version of timeit
        # should be used.
        timeit_name = "timeit"
    else:
        timeit_name = "timeit-target"
    timeit = "%s/tools/%s" % (config.test_source_root, timeit_name)
    args = ["--limit-core", "0"]
    args += ["--limit-cpu", "7200"]
    args += ["--timeout", "7200"]
    args += ["--limit-file-size", "104857600"]
    args += ["--limit-rss-size", "838860800"]
    workdir = cmd.workdir
    if not config.traditional_output:
        stdout = cmd.stdout
        if cmd.stdout is not None:
            if not os.path.isabs(stdout) and workdir is not None:
                stdout = os.path.join(workdir, stdout)
            args += ["--redirect-stdout", stdout]
            cmd.stdout = None
        stderr = cmd.stderr
        if stderr is not None:
            if not os.path.isabs(stderr) and workdir is not None:
                stderr = os.path.join(workdir, stderr)
            args += ["--redirect-stderr", stderr]
            cmd.stderr = None
    else:
        if cmd.stdout is not None or cmd.stderr is not None:
            raise Exception("Separate stdout/stderr redirection not " +
                            "possible with traditional output")
        outfile = context.tmpBase + ".out"
        args += ["--append-exitstatus"]
        args += ["--redirect-output", outfile]
    stdin = cmd.stdin
    if stdin is not None:
        if not os.path.isabs(stdin) and workdir is not None:
            stdin = os.path.join(workdir, stdin)
        args += ["--redirect-input", stdin]
        cmd.stdin = None
    else:
        args += ["--redirect-input", "/dev/null"]
    if workdir is not None:
        args += ["--chdir", workdir]
        cmd.workdir = None
    args += ["--summary", timefile]
    # Remember timefilename for later
    context.timefiles.append(timefile)

    cmd.wrap(timeit, args)
    return cmd.toCommandline()
Esempio n. 5
0
def _mutateCommandLine(context, commandline):
    cmd = shellcommand.parse(commandline)
    cmd.arguments.append("--benchmark_format=csv")
    # We need stdout outself to get the benchmark csv data.
    if cmd.stdout is not None:
        raise Exception("Rerouting stdout not allowed for microbenchmarks")
    benchfile = context.tmpBase + '.bench.csv'
    cmd.stdout = benchfile
    context.microbenchfiles.append(benchfile)

    return cmd.toCommandline()
Esempio n. 6
0
def _mutateCommandLine(context, commandline):
    context.profilefile = context.tmpBase + ".hpmcount_data"
    # Storing profile file in context allows other modules to be aware of it.
    cmd = shellcommand.parse(commandline)
    cmd.wrap('hpmcount', ['-o', context.profilefile])
    if cmd.stdout is None:
        cmd.stdout = os.devnull
    else:
        cmd.stdout += ".hpmcount"
    if cmd.stderr is None:
        cmd.stderr = os.devnull
    else:
        cmd.stderr += ".hpmcount"
    return cmd.toCommandline()
Esempio n. 7
0
def _mutateCommandLine(context, commandline):
    profilefile = context.tmpBase + ".perf_data"
    cmd = shellcommand.parse(commandline)
    cmd.wrap('perf', [
        'record', '-e', context.config.perf_profile_events, '-o', profilefile,
        '--'
    ])
    if cmd.stdout is None:
        cmd.stdout = "/dev/null"
    else:
        cmd.stdout += ".perfrecord"
    if cmd.stderr is None:
        cmd.stderr = "/dev/null"
    else:
        cmd.stderr += ".perfrecord"
    return cmd.toCommandline()
Esempio n. 8
0
def _mutateCommandLine(context, commandline):
    context.profilefile = context.tmpBase + ".perf_data"
    # Storing profile file in context allows other modules to be aware of it.
    cmd = shellcommand.parse(commandline)
    cmd.wrap('perf', [
        'record', '-e', context.config.perf_profile_events, '-o',
        context.profilefile, '--'
    ])
    if cmd.stdout is None:
        cmd.stdout = "/dev/null"
    else:
        cmd.stdout += ".perfrecord"
    if cmd.stderr is None:
        cmd.stderr = "/dev/null"
    else:
        cmd.stderr += ".perfrecord"
    return cmd.toCommandline()
Esempio n. 9
0
def mutateCommandLine(context, commandline):
    outfile = context.tmpBase + ".out"
    timefile = context.tmpBase + ".time"
    config = context.config
    cmd = shellcommand.parse(commandline)

    timeit = "%s/tools/timeit" % config.test_source_root
    if config.remote_host:
        timeit = "%s/tools/timeit-target" % config.test_source_root
    args = ["--limit-core", "0"]
    args += ["--limit-cpu", "7200"]
    args += ["--timeout", "7200"]
    args += ["--limit-file-size", "104857600"]
    args += ["--limit-rss-size", "838860800"]
    if cmd.workdir is not None:
        args += ["--chdir", cmd.workdir]
        cmd.workdir = None
    if not config.traditional_output:
        if cmd.stdout is not None:
            args += ["--redirect-stdout", cmd.stdout]
            cmd.stdout = None
        if cmd.stderr is not None:
            args += ["--redirect-stderr", cmd.stderr]
            cmd.stderr = None
    else:
        if cmd.stdout is not None or cmd.stderr is not None:
            raise Exception("Separate stdout/stderr redirection not " +
                            "possible with traditional output")
        args += ["--append-exitstatus"]
        args += ["--redirect-output", outfile]
    if cmd.stdin is not None:
        args += ["--redirect-input", cmd.stdin]
        cmd.stdin = None
    else:
        args += ["--redirect-input", "/dev/null"]
    args += ["--summary", timefile]
    # Remember timefilename for later
    context.timefiles.append(timefile)

    cmd.wrap(timeit, args)
    return cmd.toCommandline()
Esempio n. 10
0
def mutateCommandLine(context, commandline):
    outfile = context.tmpBase + ".out"
    timefile = context.tmpBase + ".time"
    config = context.config
    cmd = shellcommand.parse(commandline)

    timeit = "%s/tools/timeit" % config.test_source_root
    if config.remote_host:
        timeit = "%s/tools/timeit-target" % config.test_source_root
    args = ["--limit-core", "0"]
    args += ["--limit-cpu", "7200"]
    args += ["--timeout", "7200"]
    args += ["--limit-file-size", "104857600"]
    args += ["--limit-rss-size", "838860800"]
    if cmd.workdir is not None:
        args += ["--chdir", cmd.workdir]
        cmd.workdir = None
    if not config.traditional_output:
        if cmd.stdout is not None:
            args += ["--redirect-stdout", cmd.stdout]
            cmd.stdout = None
        if cmd.stderr is not None:
            args += ["--redirect-stderr", cmd.stderr]
            cmd.stderr = None
    else:
        if cmd.stdout is not None or cmd.stderr is not None:
            raise Exception("Separate stdout/stderr redirection not " +
                            "possible with traditional output")
        args += ["--append-exitstatus"]
        args += ["--redirect-output", outfile]
    if cmd.stdin is not None:
        args += ["--redirect-input", cmd.stdin]
        cmd.stdin = None
    else:
        args += ["--redirect-input", "/dev/null"]
    args += ["--summary", timefile]
    # Remember timefilename for later
    context.timefiles.append(timefile)

    cmd.wrap(timeit, args)
    return cmd.toCommandline()