#!/usr/bin/env python3 """Compare all L18 crossing configurations to the L14 24 m crossing hashes.""" import re from pathlib import Path ROOT = Path(__file__).resolve().parents[4] RUNS = ROOT / "Saved/Linux/l18-crossing" PATTERN = re.compile( r"^\[Pipeline(?:FullDetailHash|WholeViewHash|LODHash|ExactQueryHash)\].*$", re.M) failed = [] logs = sorted(RUNS.glob("*-w*-r*.log")) for path in logs: parts = path.stem.split("-") compiler = parts[0] reference_compiler = "clang" if compiler == "clang" else "gcc" reference_path = ROOT / f"Saved/Linux/l14-final-crossing-24m-{reference_compiler}-w12.log" expected = PATTERN.findall(reference_path.read_text(encoding="utf-8")) actual = PATTERN.findall(path.read_text(encoding="utf-8", errors="replace")) if actual != expected: failed.append(path.name) print(f"[CrossingReferenceMismatch] {path.name} expected_rows={len(expected)} " f"actual_rows={len(actual)}") print(f"[CrossingSurfaceHashGate] reference=L14-final-crossing-24m-W12 rows={len(logs)} " f"result={'FAIL' if failed else 'PASS'}") raise SystemExit(1 if failed or len(logs) != 14 else 0)