Skip to content

Commit d771ff5

Browse files
committed
fix(validation): fall back to architecture for blank processor identity
1 parent 2947f07 commit d771ff5

2 files changed

Lines changed: 29 additions & 1 deletion

File tree

‎tests/contracts/test_real_strategy_runner.py‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from types import SimpleNamespace
1212

1313
import polars as pl
14+
import pytest
1415

1516

1617
def _load_runner():
@@ -61,6 +62,33 @@ def _load_benchmark():
6162
return module
6263

6364

65+
@pytest.mark.skipif(sys.platform != "linux", reason="Publication timings identify a Linux host")
66+
def test_benchmark_report_accepts_linux_with_blank_processor_query(monkeypatch) -> None:
67+
benchmark = _load_benchmark()
68+
validation = Path(__file__).parents[2] / "validation"
69+
correctness = json.loads((validation / "REAL_STRATEGY_RESULTS.json").read_text())
70+
measurements = json.loads((validation / "REAL_STRATEGY_PERFORMANCE.json").read_text())
71+
retained = {
72+
(record["case_study"], record["framework"]): record for record in measurements["records"]
73+
}
74+
75+
def measured_side(*, case_study, framework, side, **_settings):
76+
key = "framework_engine" if side == "framework" else "ml4t_engine"
77+
return copy.deepcopy(retained[(case_study, framework)][key])
78+
79+
# Reuse real measured samples to isolate report production from native engine runtimes.
80+
monkeypatch.setattr(benchmark, "_measure_side", measured_side)
81+
monkeypatch.setattr(benchmark.platform, "processor", lambda: "")
82+
report = benchmark.build_report(
83+
correctness=correctness,
84+
bundle_root=validation,
85+
warmups=1,
86+
samples=10,
87+
)
88+
89+
assert benchmark.report_failures(report, correctness) == []
90+
91+
6492
class _Broker:
6593
def __init__(self) -> None:
6694
self.cash = 1_000.0

‎validation/real_strategy_benchmark.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ def build_report(
258258
"environment": {
259259
"platform": platform.platform(),
260260
"machine": platform.machine(),
261-
"processor": platform.processor(),
261+
"processor": platform.processor() or platform.machine(),
262262
"cpu_count": os.cpu_count(),
263263
"frameworks": targets["framework"],
264264
},

0 commit comments

Comments
 (0)