#!/usr/bin/env python3 """Print one line per condition from a run-trials.py result file, and the gate verdict. python3 summarize.py results-*.json """ import json import sys from collections import Counter def c_outcome(t): c = t.get("post_open_C", {}) if not c.get("opened"): return f"open {c.get('errno')}" if "read_errno" in c: return f"opened, read {c['read_errno']}" return "opened, bytes ok" if c.get("content_ok") else "opened, BYTES WRONG" for path in sys.argv[1:]: d = json.load(open(path)) print(f"== {path} sshfs -o {','.join(o for o in d['sshfs_base'] if not o.startswith(('IdentityFile', 'UserKnownHosts')))}") by = {} for t in d["trials"]: by.setdefault(t["cond"], []).append(t) verdict = [] for cond, ts in by.items(): aborted = [t["aborted"] for t in ts if "aborted" in t] ok = [t for t in ts if "aborted" not in t] oc = Counter(c_outcome(t) for t in ok) held = Counter("ok" if t["post_held_B"].get("content_ok") else str(t["post_held_B"]) for t in ok) lst = Counter(str(t["post_list"].get("n", t["post_list"].get("errno"))) for t in ok) print(f" {cond:14} n={len(ok)} aborted={len(aborted)} open C: {dict(oc)} held B: {dict(held)} " f"cached list: {dict(lst)}" + (f" abort: {aborted[0][:80]}" if aborted else "")) if cond in ("default", "aggressive") and ok: denied = sum(1 for t in ok if not t["post_open_C"].get("opened") or "read_errno" in t["post_open_C"]) verdict.append(f"{cond}: C denied {denied}/{len(ok)}") if cond == "null" and ok: verdict.append(f"null: C served {sum(1 for t in ok if c_outcome(t) == 'opened, bytes ok')}/{len(ok)}") print(" verdict:", "; ".join(verdict) or "no usable trials")