From 9f41e35e0c2dcb4cf508578029f9f584a29e77ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Fri, 23 Oct 2026 16:11:27 +0300 Subject: [PATCH] testcut P2 ec-h265: unfinished lane report and tool fixes --- lanes/testcut/p2-h265.md | 33 ++++++++++++ lanes/testcut/p2h265-tools/analyze-all.sh | 9 ++++ lanes/testcut/p2h265-tools/analyze.py | 27 ++++++++++ lanes/testcut/p2h265-tools/bc_all.sh | 33 ++++++++++++ lanes/testcut/p2h265-tools/cov.sh | 26 ++++++++++ lanes/testcut/p2h265-tools/dbg.py | 33 ++++++++++++ lanes/testcut/p2h265-tools/mut.sh | 34 +++++++++++++ lanes/testcut/p2h265-tools/outcomes.py | 13 +++++ lanes/testcut/p2h265-tools/resample.sh | 5 ++ lanes/testcut/p2h265-tools/runA.sh | 19 +++++++ lanes/testcut/p2h265-tools/sample.py | 61 +++++++++++++++++++++++ lanes/testcut/p2h265-tools/smoke.sh | 12 +++++ 12 files changed, 305 insertions(+) create mode 100644 lanes/testcut/p2-h265.md create mode 100755 lanes/testcut/p2h265-tools/analyze-all.sh create mode 100644 lanes/testcut/p2h265-tools/analyze.py create mode 100644 lanes/testcut/p2h265-tools/bc_all.sh create mode 100755 lanes/testcut/p2h265-tools/cov.sh create mode 100644 lanes/testcut/p2h265-tools/dbg.py create mode 100755 lanes/testcut/p2h265-tools/mut.sh create mode 100644 lanes/testcut/p2h265-tools/outcomes.py create mode 100644 lanes/testcut/p2h265-tools/resample.sh create mode 100755 lanes/testcut/p2h265-tools/runA.sh create mode 100644 lanes/testcut/p2h265-tools/sample.py create mode 100644 lanes/testcut/p2h265-tools/smoke.sh diff --git a/lanes/testcut/p2-h265.md b/lanes/testcut/p2-h265.md new file mode 100644 index 00000000..0b871374 --- /dev/null +++ b/lanes/testcut/p2-h265.md @@ -0,0 +1,33 @@ +# testcut Phase 2: ec-h265 lane (testcut-p2-h265) + +Status: UNFINISHED. Budget (about 6 host-hours) exhausted by mutant cost alone. Per protocol, every unfinished candidate is kept. Deleted tests: 0. Seconds saved: 0. + +## Why it stopped +- Fast suite (`cargo nextest run --profile fast -p ec-h265`) takes 576 s per run on c. Each mutant costs one rebuild plus one fast-suite run, so about 10 min. The 60-mutant-per-candidate sample for 5 candidates (about 300 mutants in the union) would take about 50 host-hours. +- Smoke run (2 names via `--re`): cargo-mutants selected 32 mutants instead of 2, and 4 of them hit the 300 s test timeout. The run was stopped by PID on c. No kill evidence was produced from it. +- Earlier "eligible 0" bug is fixed: `sample.py` now finds 4558 eligible mutants for the first candidate, with all 60 sampled from U(T) functions. +- Earlier run A "all unviable" was a runner failure in the cargo-mutants scratch copy (`git rev-parse` fallback, code 104). Not a test result. + +## Protocol table (all kept, unfinished) +| crate | test | seconds | class | |U(T)| | mutants tried | |S| | |K| | |K'| | decision | +|---|---|---|---|---|---|---|---|---|---| +| ec-h265 | pixel_pipeline_runs_over_conformance_streams | 142.99 | pseudo (asserts nothing on output, prints only) | 223 | 0 | - | - | - | keep (unfinished) | +| ec-h265 | motion_derivation_is_deterministic_over_conformance_streams | 119.18 | candidate (asserts determinism and zero slice failures) | 148 | 0 | - | - | - | keep (unfinished) | +| ec-h265 | cu_syntax_sweep_over_conformance_streams | 54.75 | pseudo (prints table only) | 171 | 0 | - | - | - | keep (unfinished) | +| ec-h265 | ffmpeg_decodes_bit_exactly_at_every_shape | 47.80 | candidate (bit-exact vs ffmpeg) | 57 | 0 | - | - | - | keep (unfinished) | +| ec-h265 | noisy_near_black_lands_within_five_percent | 41.17 | candidate (rate tolerance) | 84 | 0 | - | - | - | keep (unfinished) | +| ec-h265 | conformance_pictures_match_the_sei_hash | 85.08 | protected (conformance) | - | - | - | - | - | protected | +| ec-h265 | rext_conformance_pictures_match_the_sei_hash | 83.30 | protected (conformance) | - | - | - | - | - | protected | +| ec-h265 | conformance_output_order_matches_ffprobe | 133.71 | protected (conformance) | - | - | - | - | - | protected | +| ec-h265 | speedup_curve | 114.86 | protected (perf tripwire) | - | - | - | - | - | protected | +| ec-h265 | ctb_32_is_the_faster_tree_at_1080p | 165.46 | protected (perf tripwire) | - | - | - | - | - | protected | +| ec-h265 | intra_1080p_beats_the_incumbent_on_twelve_threads | 451.04 | protected (perf tripwire) | - | - | - | - | - | protected | + +Also in the same crate: `inter_placeholder_runs_over_pb_slices` (tests/it/cu_syntax.rs) was not in the heavy list and was not checked. + +## Summary +1. Tests deleted: 0. +2. Seconds saved: 0. +3. Kept with evidence: none. All five candidates are unfinished and kept. +4. Tooling fixes: sample.py mapping fine; run A runner issue is in a scratch copy and needs a fresh sync. +5. Next step if resumed: one mutant per fast run is too expensive. Needs either a per-test kill matrix on a precomputed fast-suite target, or a smaller sample (about 10 mutants per candidate). diff --git a/lanes/testcut/p2h265-tools/analyze-all.sh b/lanes/testcut/p2h265-tools/analyze-all.sh new file mode 100755 index 00000000..75b469e2 --- /dev/null +++ b/lanes/testcut/p2h265-tools/analyze-all.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash +set -uo pipefail +OUT=$HOME/lanes/testcut-p2-h265-c1/out +TOOLS=$PWD/lanes/testcut/p2h265-tools +NAMES="pixel_pipeline_runs_over_conformance_streams motion_derivation_is_deterministic_over_conformance_streams cu_syntax_sweep_over_conformance_streams ffmpeg_decodes_bit_exactly_at_every_shape noisy_near_black_lands_within_five_percent" +python3 "$TOOLS/analyze.py" "$OUT" $NAMES +cargo mutants -p ec-h265 --list --json > "$OUT/mutants.json" 2> "$OUT/mutants.list.err" +echo "mutants listed: $(python3 -c 'import json,sys;print(len(json.load(open(sys.argv[1]))))' "$OUT/mutants.json")" +for t in $NAMES; do python3 "$TOOLS/sample.py" "$OUT" "$t" 60; done diff --git a/lanes/testcut/p2h265-tools/analyze.py b/lanes/testcut/p2h265-tools/analyze.py new file mode 100644 index 00000000..f2355fd8 --- /dev/null +++ b/lanes/testcut/p2h265-tools/analyze.py @@ -0,0 +1,27 @@ +import json, sys, collections +out, names = sys.argv[1], sys.argv[2:] +def load(n): + return json.load(open(f"{out}/{n}.json"))["data"][0] +def regions(data): + s = {} + for fn in data["functions"]: + for r in fn["regions"]: + fname = fn["filenames"][r[5]] + key = (fn["name"], fname, r[0], r[1], r[2], r[3], r[7]) + s[key] = max(s.get(key, 0), r[4]) + return s +fast = load("fast") +fr = regions(fast) +fast_cov = {k for k, v in fr.items() if v > 0} +res = {} +for n in names: + d = load(n) + r = regions(d) + cov = {k for k, v in r.items() if v > 0} + u = cov - fast_cov + fns = collections.Counter() + for k in u: + fi = k[1].find("ec-h265/"); fns[(k[1][fi + 8:] if fi >= 0 else None, k[0])] += 1 + res[n] = {"covered": len(cov), "U": len(u), "U_functions": [[f, fn, c] for (f, fn), c in fns.items() if f]} + print(n, "covered", len(cov), "U", len(u), "funcs", len(fns)) +json.dump({"fast_regions": len(fast_cov), "per_test": res}, open(f"{out}/coverage-summary.json", "w")) diff --git a/lanes/testcut/p2h265-tools/bc_all.sh b/lanes/testcut/p2h265-tools/bc_all.sh new file mode 100644 index 00000000..d8538efd --- /dev/null +++ b/lanes/testcut/p2h265-tools/bc_all.sh @@ -0,0 +1,33 @@ +#!/usr/bin/env bash +# Run B (T only) and run C (remaining heavy tests) per candidate, in decreasing runtime order. +set -uo pipefail +export EC_REQUIRE_FIXTURES=1 +OUT=$HOME/lanes/testcut-p2-h265-c1/out +TOOLS=$PWD/lanes/testcut/p2h265-tools +ALLHEAVY="pixel_pipeline_runs_over_conformance_streams motion_derivation_is_deterministic_over_conformance_streams cu_syntax_sweep_over_conformance_streams ffmpeg_decodes_bit_exactly_at_every_shape noisy_near_black_lands_within_five_percent conformance_pictures_match_the_sei_hash rext_conformance_pictures_match_the_sei_hash conformance_output_order_matches_ffprobe speedup_curve ctb_32_is_the_faster_tree_at_1080p intra_1080p_beats_the_incumbent_on_twelve_threads" +CANDS="pixel_pipeline_runs_over_conformance_streams motion_derivation_is_deterministic_over_conformance_streams cu_syntax_sweep_over_conformance_streams ffmpeg_decodes_bit_exactly_at_every_shape noisy_near_black_lands_within_five_percent" +PSEUDO=" pixel_pipeline_runs_over_conformance_streams cu_syntax_sweep_over_conformance_streams " +DELETED="" +expr() { local out=""; for n in "$@"; do out="${out:+$out | }test(/(^|::)$n\$/)"; done; echo "$out"; } +for T in $CANDS; do + python3 -c 'import json,sys; sm=set(json.load(open(sys.argv[1]))); S=set(l.rstrip("\n") for l in open(sys.argv[2]) if l.strip()); print("\n".join(sorted(sm & S)))' "$OUT/sample-$T.json" "$OUT/A.S.txt" > "$OUT/$T.SA.txt" + SN=$(wc -l < "$OUT/$T.SA.txt") + echo "== $T S=$SN" + if [ "$SN" -eq 0 ]; then echo "DECIDE $T K=0 S=0 -> delete"; DELETED="$DELETED $T"; continue; fi + RES=$(python3 -c 'import re,sys; print("|".join(re.escape(l.rstrip("\n")) for l in open(sys.argv[1]) if l.strip()))' "$OUT/$T.SA.txt") + cargo mutants -p ec-h265 --test-tool nextest --baseline skip --timeout-multiplier 3 --re "$RES" --cargo-test-arg=-E --cargo-test-arg="$(expr $T)" -o "$OUT/$T.B" > "$OUT/$T.B.log" 2>&1 + python3 "$TOOLS/outcomes.py" "$OUT/$T.B/mutants.out/outcomes.json" killed > "$OUT/$T.K.txt" + KN=$(wc -l < "$OUT/$T.K.txt") + echo "$T K=$KN" + if [ "$KN" -eq 0 ]; then echo "DECIDE $T K=0 -> delete"; DELETED="$DELETED $T"; continue; fi + if [[ "$PSEUDO" == *" $T "* ]]; then echo "DECIDE $T pseudo weak-oracle kills $KN -> keep"; continue; fi + REM=""; for h in $ALLHEAVY; do case " $DELETED $T " in *" $h "*) ;; *) REM="$REM $h";; esac; done + KRE=$(python3 -c 'import re,sys; print("|".join(re.escape(l.rstrip("\n")) for l in open(sys.argv[1]) if l.strip()))' "$OUT/$T.K.txt") + cargo mutants -p ec-h265 --test-tool nextest --baseline skip --timeout-multiplier 3 --re "$KRE" --cargo-test-arg=-E --cargo-test-arg="$(expr $REM)" -o "$OUT/$T.C" > "$OUT/$T.C.log" 2>&1 + python3 "$TOOLS/outcomes.py" "$OUT/$T.C/mutants.out/outcomes.json" killed > "$OUT/$T.Kc.txt" + comm -23 <(sort "$OUT/$T.K.txt") <(sort "$OUT/$T.Kc.txt") > "$OUT/$T.Kp.txt" + KP=$(wc -l < "$OUT/$T.Kp.txt") + echo "$T K'=$KP" + if [ "$KP" -eq 0 ]; then echo "DECIDE $T K'=0 -> delete"; DELETED="$DELETED $T"; else echo "DECIDE $T K'=$KP -> keep"; fi +done +echo "DELETED:$DELETED" diff --git a/lanes/testcut/p2h265-tools/cov.sh b/lanes/testcut/p2h265-tools/cov.sh new file mode 100755 index 00000000..e67a073f --- /dev/null +++ b/lanes/testcut/p2h265-tools/cov.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash +# Phase 2 coverage pass for ec-h265 (runs on the server inside the synced tree). +set -uo pipefail +export EC_REQUIRE_FIXTURES=1 +OUT=$HOME/lanes/testcut-p2-h265-c1/out +mkdir -p "$OUT" +PROF=${CARGO_TARGET_DIR:-$PWD/target}/llvm-cov-target +run_cov() { + local name=$1; shift + cargo llvm-cov clean --profraw-only > /dev/null 2>&1 + find "$PROF" -name '*.profraw' -delete 2>/dev/null + cargo llvm-cov nextest --release --no-fail-fast -p ec-h265 --no-report "$@" > "$OUT/$name.run.log" 2>&1 + echo "$name nextest exit $?" + PD=$(rustc --print sysroot)/lib/rustlib/x86_64-unknown-linux-gnu/bin/llvm-profdata + for f in $(find "$PROF" -name '*.profraw' 2>/dev/null); do + if ! "$PD" show "$f" > /dev/null 2>&1; then echo "$name: dropping corrupt $f"; rm -f "$f"; fi + done + cargo llvm-cov report --release --json --output-path "$OUT/$name.json" > "$OUT/$name.rep.log" 2>&1 + echo "$name report exit $?" +} +cargo llvm-cov clean --workspace > /dev/null 2>&1 +run_cov fast --profile fast +for t in pixel_pipeline_runs_over_conformance_streams motion_derivation_is_deterministic_over_conformance_streams cu_syntax_sweep_over_conformance_streams ffmpeg_decodes_bit_exactly_at_every_shape noisy_near_black_lands_within_five_percent; do + run_cov "$t" -E "test(/(^|::)$t\$/)" +done +grep -h -E "PASS|FAIL|Summary" "$OUT"/*.run.log | tail -40 diff --git a/lanes/testcut/p2h265-tools/dbg.py b/lanes/testcut/p2h265-tools/dbg.py new file mode 100644 index 00000000..11c1d09b --- /dev/null +++ b/lanes/testcut/p2h265-tools/dbg.py @@ -0,0 +1,33 @@ +import json, os, sys +sys.argv = ["x", os.path.expanduser("~/lanes/testcut-p2-h265-c1/out"), "pixel_pipeline_runs_over_conformance_streams", "1"] +src = open(os.path.join(os.getcwd(), "lanes/testcut/p2h265-tools/sample.py")).read().split("cands = []")[0] +exec(src) +muts = json.load(open(f"{out}/mutants.json")) +nf = sum(1 for m in muts if tail(m["file"]) in {k[0] for k in fast}) +print("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]) +found = inT = 0 +for m in muts: + f = tail(m["file"]); line = m["span"]["start"]["line"] + hits = [fn for k, fn in fast.items() if k[0] == f and fn["lo"] <= line <= fn["hi"]] + if hits: + found += 1 + b = min(hits, key=lambda fn: fn["hi"] - fn["lo"]) + t = T.get((b["file"], b["name"])) + if t and t["covered_regions"]: + inT += 1 +print("found", found, "inT", inT, "Tfuncs", len(T), "sample T keys", list(T)[:2]) +print("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)) +import itertools +print("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)]) +cnt = 0 +for m in muts[:4000]: + f = tail(m["file"]); line = m["span"]["start"]["line"] + hits = [fn for k, fn in fast.items() if k[0] == f and fn["lo"] <= line <= fn["hi"]] + if hits: + b = min(hits, key=lambda fn: fn["hi"] - fn["lo"]) + t = T.get((b["file"], b["name"])) + if cnt < 3: + 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"]) + cnt += 1 + if cnt >= 3: break +print("Tcovered files", sorted({k[0] for k,v in T.items() if v["covered_regions"]})[:8]) diff --git a/lanes/testcut/p2h265-tools/mut.sh b/lanes/testcut/p2h265-tools/mut.sh new file mode 100755 index 00000000..563e5f11 --- /dev/null +++ b/lanes/testcut/p2h265-tools/mut.sh @@ -0,0 +1,34 @@ +#!/usr/bin/env bash +# usage: mut.sh TEST OTHERS_EXPR (run from the synced tree; OTHERS_EXPR = nextest -E for remaining heavy tests, or empty) +set -uo pipefail +export EC_REQUIRE_FIXTURES=1 +OUT=$HOME/lanes/testcut-p2-h265-c1/out +T=$1; OTHERS=${2:-} +TOOLS=$PWD/lanes/testcut/p2h265-tools +TF="test(/(^|::)$T\$/)" +RE=$(python3 -c 'import json,re,sys; print("|".join(re.escape(n) for n in json.load(open(sys.argv[1]))))' "$OUT/sample-$T.json") +[ -n "$RE" ] || { echo "$T: empty sample"; exit 0; } +COMMON=(cargo mutants -p ec-h265 --test-tool nextest --baseline skip --timeout-multiplier 3 --re "$RE") +echo "== $T run A (fast suite) $(date +%T)" +"${COMMON[@]}" --cargo-test-arg=--profile --cargo-test-arg=fast -o "$OUT/$T.A" > "$OUT/$T.A.log" 2>&1 +echo "A exit $?" +python3 "$TOOLS/outcomes.py" "$OUT/$T.A/mutants.out/outcomes.json" missed > "$OUT/$T.S.txt" +SN=$(wc -l < "$OUT/$T.S.txt") +echo "S=$SN survivors of fast suite" +[ "$SN" -eq 0 ] && { echo "$T: no survivors"; exit 0; } +RES=$(python3 -c 'import re,sys; print("|".join(re.escape(l.rstrip("\n")) for l in open(sys.argv[1]) if l.strip()))' "$OUT/$T.S.txt") +echo "== $T run B (T only) $(date +%T)" +cargo mutants -p ec-h265 --test-tool nextest --baseline skip --timeout-multiplier 3 --re "$RES" --cargo-test-arg=-E --cargo-test-arg="$TF" -o "$OUT/$T.B" > "$OUT/$T.B.log" 2>&1 +echo "B exit $?" +python3 "$TOOLS/outcomes.py" "$OUT/$T.B/mutants.out/outcomes.json" killed > "$OUT/$T.K.txt" +KN=$(wc -l < "$OUT/$T.K.txt") +echo "K=$KN killed by T among S" +[ "$KN" -eq 0 ] && { echo "$T: K empty"; exit 0; } +KRE=$(python3 -c 'import re,sys; print("|".join(re.escape(l.rstrip("\n")) for l in open(sys.argv[1]) if l.strip()))' "$OUT/$T.K.txt") +[ -n "$OTHERS" ] || { echo "$T: no other heavy tests"; exit 0; } +echo "== $T run C (other heavy tests) $(date +%T)" +cargo mutants -p ec-h265 --test-tool nextest --baseline skip --timeout-multiplier 3 --re "$KRE" --cargo-test-arg=-E --cargo-test-arg="$OTHERS" -o "$OUT/$T.C" > "$OUT/$T.C.log" 2>&1 +echo "C exit $?" +python3 "$TOOLS/outcomes.py" "$OUT/$T.C/mutants.out/outcomes.json" killed > "$OUT/$T.Kc.txt" +echo "K'=$(comm -23 <(sort "$OUT/$T.K.txt") <(sort "$OUT/$T.Kc.txt" 2>/dev/null) | wc -l) (see $T.Kp.txt)"; comm -23 <(sort "$OUT/$T.K.txt") <(sort "$OUT/$T.Kc.txt" 2>/dev/null) > "$OUT/$T.Kp.txt" +echo "$T done $(date +%T)" diff --git a/lanes/testcut/p2h265-tools/outcomes.py b/lanes/testcut/p2h265-tools/outcomes.py new file mode 100644 index 00000000..17c894b4 --- /dev/null +++ b/lanes/testcut/p2h265-tools/outcomes.py @@ -0,0 +1,13 @@ +# usage: outcomes.py OUTCOMES_JSON SUMMARY_KIND (kind: missed | killed) -> prints mutant names +import json, sys +data = json.load(open(sys.argv[1])) +kind = sys.argv[2] +want = {"missed": {"MissedMutant"}, "killed": {"CaughtMutant", "Timeout"}}[kind] +rows = data["outcomes"] if isinstance(data, dict) else data +for o in rows: + sc = o.get("scenario") + if not isinstance(sc, dict) or "Mutant" not in sc: + continue + if o.get("summary") in want: + m = sc["Mutant"] + print(m.get("name", json.dumps(m))) diff --git a/lanes/testcut/p2h265-tools/resample.sh b/lanes/testcut/p2h265-tools/resample.sh new file mode 100644 index 00000000..825251df --- /dev/null +++ b/lanes/testcut/p2h265-tools/resample.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash +set -uo pipefail +OUT=$HOME/lanes/testcut-p2-h265-c1/out +TOOLS=$PWD/lanes/testcut/p2h265-tools +for t in pixel_pipeline_runs_over_conformance_streams motion_derivation_is_deterministic_over_conformance_streams cu_syntax_sweep_over_conformance_streams ffmpeg_decodes_bit_exactly_at_every_shape noisy_near_black_lands_within_five_percent; do python3 "$TOOLS/sample.py" "$OUT" "$t" 60; done diff --git a/lanes/testcut/p2h265-tools/runA.sh b/lanes/testcut/p2h265-tools/runA.sh new file mode 100755 index 00000000..9bc76c80 --- /dev/null +++ b/lanes/testcut/p2h265-tools/runA.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash +# Shared run A: fast suite vs union of all candidate samples. Writes $OUT/A.S.txt (survivors). +set -uo pipefail +export EC_REQUIRE_FIXTURES=1 +OUT=$HOME/lanes/testcut-p2-h265-c1/out +TOOLS=$PWD/lanes/testcut/p2h265-tools +python3 -c 'import json,glob +u=[] +for f in sorted(glob.glob("'$OUT'/sample-*.json")): + for n in json.load(open(f)): + if n not in u: u.append(n) +json.dump(u, open("'$OUT'/union.json","w")); print("union", len(u))' +RE=$(python3 -c 'import json,re,sys; print("|".join(re.escape(n) for n in json.load(open(sys.argv[1]))))' "$OUT/union.json") +cargo mutants --help 2>&1 | grep -E "^ +--(release|test-tool|cargo-test-arg|in-place|baseline)" | head -6 +cargo mutants -p ec-h265 --test-tool nextest --baseline skip --timeout-multiplier 3 --re "$RE" --cargo-test-arg=--profile --cargo-test-arg=fast -o "$OUT/A" > "$OUT/A.log" 2>&1 +echo "A exit $?" +python3 "$TOOLS/outcomes.py" "$OUT/A/mutants.out/outcomes.json" missed > "$OUT/A.S.txt" +echo "S=$(wc -l < "$OUT/A.S.txt")" +python3 -c 'import json,collections; print(collections.Counter(o.get("summary") for o in json.load(open("'$OUT'/A/mutants.out/outcomes.json"))["outcomes"]))' 2>/dev/null diff --git a/lanes/testcut/p2h265-tools/sample.py b/lanes/testcut/p2h265-tools/sample.py new file mode 100644 index 00000000..bf8a57d0 --- /dev/null +++ b/lanes/testcut/p2h265-tools/sample.py @@ -0,0 +1,61 @@ +# usage: sample.py OUT TEST MAXN -> writes OUT/sample-TEST.json (names in priority order) +import json, sys, collections +out, test, maxn = sys.argv[1], sys.argv[2], int(sys.argv[3]) +def tail(p): + i = p.find("ec-h265/") + return p[i + len("ec-h265/"):] if i >= 0 else None +def load(n): + return json.load(open(f"{out}/{n}.json"))["data"][0] +def funcs(data): + res = [] # (file, name, lo, hi, fast_hits_or_covered_hits, uncov_hits) + for fn in data["functions"]: + fl = [tail(fn["filenames"][r[5]]) for r in fn["regions"][:1]] + if fl[0] is None: + continue + lo = min(r[0] for r in fn["regions"]); hi = max(r[2] for r in fn["regions"]) + res.append({"file": fl[0], "name": fn["name"], "lo": lo, "hi": hi, + "hits": sum(r[4] for r in fn["regions"]), + "covered_regions": {(r[0], r[1], r[2], r[3], r[7]) for r in fn["regions"] if r[4] > 0}}) + return res +def merged(lst): + d = {} + for f in lst: + k = (f["file"], f["name"]) + if k not in d: + d[k] = dict(f) + continue + m = d[k] + m["hits"] += f["hits"] + m["lo"] = min(m["lo"], f["lo"]); m["hi"] = max(m["hi"], f["hi"]) + m["covered_regions"] = m["covered_regions"] | f["covered_regions"] + return d +fast = merged(funcs(load("fast"))) +T = merged(funcs(load(test))) +cov = json.load(open(f"{out}/coverage-summary.json"))["per_test"][test] +ufuncs = {(x[0], x[1]) for x in cov["U_functions"]} +muts = json.load(open(f"{out}/mutants.json")) +cands = [] +for m in muts: + f = tail(m["file"]) if "ec-h265/" in m["file"] else m["file"] + if f is None: + continue + line = m["span"]["start"]["line"] + best = None + for key, fn in fast.items(): + if key[0] != f or not (fn["lo"] <= line <= fn["hi"]): + continue + t = T.get(key) + if t is None or not t["covered_regions"]: + continue + if best is None or (fn["hi"] - fn["lo"]) < (best["hi"] - best["lo"]): + best = fn + if best is None: + continue + key = (best["file"], best["name"]) + t = T.get(key) + prio = 0 if key in ufuncs else 1 + cands.append((prio, fast[key]["hits"], m["name"])) +cands.sort() +names = [c[2] for c in cands[:maxn]] +json.dump(names, open(f"{out}/sample-{test}.json", "w")) +print(test, "eligible", len(cands), "sampled", len(names), "U-funcs-prio", sum(1 for c in cands[:maxn] if c[0] == 0)) diff --git a/lanes/testcut/p2h265-tools/smoke.sh b/lanes/testcut/p2h265-tools/smoke.sh new file mode 100644 index 00000000..5c21fb63 --- /dev/null +++ b/lanes/testcut/p2h265-tools/smoke.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +# Smoke: two mutants from the union sample through the fast suite, to time one mutant and check the runner. +set -uo pipefail +export EC_REQUIRE_FIXTURES=1 +OUT=$HOME/lanes/testcut-p2-h265-c1/out +mkdir -p "$OUT" +python3 -c 'import json,sys; print("\n".join(json.load(open(sys.argv[1]))[:2]))' "$OUT/sample-pixel_pipeline_runs_over_conformance_streams.json" > "$OUT/smoke.names" +RE=$(python3 -c 'import re,sys; print("|".join(re.escape(l.rstrip("\n")) for l in open(sys.argv[1]) if l.strip()))' "$OUT/smoke.names") +date +%T +cargo mutants -p ec-h265 --test-tool nextest --baseline skip --timeout-multiplier 3 --re "$RE" --cargo-test-arg=--profile --cargo-test-arg=fast -o "$OUT/smoke" > "$OUT/smoke.log" 2>&1 +echo "exit $?"; date +%T +tail -5 "$OUT/smoke.log"