testcut P2 ec-h265: unfinished lane report and tool fixes
Browse files at this commit9f41e35e0c2dcb4cf508578029f9f584a29e77efParent: 6bdd14112 changed files +305 -0
- lanes/testcut/p2-h265.md +33 -0
- lanes/testcut/p2h265-tools/analyze-all.sh +9 -0
- lanes/testcut/p2h265-tools/analyze.py +27 -0
- lanes/testcut/p2h265-tools/bc_all.sh +33 -0
- lanes/testcut/p2h265-tools/cov.sh +26 -0
- lanes/testcut/p2h265-tools/dbg.py +33 -0
- lanes/testcut/p2h265-tools/mut.sh +34 -0
- lanes/testcut/p2h265-tools/outcomes.py +13 -0
- lanes/testcut/p2h265-tools/resample.sh +5 -0
- lanes/testcut/p2h265-tools/runA.sh +19 -0
- lanes/testcut/p2h265-tools/sample.py +61 -0
- lanes/testcut/p2h265-tools/smoke.sh +12 -0
lanes/testcut/p2-h265.mdadded+33 -0
| @@ -0,0 +1,33 @@ | ||
| 1 | +# testcut Phase 2: ec-h265 lane (testcut-p2-h265) | |
| 2 | + | |
| 3 | +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. | |
| 4 | + | |
| 5 | +## Why it stopped | |
| 6 | +- 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. | |
| 7 | +- 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. | |
| 8 | +- 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. | |
| 9 | +- 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. | |
| 10 | + | |
| 11 | +## Protocol table (all kept, unfinished) | |
| 12 | +| crate | test | seconds | class | |U(T)| | mutants tried | |S| | |K| | |K'| | decision | | |
| 13 | +|---|---|---|---|---|---|---|---|---|---| | |
| 14 | +| ec-h265 | pixel_pipeline_runs_over_conformance_streams | 142.99 | pseudo (asserts nothing on output, prints only) | 223 | 0 | - | - | - | keep (unfinished) | | |
| 15 | +| ec-h265 | motion_derivation_is_deterministic_over_conformance_streams | 119.18 | candidate (asserts determinism and zero slice failures) | 148 | 0 | - | - | - | keep (unfinished) | | |
| 16 | +| ec-h265 | cu_syntax_sweep_over_conformance_streams | 54.75 | pseudo (prints table only) | 171 | 0 | - | - | - | keep (unfinished) | | |
| 17 | +| ec-h265 | ffmpeg_decodes_bit_exactly_at_every_shape | 47.80 | candidate (bit-exact vs ffmpeg) | 57 | 0 | - | - | - | keep (unfinished) | | |
| 18 | +| ec-h265 | noisy_near_black_lands_within_five_percent | 41.17 | candidate (rate tolerance) | 84 | 0 | - | - | - | keep (unfinished) | | |
| 19 | +| ec-h265 | conformance_pictures_match_the_sei_hash | 85.08 | protected (conformance) | - | - | - | - | - | protected | | |
| 20 | +| ec-h265 | rext_conformance_pictures_match_the_sei_hash | 83.30 | protected (conformance) | - | - | - | - | - | protected | | |
| 21 | +| ec-h265 | conformance_output_order_matches_ffprobe | 133.71 | protected (conformance) | - | - | - | - | - | protected | | |
| 22 | +| ec-h265 | speedup_curve | 114.86 | protected (perf tripwire) | - | - | - | - | - | protected | | |
| 23 | +| ec-h265 | ctb_32_is_the_faster_tree_at_1080p | 165.46 | protected (perf tripwire) | - | - | - | - | - | protected | | |
| 24 | +| ec-h265 | intra_1080p_beats_the_incumbent_on_twelve_threads | 451.04 | protected (perf tripwire) | - | - | - | - | - | protected | | |
| 25 | + | |
| 26 | +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. | |
| 27 | + | |
| 28 | +## Summary | |
| 29 | +1. Tests deleted: 0. | |
| 30 | +2. Seconds saved: 0. | |
| 31 | +3. Kept with evidence: none. All five candidates are unfinished and kept. | |
| 32 | +4. Tooling fixes: sample.py mapping fine; run A runner issue is in a scratch copy and needs a fresh sync. | |
| 33 | +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). |
lanes/testcut/p2h265-tools/analyze-all.shadded+9 -0
| @@ -0,0 +1,9 @@ | ||
| 1 | +#!/usr/bin/env bash | |
| 2 | +set -uo pipefail | |
| 3 | +OUT=$HOME/lanes/testcut-p2-h265-c1/out | |
| 4 | +TOOLS=$PWD/lanes/testcut/p2h265-tools | |
| 5 | +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" | |
| 6 | +python3 "$TOOLS/analyze.py" "$OUT" $NAMES | |
| 7 | +cargo mutants -p ec-h265 --list --json > "$OUT/mutants.json" 2> "$OUT/mutants.list.err" | |
| 8 | +echo "mutants listed: $(python3 -c 'import json,sys;print(len(json.load(open(sys.argv[1]))))' "$OUT/mutants.json")" | |
| 9 | +for t in $NAMES; do python3 "$TOOLS/sample.py" "$OUT" "$t" 60; done |
lanes/testcut/p2h265-tools/analyze.pyadded+27 -0
| @@ -0,0 +1,27 @@ | ||
| 1 | +import json, sys, collections | |
| 2 | +out, names = sys.argv[1], sys.argv[2:] | |
| 3 | +def load(n): | |
| 4 | + return json.load(open(f"{out}/{n}.json"))["data"][0] | |
| 5 | +def regions(data): | |
| 6 | + s = {} | |
| 7 | + for fn in data["functions"]: | |
| 8 | + for r in fn["regions"]: | |
| 9 | + fname = fn["filenames"][r[5]] | |
| 10 | + key = (fn["name"], fname, r[0], r[1], r[2], r[3], r[7]) | |
| 11 | + s[key] = max(s.get(key, 0), r[4]) | |
| 12 | + return s | |
| 13 | +fast = load("fast") | |
| 14 | +fr = regions(fast) | |
| 15 | +fast_cov = {k for k, v in fr.items() if v > 0} | |
| 16 | +res = {} | |
| 17 | +for n in names: | |
| 18 | + d = load(n) | |
| 19 | + r = regions(d) | |
| 20 | + cov = {k for k, v in r.items() if v > 0} | |
| 21 | + u = cov - fast_cov | |
| 22 | + fns = collections.Counter() | |
| 23 | + for k in u: | |
| 24 | + fi = k[1].find("ec-h265/"); fns[(k[1][fi + 8:] if fi >= 0 else None, k[0])] += 1 | |
| 25 | + res[n] = {"covered": len(cov), "U": len(u), "U_functions": [[f, fn, c] for (f, fn), c in fns.items() if f]} | |
| 26 | + print(n, "covered", len(cov), "U", len(u), "funcs", len(fns)) | |
| 27 | +json.dump({"fast_regions": len(fast_cov), "per_test": res}, open(f"{out}/coverage-summary.json", "w")) |
lanes/testcut/p2h265-tools/bc_all.shadded+33 -0
| @@ -0,0 +1,33 @@ | ||
| 1 | +#!/usr/bin/env bash | |
| 2 | +# Run B (T only) and run C (remaining heavy tests) per candidate, in decreasing runtime order. | |
| 3 | +set -uo pipefail | |
| 4 | +export EC_REQUIRE_FIXTURES=1 | |
| 5 | +OUT=$HOME/lanes/testcut-p2-h265-c1/out | |
| 6 | +TOOLS=$PWD/lanes/testcut/p2h265-tools | |
| 7 | +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" | |
| 8 | +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" | |
| 9 | +PSEUDO=" pixel_pipeline_runs_over_conformance_streams cu_syntax_sweep_over_conformance_streams " | |
| 10 | +DELETED="" | |
| 11 | +expr() { local out=""; for n in "$@"; do out="${out:+$out | }test(/(^|::)$n\$/)"; done; echo "$out"; } | |
| 12 | +for T in $CANDS; do | |
| 13 | + 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" | |
| 14 | + SN=$(wc -l < "$OUT/$T.SA.txt") | |
| 15 | + echo "== $T S=$SN" | |
| 16 | + if [ "$SN" -eq 0 ]; then echo "DECIDE $T K=0 S=0 -> delete"; DELETED="$DELETED $T"; continue; fi | |
| 17 | + 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") | |
| 18 | + 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 | |
| 19 | + python3 "$TOOLS/outcomes.py" "$OUT/$T.B/mutants.out/outcomes.json" killed > "$OUT/$T.K.txt" | |
| 20 | + KN=$(wc -l < "$OUT/$T.K.txt") | |
| 21 | + echo "$T K=$KN" | |
| 22 | + if [ "$KN" -eq 0 ]; then echo "DECIDE $T K=0 -> delete"; DELETED="$DELETED $T"; continue; fi | |
| 23 | + if [[ "$PSEUDO" == *" $T "* ]]; then echo "DECIDE $T pseudo weak-oracle kills $KN -> keep"; continue; fi | |
| 24 | + REM=""; for h in $ALLHEAVY; do case " $DELETED $T " in *" $h "*) ;; *) REM="$REM $h";; esac; done | |
| 25 | + 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") | |
| 26 | + 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 | |
| 27 | + python3 "$TOOLS/outcomes.py" "$OUT/$T.C/mutants.out/outcomes.json" killed > "$OUT/$T.Kc.txt" | |
| 28 | + comm -23 <(sort "$OUT/$T.K.txt") <(sort "$OUT/$T.Kc.txt") > "$OUT/$T.Kp.txt" | |
| 29 | + KP=$(wc -l < "$OUT/$T.Kp.txt") | |
| 30 | + echo "$T K'=$KP" | |
| 31 | + if [ "$KP" -eq 0 ]; then echo "DECIDE $T K'=0 -> delete"; DELETED="$DELETED $T"; else echo "DECIDE $T K'=$KP -> keep"; fi | |
| 32 | +done | |
| 33 | +echo "DELETED:$DELETED" |
lanes/testcut/p2h265-tools/cov.shadded+26 -0
| @@ -0,0 +1,26 @@ | ||
| 1 | +#!/usr/bin/env bash | |
| 2 | +# Phase 2 coverage pass for ec-h265 (runs on the server inside the synced tree). | |
| 3 | +set -uo pipefail | |
| 4 | +export EC_REQUIRE_FIXTURES=1 | |
| 5 | +OUT=$HOME/lanes/testcut-p2-h265-c1/out | |
| 6 | +mkdir -p "$OUT" | |
| 7 | +PROF=${CARGO_TARGET_DIR:-$PWD/target}/llvm-cov-target | |
| 8 | +run_cov() { | |
| 9 | + local name=$1; shift | |
| 10 | + cargo llvm-cov clean --profraw-only > /dev/null 2>&1 | |
| 11 | + find "$PROF" -name '*.profraw' -delete 2>/dev/null | |
| 12 | + cargo llvm-cov nextest --release --no-fail-fast -p ec-h265 --no-report "$@" > "$OUT/$name.run.log" 2>&1 | |
| 13 | + echo "$name nextest exit $?" | |
| 14 | + PD=$(rustc --print sysroot)/lib/rustlib/x86_64-unknown-linux-gnu/bin/llvm-profdata | |
| 15 | + for f in $(find "$PROF" -name '*.profraw' 2>/dev/null); do | |
| 16 | + if ! "$PD" show "$f" > /dev/null 2>&1; then echo "$name: dropping corrupt $f"; rm -f "$f"; fi | |
| 17 | + done | |
| 18 | + cargo llvm-cov report --release --json --output-path "$OUT/$name.json" > "$OUT/$name.rep.log" 2>&1 | |
| 19 | + echo "$name report exit $?" | |
| 20 | +} | |
| 21 | +cargo llvm-cov clean --workspace > /dev/null 2>&1 | |
| 22 | +run_cov fast --profile fast | |
| 23 | +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 | |
| 24 | + run_cov "$t" -E "test(/(^|::)$t\$/)" | |
| 25 | +done | |
| 26 | +grep -h -E "PASS|FAIL|Summary" "$OUT"/*.run.log | tail -40 |
lanes/testcut/p2h265-tools/dbg.pyadded+33 -0
| @@ -0,0 +1,33 @@ | ||
| 1 | +import json, os, sys | |
| 2 | +sys.argv = ["x", os.path.expanduser("~/lanes/testcut-p2-h265-c1/out"), "pixel_pipeline_runs_over_conformance_streams", "1"] | |
| 3 | +src = open(os.path.join(os.getcwd(), "lanes/testcut/p2h265-tools/sample.py")).read().split("cands = []")[0] | |
| 4 | +exec(src) | |
| 5 | +muts = json.load(open(f"{out}/mutants.json")) | |
| 6 | +nf = sum(1 for m in muts if tail(m["file"]) in {k[0] for k in fast}) | |
| 7 | +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]) | |
| 8 | +found = inT = 0 | |
| 9 | +for 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 | |
| 18 | +print("found", found, "inT", inT, "Tfuncs", len(T), "sample T keys", list(T)[:2]) | |
| 19 | +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)) | |
| 20 | +import itertools | |
| 21 | +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)]) | |
| 22 | +cnt = 0 | |
| 23 | +for 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 | |
| 33 | +print("Tcovered files", sorted({k[0] for k,v in T.items() if v["covered_regions"]})[:8]) |
lanes/testcut/p2h265-tools/mut.shadded+34 -0
| @@ -0,0 +1,34 @@ | ||
| 1 | +#!/usr/bin/env bash | |
| 2 | +# usage: mut.sh TEST OTHERS_EXPR (run from the synced tree; OTHERS_EXPR = nextest -E for remaining heavy tests, or empty) | |
| 3 | +set -uo pipefail | |
| 4 | +export EC_REQUIRE_FIXTURES=1 | |
| 5 | +OUT=$HOME/lanes/testcut-p2-h265-c1/out | |
| 6 | +T=$1; OTHERS=${2:-} | |
| 7 | +TOOLS=$PWD/lanes/testcut/p2h265-tools | |
| 8 | +TF="test(/(^|::)$T\$/)" | |
| 9 | +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") | |
| 10 | +[ -n "$RE" ] || { echo "$T: empty sample"; exit 0; } | |
| 11 | +COMMON=(cargo mutants -p ec-h265 --test-tool nextest --baseline skip --timeout-multiplier 3 --re "$RE") | |
| 12 | +echo "== $T run A (fast suite) $(date +%T)" | |
| 13 | +"${COMMON[@]}" --cargo-test-arg=--profile --cargo-test-arg=fast -o "$OUT/$T.A" > "$OUT/$T.A.log" 2>&1 | |
| 14 | +echo "A exit $?" | |
| 15 | +python3 "$TOOLS/outcomes.py" "$OUT/$T.A/mutants.out/outcomes.json" missed > "$OUT/$T.S.txt" | |
| 16 | +SN=$(wc -l < "$OUT/$T.S.txt") | |
| 17 | +echo "S=$SN survivors of fast suite" | |
| 18 | +[ "$SN" -eq 0 ] && { echo "$T: no survivors"; exit 0; } | |
| 19 | +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") | |
| 20 | +echo "== $T run B (T only) $(date +%T)" | |
| 21 | +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 | |
| 22 | +echo "B exit $?" | |
| 23 | +python3 "$TOOLS/outcomes.py" "$OUT/$T.B/mutants.out/outcomes.json" killed > "$OUT/$T.K.txt" | |
| 24 | +KN=$(wc -l < "$OUT/$T.K.txt") | |
| 25 | +echo "K=$KN killed by T among S" | |
| 26 | +[ "$KN" -eq 0 ] && { echo "$T: K empty"; exit 0; } | |
| 27 | +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") | |
| 28 | +[ -n "$OTHERS" ] || { echo "$T: no other heavy tests"; exit 0; } | |
| 29 | +echo "== $T run C (other heavy tests) $(date +%T)" | |
| 30 | +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 | |
| 31 | +echo "C exit $?" | |
| 32 | +python3 "$TOOLS/outcomes.py" "$OUT/$T.C/mutants.out/outcomes.json" killed > "$OUT/$T.Kc.txt" | |
| 33 | +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" | |
| 34 | +echo "$T done $(date +%T)" |
lanes/testcut/p2h265-tools/outcomes.pyadded+13 -0
| @@ -0,0 +1,13 @@ | ||
| 1 | +# usage: outcomes.py OUTCOMES_JSON SUMMARY_KIND (kind: missed | killed) -> prints mutant names | |
| 2 | +import json, sys | |
| 3 | +data = json.load(open(sys.argv[1])) | |
| 4 | +kind = sys.argv[2] | |
| 5 | +want = {"missed": {"MissedMutant"}, "killed": {"CaughtMutant", "Timeout"}}[kind] | |
| 6 | +rows = data["outcomes"] if isinstance(data, dict) else data | |
| 7 | +for o in rows: | |
| 8 | + sc = o.get("scenario") | |
| 9 | + if not isinstance(sc, dict) or "Mutant" not in sc: | |
| 10 | + continue | |
| 11 | + if o.get("summary") in want: | |
| 12 | + m = sc["Mutant"] | |
| 13 | + print(m.get("name", json.dumps(m))) |
lanes/testcut/p2h265-tools/resample.shadded+5 -0
| @@ -0,0 +1,5 @@ | ||
| 1 | +#!/usr/bin/env bash | |
| 2 | +set -uo pipefail | |
| 3 | +OUT=$HOME/lanes/testcut-p2-h265-c1/out | |
| 4 | +TOOLS=$PWD/lanes/testcut/p2h265-tools | |
| 5 | +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 |
lanes/testcut/p2h265-tools/runA.shadded+19 -0
| @@ -0,0 +1,19 @@ | ||
| 1 | +#!/usr/bin/env bash | |
| 2 | +# Shared run A: fast suite vs union of all candidate samples. Writes $OUT/A.S.txt (survivors). | |
| 3 | +set -uo pipefail | |
| 4 | +export EC_REQUIRE_FIXTURES=1 | |
| 5 | +OUT=$HOME/lanes/testcut-p2-h265-c1/out | |
| 6 | +TOOLS=$PWD/lanes/testcut/p2h265-tools | |
| 7 | +python3 -c 'import json,glob | |
| 8 | +u=[] | |
| 9 | +for f in sorted(glob.glob("'$OUT'/sample-*.json")): | |
| 10 | + for n in json.load(open(f)): | |
| 11 | + if n not in u: u.append(n) | |
| 12 | +json.dump(u, open("'$OUT'/union.json","w")); print("union", len(u))' | |
| 13 | +RE=$(python3 -c 'import json,re,sys; print("|".join(re.escape(n) for n in json.load(open(sys.argv[1]))))' "$OUT/union.json") | |
| 14 | +cargo mutants --help 2>&1 | grep -E "^ +--(release|test-tool|cargo-test-arg|in-place|baseline)" | head -6 | |
| 15 | +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 | |
| 16 | +echo "A exit $?" | |
| 17 | +python3 "$TOOLS/outcomes.py" "$OUT/A/mutants.out/outcomes.json" missed > "$OUT/A.S.txt" | |
| 18 | +echo "S=$(wc -l < "$OUT/A.S.txt")" | |
| 19 | +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 |
lanes/testcut/p2h265-tools/sample.pyadded+61 -0
| @@ -0,0 +1,61 @@ | ||
| 1 | +# usage: sample.py OUT TEST MAXN -> writes OUT/sample-TEST.json (names in priority order) | |
| 2 | +import json, sys, collections | |
| 3 | +out, test, maxn = sys.argv[1], sys.argv[2], int(sys.argv[3]) | |
| 4 | +def tail(p): | |
| 5 | + i = p.find("ec-h265/") | |
| 6 | + return p[i + len("ec-h265/"):] if i >= 0 else None | |
| 7 | +def load(n): | |
| 8 | + return json.load(open(f"{out}/{n}.json"))["data"][0] | |
| 9 | +def funcs(data): | |
| 10 | + res = [] # (file, name, lo, hi, fast_hits_or_covered_hits, uncov_hits) | |
| 11 | + for fn in data["functions"]: | |
| 12 | + fl = [tail(fn["filenames"][r[5]]) for r in fn["regions"][:1]] | |
| 13 | + if fl[0] is None: | |
| 14 | + continue | |
| 15 | + lo = min(r[0] for r in fn["regions"]); hi = max(r[2] for r in fn["regions"]) | |
| 16 | + res.append({"file": fl[0], "name": fn["name"], "lo": lo, "hi": hi, | |
| 17 | + "hits": sum(r[4] for r in fn["regions"]), | |
| 18 | + "covered_regions": {(r[0], r[1], r[2], r[3], r[7]) for r in fn["regions"] if r[4] > 0}}) | |
| 19 | + return res | |
| 20 | +def merged(lst): | |
| 21 | + d = {} | |
| 22 | + for f in lst: | |
| 23 | + k = (f["file"], f["name"]) | |
| 24 | + if k not in d: | |
| 25 | + d[k] = dict(f) | |
| 26 | + continue | |
| 27 | + m = d[k] | |
| 28 | + m["hits"] += f["hits"] | |
| 29 | + m["lo"] = min(m["lo"], f["lo"]); m["hi"] = max(m["hi"], f["hi"]) | |
| 30 | + m["covered_regions"] = m["covered_regions"] | f["covered_regions"] | |
| 31 | + return d | |
| 32 | +fast = merged(funcs(load("fast"))) | |
| 33 | +T = merged(funcs(load(test))) | |
| 34 | +cov = json.load(open(f"{out}/coverage-summary.json"))["per_test"][test] | |
| 35 | +ufuncs = {(x[0], x[1]) for x in cov["U_functions"]} | |
| 36 | +muts = json.load(open(f"{out}/mutants.json")) | |
| 37 | +cands = [] | |
| 38 | +for m in muts: | |
| 39 | + f = tail(m["file"]) if "ec-h265/" in m["file"] else m["file"] | |
| 40 | + if f is None: | |
| 41 | + continue | |
| 42 | + line = m["span"]["start"]["line"] | |
| 43 | + best = None | |
| 44 | + for key, fn in fast.items(): | |
| 45 | + if key[0] != f or not (fn["lo"] <= line <= fn["hi"]): | |
| 46 | + continue | |
| 47 | + t = T.get(key) | |
| 48 | + if t is None or not t["covered_regions"]: | |
| 49 | + continue | |
| 50 | + if best is None or (fn["hi"] - fn["lo"]) < (best["hi"] - best["lo"]): | |
| 51 | + best = fn | |
| 52 | + if best is None: | |
| 53 | + continue | |
| 54 | + key = (best["file"], best["name"]) | |
| 55 | + t = T.get(key) | |
| 56 | + prio = 0 if key in ufuncs else 1 | |
| 57 | + cands.append((prio, fast[key]["hits"], m["name"])) | |
| 58 | +cands.sort() | |
| 59 | +names = [c[2] for c in cands[:maxn]] | |
| 60 | +json.dump(names, open(f"{out}/sample-{test}.json", "w")) | |
| 61 | +print(test, "eligible", len(cands), "sampled", len(names), "U-funcs-prio", sum(1 for c in cands[:maxn] if c[0] == 0)) |
lanes/testcut/p2h265-tools/smoke.shadded+12 -0
| @@ -0,0 +1,12 @@ | ||
| 1 | +#!/usr/bin/env bash | |
| 2 | +# Smoke: two mutants from the union sample through the fast suite, to time one mutant and check the runner. | |
| 3 | +set -uo pipefail | |
| 4 | +export EC_REQUIRE_FIXTURES=1 | |
| 5 | +OUT=$HOME/lanes/testcut-p2-h265-c1/out | |
| 6 | +mkdir -p "$OUT" | |
| 7 | +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" | |
| 8 | +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") | |
| 9 | +date +%T | |
| 10 | +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 | |
| 11 | +echo "exit $?"; date +%T | |
| 12 | +tail -5 "$OUT/smoke.log" |