feat: add per-second GCP-format trials with history, watch and HTTP access (FPGA v10)

This commit is contained in:
randogoth 2026-10-25 18:23:18 +02:00
parent d821b77d3b
commit 6bee626b7f
12 changed files with 475 additions and 29 deletions

View file

@ -99,6 +99,25 @@ def main() -> None:
device.serial.reset_input_buffer()
check(trials == sorted(trials) and len(set(trials)) == 3, f"watch stats pushed trials {trials}")
check(device.json("watch gcp") == {"ok": True}, "watch gcp")
seconds = [json.loads(device.serial.readline()) for _ in range(3)]
device.json("watch off")
device.serial.reset_input_buffer()
numbers = [r.get("second") for r in seconds]
last = seconds[-1]
check(numbers == list(range(numbers[0], numbers[0] + 3)), f"watch gcp pushed consecutive seconds {numbers}")
check(last["healthy"] == 15 and last["sample"]["bits"] == 200
and all(0 <= s <= 200 for s in last["sample"]["sums"]),
f"gcp sample: sums {last['sample']['sums']}, Stouffer {last['sample']['stouffer']}")
check(abs(last["full"]["bits"] - 24_000_000) <= 1,
f"gcp full: {last['full']['bits']} bits, z {last['full']['z']}, Stouffer {last['full']['stouffer']}")
device.entropy_bin(65536)
time.sleep(1.1)
records = device.json(f"gcp {numbers[-1]}").get("records", [])
after = [r["second"] for r in records]
check(len(after) >= 1 and after == list(range(numbers[-1] + 1, numbers[-1] + 1 + len(after))),
f"gcp {numbers[-1]}: no gap across an entropy transfer, seconds {after}")
if args.onod.exists():
sample = Path("captures/api_entropy.bin")
sample.parent.mkdir(exist_ok=True)