#!/usr/bin/env python3 """Recheck the final candidate against the L75 logs captured by RunHashMatrixL76.""" from __future__ import annotations import json from pathlib import Path import RunHashMatrixL76 as matrix REFERENCE_OUT = matrix.OUT FINAL_OUT = matrix.ROOT / "Saved/Linux/l76/hashes/final-clean" matrix.OUT = FINAL_OUT def main() -> int: FINAL_OUT.mkdir(parents=True, exist_ok=True) rows, comparisons = [], [] for compiler in matrix.BINARIES: for workers in (1, 8, 12): for strate in range(4): reference = REFERENCE_OUT / compiler / f"w{workers}" / f"strate{strate}-before.log" candidate = matrix.run(compiler, workers, strate, "after") rows.append(candidate) comparison = matrix.compare(reference, matrix.ROOT / candidate["log"]) comparison.update(compiler=compiler, workers=workers, strate=strate) comparisons.append(comparison) print("[L76HashFinalCompare] " + json.dumps(comparison, sort_keys=True), flush=True) if not comparison["equal"]: raise SystemExit(f"hash mismatch; see {comparison['candidate']}") result = {"candidate_runs": rows, "comparisons": comparisons, "equal": all(row["equal"] for row in comparisons), "reference_matrix": str(REFERENCE_OUT.relative_to(matrix.ROOT))} (FINAL_OUT / "summary.json").write_text(json.dumps(result, indent=2) + "\n", encoding="utf-8") return 0 if __name__ == "__main__": raise SystemExit(main())