aboutsummaryrefslogtreecommitdiff
path: root/tests/check_generators.py
diff options
context:
space:
mode:
author_ov4 <ov4@ov4.one>2026-10-16 20:54:00 +0800
committer_ov4 <ov4@ov4.one>2026-10-16 20:54:00 +0800
commit670b0d8a4669d939b09b4990be89173805831215 (patch)
tree0a4ea2f071ed574b62782cb0002ddf6eec2bb5c3 /tests/check_generators.py
parentf1f01c0622a9045e26335f5715a42342d0191dcd (diff)
ci(compiler): gate platform packages on reproducible compiler tests
Run all three suites on Linux, macOS and Windows with the push SHA as seed. Retain failure evidence and document the 12 existing failures, pending human review and remaining coverage gaps. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Diffstat (limited to 'tests/check_generators.py')
-rw-r--r--tests/check_generators.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/check_generators.py b/tests/check_generators.py
new file mode 100644
index 0000000..2b92789
--- /dev/null
+++ b/tests/check_generators.py
@@ -0,0 +1,26 @@
+#!/usr/bin/env python3
+"""Require identical generated input bytes across platforms and Perl versions."""
+
+import hashlib
+import json
+from pathlib import Path
+import subprocess
+import sys
+
+
+directory = Path(__file__).resolve().parent / "ii"
+vectors = json.loads((directory / "generator-vectors.json").read_text(encoding="utf-8"))
+for name, digest in vectors.items():
+ command = [sys.argv[1], str(directory / name / "generate.pl")]
+ outputs = []
+ for seed in ["0" * 40, "0" * 40, "1" * 40]:
+ result = subprocess.run([*command, seed, "100"], check=True, stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE, timeout=10)
+ if result.stderr:
+ raise RuntimeError(f"{name}: unexpected stderr {result.stderr!r}")
+ outputs.append(result.stdout)
+ if outputs[0] != outputs[1] or outputs[0] == outputs[2]:
+ raise RuntimeError(f"{name}: seed reproducibility failed")
+ if hashlib.sha256(outputs[0]).hexdigest() != digest:
+ raise RuntimeError(f"{name}: generated input differs from the portable test vector")
+ print(f"PASS {name}: repeatable, seed-sensitive, portable bytes")