From 4baba0225860556db8bae905b574be3cfd7209e7 Mon Sep 17 00:00:00 2001 From: Savannah Ostrowski Date: Fri, 6 Nov 2026 13:16:32 -0800 Subject: [PATCH 1/2] Sanitize slashes in benchmark result filenames --- bench_runner/result.py | 4 ++-- tests/test_result.py | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/bench_runner/result.py b/bench_runner/result.py index f561126a..240c5cbc 100644 --- a/bench_runner/result.py +++ b/bench_runner/result.py @@ -48,9 +48,9 @@ def _clean(string: str) -> str: """ Clean an arbitrary string to be suitable for a filename. - It can't contain dashes, since dashes are used as a delimiter. + Dashes delimit filename fields, and slashes would create subdirectories. """ - return string.replace("-", "_") + return string.replace("-", "_").replace("/", "_") def _clean_for_url(string: str) -> str: diff --git a/tests/test_result.py b/tests/test_result.py index d878b79e..ecdcd126 100644 --- a/tests/test_result.py +++ b/tests/test_result.py @@ -122,3 +122,7 @@ def gethostname(*args): f"bm-20221119-{platform.system().lower()}-{platform.machine().lower()}" f"-my%2dfork-9d38120e335357a3b294-{platform.python_version()}-b7e4f1d.json" ) + + result = mod_result.Result.from_scratch(python, "my-fork", "jit/free-threading") + assert result.ref == "jit_free_threading" + assert result.filename.parent.parent == Path("results") From 57132ebea2b8b0b5a41038534b7256fa8f77632d Mon Sep 17 00:00:00 2001 From: Savannah Ostrowski Date: Thu, 12 Nov 2026 15:41:28 -0800 Subject: [PATCH 2/2] use full path --- tests/test_result.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/test_result.py b/tests/test_result.py index ecdcd126..0560e9eb 100644 --- a/tests/test_result.py +++ b/tests/test_result.py @@ -125,4 +125,8 @@ def gethostname(*args): result = mod_result.Result.from_scratch(python, "my-fork", "jit/free-threading") assert result.ref == "jit_free_threading" - assert result.filename.parent.parent == Path("results") + assert result.filename == Path( + f"results/bm-20221119-{platform.python_version()}-b7e4f1d/" + f"bm-20221119-{platform.system().lower()}-{platform.machine().lower()}" + f"-my%2dfork-jit_free_threading-{platform.python_version()}-b7e4f1d.json" + )