コード例 #1
0
def config(path,
           samrai_dir=None,
           cxx_flags=None,
           use_ninja=False,
           use_ccache=False,
           extra=""):
    cmd = make_config_str(path, samrai_dir, cxx_flags, use_ninja, extra)
    run(cmd, capture_output=False)
コード例 #2
0
def check(force_kernel_space=False):
    """ perf can require some system config / read the error if thrown """
    kernel_space_opt = "a" if force_kernel_space else ""
    run(f"perf stat -{kernel_space_opt}d sleep 1",
        shell=True,
        capture_output=True,
        check=True)
    record("ls", [], "/tmp/perf_record_check.dat")
コード例 #3
0
ファイル: git.py プロジェクト: rochSmets/PHARE
def checkout(branch, create=False, recreate=False):
    if recreate:
        delete_branch(branch)
        create = True

    if create and not branch_exists(branch):
        run(f"git checkout -b {branch}")
    else:
        run(f"git checkout {branch}")
コード例 #4
0
def build(use_ninja=False, threads=1):
    run("ninja" if use_ninja else f"make -j{threads}", capture_output=False)
コード例 #5
0
def record(exe, events, output_file=None):
    return run(record_cmd(exe, events, output_file), check=True)
コード例 #6
0
def stat(exe, events, output_file=None):
    return run(stat_cmd(exe, events, output_file), check=True)
コード例 #7
0
def version():
    # validated on perf version: 5.19
    proc = run("perf -v", shell=True, capture_output=True)
    if " " not in proc or "." not in proc:
        raise ValueError("Unparsable result from 'perf -v'")
    return [int(digit) for digit in proc.split(" ").split(".")]
コード例 #8
0
ファイル: cmake.py プロジェクト: rochSmets/PHARE
def run_test(test, verbose=False, capture_output=False):
    run(test_cmd(cmd, verbose=verbose), capture_output=capture_output)
コード例 #9
0
ファイル: cmake.py プロジェクト: rochSmets/PHARE
def list_tests():
    proc = run("ctest -N", capture_output=True)
    out = decode_bytes(proc.stdout)
    return [line.split(" ")[-1] for line in out.splitlines()[1:-2]]
コード例 #10
0
ファイル: git.py プロジェクト: rochSmets/PHARE
def hashes(N=1):
    return decode_bytes(
        run(f"git log -{N} --pretty=format:%h").stdout).splitlines()
コード例 #11
0
ファイル: git.py プロジェクト: rochSmets/PHARE
def current_branch():
    return decode_bytes(run("git branch --show-current").stdout)
コード例 #12
0
ファイル: git.py プロジェクト: rochSmets/PHARE
def branch_exists(branch):
    try:
        run(f"git show-branch {branch}", check=True)
    except subprocess.CalledProcessError as e:
        return False  # exit failure means branch does not exist
    return True
コード例 #13
0
ファイル: git.py プロジェクト: rochSmets/PHARE
def log(N=10, use_short=False):
    """ enjoy """
    short = '--pretty=format:"%h%x09%an%x09%ad%x09%s"' if use_short else ""
    return decode_bytes(run(f"git log -{N} {short}").stdout)