aboutsummaryrefslogtreecommitdiffstats
path: root/research/experiments/010-one-sync-commit/run.py
diff options
context:
space:
mode:
Diffstat (limited to 'research/experiments/010-one-sync-commit/run.py')
-rw-r--r--research/experiments/010-one-sync-commit/run.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/research/experiments/010-one-sync-commit/run.py b/research/experiments/010-one-sync-commit/run.py
index 9a01c07..c729358 100644
--- a/research/experiments/010-one-sync-commit/run.py
+++ b/research/experiments/010-one-sync-commit/run.py
@@ -16,11 +16,18 @@ from pathlib import Path
HERE = Path(__file__).resolve().parent
ROOT = HERE.parents[2]
-PURE = ROOT / 'prototypes' / 'connections'
+CORE = ROOT / 'core' # the store's headers
+STORE = ROOT / 'store' / 'store-tree.c'
+
+
+def stored_at(revision):
+ """Where the tree store was at a revision: store/ now, prototypes/connections/ before."""
+ moved = subprocess.run(['git', '-C', str(ROOT), 'cat-file', '-e', f'{revision}:store/store-tree.c'], capture_output=True)
+ return 'store/store-tree.c' if moved.returncode == 0 else 'prototypes/connections/store-tree.c'
def build(output, sources):
- subprocess.run(['cc', '-O2', '-std=c17', f'-I{PURE}', '-o', str(output)] + [str(s) for s in sources] + ['-lpthread'],
+ subprocess.run(['cc', '-O2', '-std=c17', f'-I{CORE}', '-o', str(output)] + [str(s) for s in sources] + ['-lpthread'],
check=True)
@@ -34,12 +41,12 @@ def main():
with tempfile.TemporaryDirectory() as work:
work = Path(work)
before = work / 'store-tree-before.c'
- before.write_text(subprocess.run(['git', '-C', str(ROOT), 'show', f'{args.before}:prototypes/connections/store-tree.c'],
+ before.write_text(subprocess.run(['git', '-C', str(ROOT), 'show', f'{args.before}:{stored_at(args.before)}'],
capture_output=True, text=True, check=True).stdout)
build(work / 'probe', [HERE / 'probe.c'])
builds = {'two syncs': work / 'commits-before', 'one sync': work / 'commits-after'}
build(builds['two syncs'], [HERE / 'commits.c', before])
- build(builds['one sync'], [HERE / 'commits.c', PURE / 'store-tree.c'])
+ build(builds['one sync'], [HERE / 'commits.c', STORE])
results = {'rounds': []}
for round_ in range(args.rounds):
probe = subprocess.run([str(work / 'probe'), str(args.directory)], capture_output=True, text=True, check=True)