Derive synthetic terrain metadata from the fixture and copy the same bytes that were hashed before building. Co-authored-by: Codex <codex@openai.com>
This commit is contained in:
+8
-4
@@ -169,7 +169,7 @@ def test_budgets():
|
||||
"schema": 1,
|
||||
"command": "test-budgets",
|
||||
"scenario": BUDGET_SCENARIO,
|
||||
"scenario_render_world": "flat at y=64",
|
||||
"scenario_render_world": None,
|
||||
"status": "failed",
|
||||
"exit_code": None,
|
||||
"scenario_counts": {"scripts": 1, "steps": None, "raid_requests": None,
|
||||
@@ -212,7 +212,11 @@ def test_budgets():
|
||||
wasmtime = re.search(r'\[\[package\]\]\s*name = "wasmtime"\s*version = "([^"]+)"', lock_text)
|
||||
report["wasmtime_version"] = wasmtime.group(1) if wasmtime else None
|
||||
fixture = ROOT / "airdef-mod" / BUDGET_SCENARIO
|
||||
fixture_text = fixture.read_text()
|
||||
fixture_bytes = fixture.read_bytes()
|
||||
fixture_text = fixture_bytes.decode("utf-8")
|
||||
flat_heights = list(dict.fromkeys(re.findall(r"(?m)^render-ground-y\s*=\s*(-?\d+)\s*$", fixture_text)))
|
||||
if flat_heights:
|
||||
report["scenario_render_world"] = "flat at y=" + ",".join(flat_heights)
|
||||
counts = report["scenario_counts"]
|
||||
counts["steps"] = len(re.findall(r"(?m)^\[\[step\]\]$", fixture_text))
|
||||
counts["air_defense_units"] = len(re.findall(r'(?m)^command = "airdef deploy [^"]+"', fixture_text))
|
||||
@@ -221,7 +225,7 @@ def test_budgets():
|
||||
counts["raid_units_requested"] = sum(map(int, requests))
|
||||
for field in ("ticks", "frames"):
|
||||
counts[field] = sum(map(int, re.findall(rf"(?m)^{field}\s*=\s*(\d+)\s*$", fixture_text)))
|
||||
report["scenario_sha256"] = hashlib.sha256(fixture.read_bytes()).hexdigest()
|
||||
report["scenario_sha256"] = hashlib.sha256(fixture_bytes).hexdigest()
|
||||
|
||||
mod()
|
||||
artifact = hmod()
|
||||
@@ -247,7 +251,7 @@ def test_budgets():
|
||||
with tempfile.TemporaryDirectory(prefix="airdef-wasm-budget-") as temp:
|
||||
isolated = Path(temp)
|
||||
(isolated / "tests").mkdir()
|
||||
shutil.copy2(fixture, isolated / "tests" / "wasm_budget.toml")
|
||||
(isolated / "tests" / "wasm_budget.toml").write_bytes(fixture_bytes)
|
||||
command = [cargo(), "run", "--locked", "--manifest-path", FORK / "Cargo.toml",
|
||||
"-p", "cargo-horizon-mod", "--", "horizon-mod", "test", "--hmod", artifact, "budget"]
|
||||
print("+", " ".join(str(c) for c in command), flush=True)
|
||||
|
||||
Reference in New Issue
Block a user