#!/usr/bin/env python3 """Check representative owner hashes against L32 before the full matrix.""" import re import subprocess import time from pathlib import Path ROOT = Path(__file__).resolve().parents[4] OUT = ROOT / "Saved/Linux/l33" L32 = ROOT / "Saved/Linux/l32" BINARIES = { "clang": OUT / "bin/VoxelForgeCoreHeadless-clang-l33-final", "gcc": OUT / "bin/VoxelForgeCoreHeadless-gcc-l33-final", } HASH_PATTERN = re.compile( r"^\[Pipeline(?:FullDetailHash|WholeViewHash|LODHash|ExactQueryHash)\].*$", re.M) failed = False for compiler, binary in BINARIES.items(): for recipe in ("surface-world", "floating-islands"): name = f"owner-hash-preflight-{compiler}-{recipe}-w12" logfile = OUT / f"{name}.log" command = [ "taskset", "-c", "0-11", "prlimit", "--as=6442450944", "--", str(binary), str(ROOT / "Standalone/data/owner_world.json"), "--world-assembler-prototype", "--stream-benchmark", "--stream-pipeline", "--stream-hash", "--force-generate", "--clip-radius=3", "--max-clip-level=8", "--far-horizon-lod8-step=0", "--workers=12", f"--recipe={recipe}", ] started = time.monotonic() try: with logfile.open("w", encoding="utf-8") as stream: result = subprocess.run(command, stdout=stream, stderr=subprocess.STDOUT, timeout=900, check=False) except subprocess.TimeoutExpired: result = None text = logfile.read_text(encoding="utf-8", errors="replace") hashes = HASH_PATTERN.findall(text) baseline_path = L32 / f"l25-settled-final-{compiler}-{recipe}-w12.log" baseline = HASH_PATTERN.findall(baseline_path.read_text( encoding="utf-8", errors="replace")) if baseline_path.exists() else [] stamps = re.findall( r"^\[WorldAssemblerRecipeAudit\] requested=([^ ]+) actual=([^ ]+).*status=([^ ]+)$", text, re.M) same = len(hashes) == 12 and hashes == baseline ok = (result is not None and result.returncode == 0 and same and stamps == [(recipe, recipe, "PASS")]) failed |= not ok print(f"{name} elapsed={time.monotonic()-started:.1f}s hashes={len(hashes)}/12 " f"same_as_l32={'yes' if same else 'no'} " f"{'PASS' if ok else 'FAIL'}", flush=True) raise SystemExit(1 if failed else 0)