Exemple #1
0
def run_perf(testname: Path, ntimes):
    open(str(testname / "user.perf"), "w").close()
    for i in range(1, ntimes + 1):
        print("run number {}/{}".format(i, ntimes))
        shcall(executable_cmd.format(testname=testname), info_lines=10)
        sh_grep_pref("perf", testname / "user.err", testname / "user.perf")
    if (testname / "user.perf.min").is_file():
        sh_copy(testname / "user.perf.min", testname / "user.perf.min.prev")
    accumulate_performance_data(testname / "user.perf",
                                testname / "user.perf.min")
    diff_perf_mins(testname / "user.perf.min", testname / "user.perf.min.prev")
Exemple #2
0
def run_test(testname: Path, automated_tests_mode=False):
    shcall(executable_cmd.format(testname=testname), info_lines=10)
    for family in families_from_stderr:
        sh_grep_pref(family,
                     inp=testname / "user.err",
                     outp=testname / ("user.%s" % family))
    for family in families:
        userpath = testname / ("user.%s" % family)
        diffpath = testname / ("diff.%s" % family)
        expectedpath = testname / family
        if expectedpath.exists():
            sh_diff(expectedpath,
                    userpath,
                    diffpath,
                    quiet=automated_tests_mode)
            if family in families_checked:
                logging.info("comparing .%s", family)
Exemple #3
0
def git_record(msg="bump", cwd=Path(".")):
    assert (cwd / ".git").is_dir()
    shcall("git add .", cwd=cwd)
    shcall("git commit -a -m \"{}\" -q".format(msg), cwd=cwd)
Exemple #4
0
def sh_copy(src, tgt):
    shcall("cp {} {}".format(src, tgt))
Exemple #5
0
def sh_diff(reference_file, user_file, outp, quiet=False):
    return shcall("diff {0} {1} | tee {2}".format(reference_file, user_file, outp),
                  check=False, log_rc=False, info_lines=10 if not quiet else 0) \
               .returncode == 0
Exemple #6
0
def sh_grep_pref(sign, inp, outp, append=False):
    shcall("grep ^{0}: {1} {3} {2}".format(sign, inp, outp, ">>" if append else ">"),
           check=False, log_rc=False, info_lines=0)
Exemple #7
0
def sh_make(make_target_name, source_dir, final_target_path, compiler_output_log: Path):
    completed = shcall("make {} 2>&1 | tee {}".format(make_target_name,
                                                      compiler_output_log.absolute()),
                       check=False, cwd=source_dir, info_lines=10)
    if completed.returncode == 0:
        sh_copy(source_dir / make_target_name, final_target_path)
Exemple #8
0
def git_get_commit(cwd=Path(".")):
    assert (cwd / ".git").is_dir()
    return shcall("git rev-parse --short HEAD", cwd=cwd).stdout.decode().rstrip()
Exemple #9
0
def git_tag(tagname, cwd=Path(".")):
    assert (cwd / ".git").is_dir()
    shcall("git tag {}".format(tagname))
Exemple #10
0
def run_cg(testname: Path, cg_args):
    shcall(" ".join([full_cg_args, executable_cmd]).format(testname=testname,
                                                           cg_args=cg_args),
           info_lines=10)
Exemple #11
0
def new(path: Path):
    path.mkdir(exist_ok=True)
    shutil.copy(str(dev_scripts_root() / "workspace_gitignore"),
                str(path / ".gitignore"))
    shcall("git init", cwd=path)
    git_record("init", cwd=path)