#!/usr/bin/env python3 # Writes tests/FxAudit173dKnown.inc from a scripts/fxaudit.sh survey (--tsv): for every control the survey found # dependent-ok, the prerequisite that woke it up (the regression test tries it first, and searches only for the # controls it doesn't know). Usage: scripts/fxaudit-known.py survey.tsv > tests/FxAudit173dKnown.inc import csv import sys rows = [] with open(sys.argv[1], newline="") as f: for r in csv.DictReader(f, delimiter="\t"): if r.get("status") == "dependent-ok" and r.get("key"): rows.append((r["effect"], r["control"], r["key"])) def q(s): return '"' + s.replace("\\", "\\\\").replace('"', '\\"') + '"' print("// Generated by scripts/fxaudit-known.py from a scripts/fxaudit.sh survey (round 173d): the prerequisite each") print("// dependent control needs (effect, control, key of fxaudit::prerequisite). Regenerate after a survey.") for e, c, k in sorted(set(rows)): print("{ %s, %s, %s }," % (q(e), q(c), q(k)))