"""Small local functional check; its timings are not performance evidence.""" import csv import io import subprocess import sys import tempfile from pathlib import Path binary = Path(sys.argv[1]).resolve() for mode in ("stepped-prepared", "owner-stepped-prepared", "owner-async-prepared", "owner-bounded-prepared"): with tempfile.TemporaryDirectory(prefix="zlay-owner-check-") as directory: result = subprocess.run( [str(binary), directory, "128", "2", "16", "100", "10", mode, "64", "128", "2", "1000", "8", "--allocator=c"], check=True, capture_output=True, text=True, timeout=60, ) rows = list(csv.DictReader(io.StringIO(result.stdout))) assert len(rows) == 1, result.stdout row = rows[0] assert int(row["submitted"]) == 256, row assert int(row["verified_pairs"]) == 384, row assert int(row["failed"]) == 0, row assert int(row["maintenance_after_ack"]) == int(mode.startswith("owner-")), row assert int(row["compaction_steps"]) > 0, row if mode.startswith(("owner-async", "owner-bounded")): assert int(row["background_writes"]) == 1, row assert int(row["background_puts"]) > 0, row assert int(row["background_put_ns"]) > 0, row assert int(row["maintenance_pending_polls"]) > 0, row assert int(row["log_gc_names"]) == (8 if mode.startswith("owner-bounded") else 0), row if mode.startswith("owner-bounded"): assert int(row["log_gc_steps"]) > 0, row print(f"{mode}: all 384 pairs verified after drain and reopen", flush=True)