forge
Explore
Log in

Don't you dare go Hollow

edith_codecs

Clone
★ 0

0 watching0 forksRust375.8 MiB76482dfTahinlijust now4210 commits

dbg.py33 lines, 1.9 KiBHistoryRawDownload
1import json, os, sys
2sys.argv = ["x", os.path.expanduser("~/lanes/testcut-p2-h265-c1/out"), "pixel_pipeline_runs_over_conformance_streams", "1"]
3src = open(os.path.join(os.getcwd(), "lanes/testcut/p2h265-tools/sample.py")).read().split("cands = []")[0]
4exec(src)
5muts = json.load(open(f"{out}/mutants.json"))
6nf = sum(1 for m in muts if tail(m["file"]) in {k[0] for k in fast})
7print("mutants", len(muts), "file-matched", nf, "fast funcs", len(fast), "sample files", list({k[0] for k in fast})[:3], "mut files", list({tail(m["file"]) for m in muts})[:3])
8found = inT = 0
9for m in muts:
10 f = tail(m["file"]); line = m["span"]["start"]["line"]
11 hits = [fn for k, fn in fast.items() if k[0] == f and fn["lo"] <= line <= fn["hi"]]
12 if hits:
13 found += 1
14 b = min(hits, key=lambda fn: fn["hi"] - fn["lo"])
15 t = T.get((b["file"], b["name"]))
16 if t and t["covered_regions"]:
17 inT += 1
18print("found", found, "inT", inT, "Tfuncs", len(T), "sample T keys", list(T)[:2])
19print("T funcs with covered", sum(1 for f in T.values() if f["covered_regions"]), "fast hits>0", sum(1 for f in fast.values() if f["hits"]>0))
20import itertools
21print("sample covered T:", [ (k[1][:60], len(v["covered_regions"])) for k,v in itertools.islice(((k,v) for k,v in T.items() if v["covered_regions"]),3)])
22cnt = 0
23for m in muts[:4000]:
24 f = tail(m["file"]); line = m["span"]["start"]["line"]
25 hits = [fn for k, fn in fast.items() if k[0] == f and fn["lo"] <= line <= fn["hi"]]
26 if hits:
27 b = min(hits, key=lambda fn: fn["hi"] - fn["lo"])
28 t = T.get((b["file"], b["name"]))
29 if cnt < 3:
30 print("MUT", f, line, "fn", b["name"][-40:], "inT", t is not None, "covered", len(t["covered_regions"]) if t else None, "fast hits", b["hits"])
31 cnt += 1
32 if cnt >= 3: break
33print("Tcovered files", sorted({k[0] for k,v in T.items() if v["covered_regions"]})[:8])