# HG changeset patch # User Pierre-Yves David <pierre-yves.david@octobus.net> # Date 1685487590 -3600 # Tue May 30 23:59:50 2023 +0100 # Node ID 4f649a5f3d848259229a9dad6a4a2609782a953c # Parent e0c17e5ab4b01dd58b9bfcf3e6ca152dfcf9517d setup-base-dir: "populate" the benchmarks directory diff --git a/bin/setup-base-dir b/bin/setup-base-dir --- a/bin/setup-base-dir +++ b/bin/setup-base-dir @@ -4,6 +4,7 @@ import stat import sys import subprocess +import glob from pathlib import Path @@ -15,6 +16,14 @@ BIN_ENV_DIR = "bin-envs" DATA_ENV_DIR = "data-envs" BENCHMARK_DIR = "benchmarks" + +DIRECTORIES = [ + RESULT_DIR, + BIN_ENV_DIR, + DATA_ENV_DIR, + BENCHMARK_DIR, +] + SUITE_DIR = "suites" @@ -77,9 +86,8 @@ base_path = Path(path).absolute() print("Creating folders") base_path.mkdir(parents=True) - base_path.joinpath(RESULT_DIR).mkdir() - base_path.joinpath(BIN_ENV_DIR).mkdir() - base_path.joinpath(DATA_ENV_DIR).mkdir() + for d in DIRECTORIES: + base_path.joinpath(d).mkdir() old_dir = os.curdir os.chdir(base_path) @@ -90,6 +98,11 @@ print("Create symlinks to development Poulpe for suites") source = (POULPE_DIR / SUITE_DIR).resolve() os.symlink(source, SUITE_DIR) + bench = base_path / BENCHMARK_DIR + for p in glob.glob(str(base_path / 'suites' / '*' / 'benchmarks')): + b = Path(p).relative_to(base_path) + suite_name = b.name + os.symlink('..' / b, bench / suite_name) finally: os.chdir(old_dir) diff --git a/tests/test-setup-base-dir.t b/tests/test-setup-base-dir.t --- a/tests/test-setup-base-dir.t +++ b/tests/test-setup-base-dir.t @@ -23,6 +23,9 @@ data-envs/ results/ suites@ + $ ls -l benchmark-home/benchmarks/ + total * (glob) + * benchmarks -> ../suites/hg/benchmarks (glob) check `bin/` content --------------------