From e9b9397f0ee56b8a0c6c13ec82d79c9ba6fbaec1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Sat, 24 Oct 2026 02:02:24 +0300 Subject: [PATCH] testcut P2 ec-h264: delete four heavy tests with mutation kill evidence Delete every_quantiser_matches_ffmpeg, every_quantiser_with_motion_matches_ffmpeg, high_profile_8x8_matches_ffmpeg and x264_hi444_10bit (222.2 s saved). Keep x264_hi444_8bit (K'=4), both never_panic tests (weak oracle, kill 4 each) and jvt_hi444_vectors_bit_exact (protected). Evidence from the r4 run; r1-r3 invalid. Mutation runs exclude encode::real_library_frames_encode_and_decode_exactly (needs personal media). --- crates/ec-h264/tests/conformance.rs | 138 ------------ crates/ec-h264/tests/it/high444.rs | 5 - lanes/testcut/p2-h264.md | 47 +++++ lanes/testcut/p2h264/driver.py | 313 ++++++++++++++++++++++++++++ lanes/testcut/p2h264/probe.sh | 10 + 5 files changed, 370 insertions(+), 143 deletions(-) create mode 100644 lanes/testcut/p2-h264.md create mode 100644 lanes/testcut/p2h264/driver.py create mode 100644 lanes/testcut/p2h264/probe.sh diff --git a/crates/ec-h264/tests/conformance.rs b/crates/ec-h264/tests/conformance.rs index 71eb621c..187f1594 100644 --- a/crates/ec-h264/tests/conformance.rs +++ b/crates/ec-h264/tests/conformance.rs @@ -782,45 +782,6 @@ const ENTROPY_MODES: [(&str, &[&str]); 2] = [ ("cabac", &["-profile:v", "main", "-coder", "ac"]), ]; -/// Every quantisation parameter, bit-exact against ffmpeg, under both entropy -/// coders. -/// -/// The deblocking filter's alpha, beta and tC0 tables (8-16 and 8-17) are -/// indexed by QP; the conformance vectors touch only a few of their 52 rows, -/// and a whole wrong column there passes the vectors (it did, once). One -/// all-intra picture per QP covers every row. Under CABAC the same sweep walks -/// the context initialisation of clause 9.3.1.1 across all 52 SliceQPY values, -/// which the fixed-QP conformance vectors barely touch. -#[test] -fn every_quantiser_matches_ffmpeg() { - if !have_ffmpeg() { - eprintln!("SKIP: ffmpeg not on PATH"); - return; - } - let dir = scratch("qp-sweep"); - let mut failures = Vec::new(); - for (mode, profile) in ENTROPY_MODES { - let mut checked = 0usize; - for qp in 1..=51u32 { - let mut extra = profile.to_vec(); - let qp_string = qp.to_string(); - extra.extend(["-qp", &qp_string]); - match round_trip(&dir, &format!("{mode}-q{qp}"), "176x144", &extra) { - Ok(0) => checked += 1, - Ok(n) => failures.push(format!("{mode} qp {qp}: {n} bytes differ")), - Err(e) => failures.push(e), - } - } - assert!( - checked >= 40, - "too few {mode} quantisers exercised: {checked}" - ); - eprintln!("{mode}: {checked} quantisers bit-exact against ffmpeg"); - } - let _ = std::fs::remove_dir_all(&dir); - assert!(failures.is_empty(), "{failures:#?}"); -} - /// Geometry and slice structure: cropping, odd sizes, multiple slices, the /// loop filter off and a chroma QP offset — what a real camera or encoder /// produces, none of which the QCIF single-slice vectors cover. @@ -1393,55 +1354,6 @@ fn a_frame_num_gap_keeps_decoding() { eprintln!("frame_num gap: {frames} frames decoded after dropping one picture"); } -/// Every quantisation parameter again, this time over a GOP with motion. -/// -/// The intra sweep above walks the alpha, beta and tC0 rows the bS 3 and 4 -/// edges use. Boundary strengths 1 and 2 exist only between inter macroblocks, -/// so their tC0 columns (Table 8-17) had no oracle at all until now — and both -/// were wrong when this landed. One P/B GOP per quantiser covers every row of -/// both columns, and under CABAC it also walks the cabac_init_idc columns -/// across all 52 SliceQPY values. -#[test] -fn every_quantiser_with_motion_matches_ffmpeg() { - if !have_ffmpeg() { - eprintln!("SKIP: ffmpeg not on PATH"); - return; - } - let dir = scratch("qp-motion"); - let mut failures = Vec::new(); - for coder in ["ac", "0"] { - let mut checked = 0usize; - for qp in 1..=51u32 { - let qp_string = qp.to_string(); - let extra = vec![ - "-profile:v", - "main", - "-coder", - coder, - "-qp", - &qp_string, - "-x264-params", - "bframes=2:b-adapt=0:ref=2", - ]; - let tag = format!("{coder}-q{qp}"); - match x264_encode_gop(&dir, &tag, "176x144", 8, &extra) { - Some(stream) => match compare_sequence(&stream) { - Ok(_) => checked += 1, - Err(e) => failures.push(format!("{tag}: {e}")), - }, - None => failures.push(format!("{tag}: ffmpeg cannot encode")), - } - } - assert!( - checked >= 40, - "too few {coder} quantisers exercised: {checked}" - ); - eprintln!("{coder}: {checked} quantisers bit-exact over a GOP with motion"); - } - let _ = std::fs::remove_dir_all(&dir); - assert!(failures.is_empty(), "{failures:#?}"); -} - /// Geometry and slice structure, over a GOP rather than one picture: cropping, /// odd sizes, multiple slices per picture and the loop filter off, all with /// inter prediction and reordering active. @@ -2155,56 +2067,6 @@ fn pps_enables_8x8(stream: &Path) -> bool { false } -/// The High-profile 8x8 transform, which every real-world encoder turns on by -/// default: transform_size_8x8_flag, Intra_8x8 prediction with its reference -/// filter (8.3.2), the 8x8 residual under both entropy coders and the 8x8 -/// inverse transform of 8.5.13. -/// -/// The quantiser sweep matters twice over here: the 8x8 dequant ladder of -/// 8.5.13.1 has its own rounding branch at QP 36, and under CABAC the whole -/// ctxIdx 402..435 initialisation is a function of SliceQPY. -#[test] -fn high_profile_8x8_matches_ffmpeg() { - if !have_ffmpeg() { - eprintln!("SKIP: ffmpeg not on PATH"); - return; - } - let dir = scratch("high8x8"); - let mut failures = Vec::new(); - // High profile with the 8x8 transform forced on, in both entropy coders. - let modes: [(&str, &[&str]); 2] = [ - ("cabac", &["-profile:v", "high", "-coder", "ac"]), - ("cavlc", &["-profile:v", "high", "-coder", "0"]), - ]; - for (mode, profile) in modes { - let mut checked = 0usize; - for qp in 1..=51u32 { - let mut extra = profile.to_vec(); - let qp_string = qp.to_string(); - extra.extend(["-qp", &qp_string, "-x264-params", "8x8dct=1:i8x8=1"]); - let tag = format!("i8-{mode}-q{qp}"); - match round_trip(&dir, &tag, "176x144", &extra) { - Ok(0) => { - assert!( - pps_enables_8x8(&dir.join(format!("{tag}.264"))), - "{tag}: encoder did not enable the 8x8 transform" - ); - checked += 1; - } - Ok(n) => failures.push(format!("intra {mode} qp {qp}: {n} bytes differ")), - Err(e) => failures.push(e), - } - } - assert!( - checked >= 40, - "too few {mode} quantisers exercised: {checked}" - ); - eprintln!("8x8 intra {mode}: {checked} quantisers bit-exact against ffmpeg"); - } - let _ = std::fs::remove_dir_all(&dir); - assert!(failures.is_empty(), "{failures:#?}"); -} - /// The same transform in inter macroblocks: P and B partitions carry the flag /// only when no 8x8 is split further (7.3.5), the residual rides the inter /// scaling list, and the deblocker must leave the internal 4-sample edges of an diff --git a/crates/ec-h264/tests/it/high444.rs b/crates/ec-h264/tests/it/high444.rs index 79039036..91e9e39d 100644 --- a/crates/ec-h264/tests/it/high444.rs +++ b/crates/ec-h264/tests/it/high444.rs @@ -450,11 +450,6 @@ fn x264_hi444_8bit() { sweep("4:4:4 8-bit", &all("yuv444p", "", false, 1)); } -#[test] -fn x264_hi444_10bit() { - sweep("4:4:4 10-bit", &all("yuv444p10le", "", false, 1)); -} - #[test] fn x264_hi444_mbaff() { let mut cases = all("yuv444p", "mbaff-", true, 2); diff --git a/lanes/testcut/p2-h264.md b/lanes/testcut/p2-h264.md new file mode 100644 index 00000000..fbe9468f --- /dev/null +++ b/lanes/testcut/p2-h264.md @@ -0,0 +1,47 @@ +# testcut Phase 2: ec-h264 lane report + +Branch testcut-p2-h264. Driver: lanes/testcut/p2h264/driver.py. Valid evidence: r4 run +(lane testcut-p2-h264-r4, host a, log /tmp/claude-1000/testcut-p2-h264.r4.log, EXIT 0). + +Evidence history: the r1 run (its driver had no `--gitignore false`, ran with `--baseline skip`, +and copied the tree without the ignored fixtures) and the r2 and r3 runs are INVALID. Under them +every mutant was "caught" by a fixture panic, not a real assertion. r4 uses the default baseline +and `--gitignore false`, and its sanity lines show `fixture_errors=0` for every run. + +Excluded from every mutation run: `encode::real_library_frames_encode_and_decode_exactly`. It needs +the user's personal 720p H.264 media, which no server has, so it fails even unmutated with +EC_REQUIRE_FIXTURES=1. The exclusion is a filter on the mutation test set only; the gate below does +not exclude it. + +Sample cap: 30 mutants per candidate. Timeouts are not kills in the fast-suite runs. + +## Protocol table (r4) + +| crate | test | seconds | class | |U(T)| | mutants tried | |S| | |K| | |K'| | decision | +|---|---|---|---|---|---|---|---|---|---| +| ec-h264 | every_quantiser_with_motion_matches_ffmpeg | 70.9 | candidate | 0 | 30 | 7 | 0 | 0 | delete | +| ec-h264 | every_quantiser_matches_ffmpeg | 70.3 | candidate | 0 | 27 | 6 | 0 | 0 | delete | +| ec-h264 | high_profile_8x8_matches_ffmpeg | 56.8 | candidate | 0 | 27 | 5 | 0 | 0 | delete | +| ec-h264 | x264_hi444_10bit | 24.2 | candidate | 17 | 30 | 9 | 4 | 0 | delete | +| ec-h264 | corrupt_streams_never_panic | 24.2 | pseudo | 91 | 30 | 19 | 4 | 0 | keep (weak oracle, kills 4) | +| ec-h264 | x264_hi444_8bit | 23.0 | candidate | 17 | 30 | 10 | 4 | 4 | keep (K'=4, e.g. crates/ec-h264/src/decoder.rs:4502:21 delete match arm 1 in deblock_picture) | +| ec-h264 | truncated_and_corrupted_conformance_streams_never_panic | 20.9 | pseudo | 69 | 30 | 19 | 4 | 0 | keep (weak oracle, kills 4) | +| ec-h264 | jvt_hi444_vectors_bit_exact | 464.6 | protected | - | - | - | - | - | keep (protected: conformance vectors) | + +Survivor counts (|S|) and the kill set |K| come from the MUTSTAT lines in the r4 log. For the +four deleted tests |K| is 0 except x264_hi444_10bit (K=4: four survivors of the fast suite that +the 10-bit test kills; K'=0, so the other remaining heavy tests also kill all four). The never_panic pseudo-tests kill 4 mutants each that the fast suite misses, +and they are the only corrupt-input robustness tests in the crate, so they are kept. + +## Summary + +1. Tests deleted: 4 (every_quantiser_with_motion_matches_ffmpeg, every_quantiser_matches_ffmpeg, + high_profile_8x8_matches_ffmpeg, x264_hi444_10bit). Helpers left unused: none (clippy clean). +2. Seconds saved: 222.2 (70.9 + 70.3 + 56.8 + 24.2). +3. Kept with evidence: x264_hi444_8bit (K'=4), corrupt_streams_never_panic and + truncated_and_corrupted_conformance_streams_never_panic (weak oracle, kills 4 each), and + jvt_hi444_vectors_bit_exact (protected). +4. Gate: EC_REQUIRE_FIXTURES=1 cargo test --release -p ec-h264 on host a; see the gate note below. +5. Excluded from mutation runs only: encode::real_library_frames_encode_and_decode_exactly + (needs personal media). The fast-profile filter in .config/nextest.toml still names the deleted + tests; harmless, not regenerated. diff --git a/lanes/testcut/p2h264/driver.py b/lanes/testcut/p2h264/driver.py new file mode 100644 index 00000000..6261f286 --- /dev/null +++ b/lanes/testcut/p2h264/driver.py @@ -0,0 +1,313 @@ +#!/usr/bin/env python3 +"""Phase 2 evidence driver for ec-h264 (runs on a server inside the lane tree). + +Stages (argv[1]): + cov coverage of fast suite and each candidate; prints U(T) sizes + run full pipeline: coverage, sampling, S/K/K' kill runs, decisions + +Output that matters goes to stdout as lines starting with 'RESULT\t'. +Scratch (cargo-mutants trees) goes under $TMPDIR, which is not synced. +""" +import json, os, re, shutil, subprocess, sys, glob + +CRATE = "ec-h264" +ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..", "..")) +TMP = os.environ.get("TMPDIR", "/tmp") +WORK = os.path.join(TMP, "p2h264") +N_SAMPLE = int(os.environ.get("N_SAMPLE", "30")) +ENV = dict(os.environ, EC_REQUIRE_FIXTURES="1") +TARGET = os.environ.get("CARGO_TARGET_DIR", os.path.join(ROOT, "target")) + +# (test, runtime s, class). Order = decreasing runtime, as the protocol requires. +CANDS = [ + ("every_quantiser_with_motion_matches_ffmpeg", 70.90, "candidate"), + ("every_quantiser_matches_ffmpeg", 70.34, "candidate"), + ("high_profile_8x8_matches_ffmpeg", 56.82, "candidate"), + ("x264_hi444_10bit", 24.18, "candidate"), + ("corrupt_streams_never_panic", 24.24, "pseudo"), + ("x264_hi444_8bit", 23.01, "candidate"), + ("truncated_and_corrupted_conformance_streams_never_panic", 20.88, "pseudo"), +] +PROTECTED = {"jvt_hi444_vectors_bit_exact": 464.6} +EXCLUDE_ALWAYS = "encode::real_library_frames_encode_and_decode_exactly" + + +def sel(name): + return "test(/(^|::)%s$/)" % name + + +def sh(args, log): + os.makedirs(WORK, exist_ok=True) + with open(os.path.join(WORK, log), "w") as f: + r = subprocess.run(args, cwd=ROOT, env=ENV, stdout=f, stderr=subprocess.STDOUT) + print("STEP %s rc=%d" % (log, r.returncode), flush=True) + return r.returncode + + +def clear_profraw(): + for p in glob.glob(os.path.join(TARGET, "llvm-cov-target", "*.profraw")): + os.remove(p) + + +VALID = {} +FAST_CACHE = {} +LAST_BAD = 0 +LAST_RC = 0 + + +def prune_bad_profraw(files): + sysroot = subprocess.run(["rustc", "--print", "sysroot"], capture_output=True, text=True).stdout.strip() + prof = os.path.join(sysroot, "lib/rustlib/x86_64-unknown-linux-gnu/bin/llvm-profdata") + n = 0 + for f in files: + r = subprocess.run([prof, "show", f], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) + if r.returncode != 0: + os.remove(f) + n += 1 + print("PRUNED bad profraw: %d" % n, flush=True) + return n + + +def tail_log(log, n=40): + p = os.path.join(WORK, log) + if os.path.exists(p): + with open(p, errors="replace") as f: + lines = f.readlines()[-n:] + print("LOG-TAIL %s\n%s" % (log, "".join(lines)), flush=True) + + +def cov_report(out_json, extra_args): + """Run instrumented tests (profraw kept fresh), then dump JSON. + + --no-fail-fast: wall-clock tripwires can fail under instrumentation; the + profraw is still written, so a nonzero run exit is only reported. + """ + subprocess.run(["cargo", "llvm-cov", "clean", "--profraw-only"], cwd=ROOT, env=ENV, + stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) + clear_profraw() + base = os.path.basename(out_json) + rc_run = sh(["cargo", "llvm-cov", "nextest", "--release", "-p", CRATE, "--no-report", + "--no-fail-fast"] + extra_args, base + ".run.log") + files = sorted(glob.glob(os.path.join(TARGET, "llvm-cov-target", "*.profraw"))) + global LAST_BAD + LAST_BAD = prune_bad_profraw(files) + files = sorted(glob.glob(os.path.join(TARGET, "llvm-cov-target", "*.profraw"))) + print("PROFRAW %s n=%d sizes=%s" % (base, len(files), + [os.path.getsize(f) for f in files][:20]), flush=True) + rc_rep = sh(["cargo", "llvm-cov", "report", "--release", "--json", "--output-path", out_json], + base + ".rep.log") + if rc_rep != 0 or not os.path.exists(out_json): + print("FAIL coverage report for %s (run rc=%d, report rc=%d)" % (base, rc_run, rc_rep), + flush=True) + tail_log(base + ".run.log") + tail_log(base + ".rep.log") + sys.exit(3) + global LAST_RC + LAST_RC = rc_run + if rc_run != 0: + print("NOTE coverage run for %s exited %d (test failures, profraw kept)" % (base, rc_run), + flush=True) + with open(out_json) as f: + return json.load(f) + + +def regions(report): + """key (file, l1, c1, l2, c2) -> (max count, function name), code regions only.""" + out = {} + for fn in report["data"][0]["functions"]: + for r in fn["regions"]: + l1, c1, l2, c2, cnt, fid, _exp, kind = r[:8] + if kind != 0: + continue + fname = fn["filenames"][fid] + if "/crates/%s/src/" % CRATE not in fname: + continue + rel = fname[fname.index("crates/"):] + key = (rel, l1, c1, l2, c2) + prev = out.get(key) + if prev is None or cnt > prev[0]: + out[key] = (cnt, fn["name"]) + return out + + +def innermost(regs, rel, line): + best = None + for key, (cnt, _f) in regs.items(): + if key[0] != rel or not (key[1] <= line <= key[3]): + continue + span = (key[3] - key[1], key[4] - key[2] if key[1] == key[3] else 0) + if best is None or span < best[0]: + best = (span, key, cnt) + return best + + +def mutants_list(): + txt = subprocess.run(["cargo", "mutants", "-p", CRATE, "--list"], cwd=ROOT, env=ENV, + capture_output=True, text=True).stdout + out = [] + for line in txt.splitlines(): + m = re.match(r"^(crates/%s/src/[^:]+):(\d+):(\d+): " % CRATE, line) + if m: + out.append((line.strip(), m.group(1), int(m.group(2)))) + return out + + +def mutate(outdir, names, extra_test_args, timeout_is_kill): + """Return (caught, not_killed) name sets for the given mutants. + + The unmutated baseline runs in the scratch copy (default baseline). If it + fails, cargo-mutants exits 4 and we stop without deciding anything. + `--gitignore false` copies the ignored `fixtures` symlink into the scratch tree. + Timeouts count as kills only when timeout_is_kill (the candidate's own run). + """ + if not names: + return set(), set() + if os.path.isdir(outdir): + assert outdir.startswith(WORK + os.sep), outdir + shutil.rmtree(outdir) + os.makedirs(outdir, exist_ok=True) + tag = os.path.basename(outdir) + args = ["cargo", "mutants", "-p", CRATE, "--test-tool", "nextest", + "--timeout-multiplier", "3", "-j", "1", "--copy-vcs", "true", + "--gitignore", "false", "-o", outdir] + for n in names: + args += ["--re", re.escape(n)] + # Needs the user's personal media, which no server has: excluded from every mutation run. + excl = "not test(=%s)" % EXCLUDE_ALWAYS + extra = list(extra_test_args) + if "-E" in extra: + i = extra.index("-E") + 1 + extra[i] = "(%s) and %s" % (extra[i], excl) + else: + extra += ["-E", excl] + for a in extra: + args += ["--cargo-test-arg=" + a] + rc = sh(args, tag + ".log") + if rc == 4: + print("RESULT\tbaseline_failed\t%s" % tag, flush=True) + sys.exit(4) + base = glob.glob(os.path.join(outdir, "**", "mutants.out"), recursive=True) + if not base: + print("RESULT\tmutate_no_output\t%s\trc=%d" % (tag, rc), flush=True) + sys.exit(5) + d = base[0] + + def read(name): + p = os.path.join(d, name) + return set(l.strip() for l in open(p)) if os.path.exists(p) else set() + + caught = read("caught.txt") + timeouts = read("timeout.txt") + missed = read("missed.txt") + if timeout_is_kill: + caught |= timeouts + else: + missed |= timeouts + print("MUTSTAT %s caught=%d missed=%d timeout=%d unviable=%d asked=%d rc=%d" % ( + tag, len(caught), len(missed), len(timeouts), len(read("unviable.txt")), len(names), rc), flush=True) + # Sanity: fixture/runner errors must not be what kills a mutant. + logs = glob.glob(os.path.join(d, "log", "*.log")) + bad = [p for p in logs if "lists no" in open(p, errors="replace").read()] + print("SANITY %s logs=%d fixture_errors=%d" % (tag, len(logs), len(bad)), flush=True) + for p in logs: + hits = [l.rstrip() for l in open(p, errors="replace") if "panicked at" in l] + if hits: + print("SANITY %s sample_log=%s" % (tag, p), flush=True) + for h in hits[:3]: + print("SANITY " + h[:200], flush=True) + break + return caught, missed + + +def run_cov(cands_to_check): + fast = cov_report(os.path.join(WORK, "fast.json"), + ["--profile", "fast"]) + fast_r = regions(fast) + per = {} + for name, _s, _c in cands_to_check: + rep = cov_report(os.path.join(WORK, name + ".json"), ["-E", sel(name)]) + tr = regions(rep) + VALID[name] = (LAST_BAD == 0 and LAST_RC == 0) + print("RESULT\tvalid\t%s\t%s\tbad_profraw=%d\trc=%d" % (name, VALID[name], LAST_BAD, LAST_RC), flush=True) + U = [k for k, (c, _f) in tr.items() if c > 0 and fast_r.get(k, (0,))[0] == 0] + per[name] = (tr, U) + funcs = sorted({tr[k][1] for k in U}) + print("RESULT\tcov\t%s\tU=%d\tfuncs=%s" % (name, len(U), ";".join(funcs)[:400]), flush=True) + return fast_r, per + + +def main(): + stage = sys.argv[1] if len(sys.argv) > 1 else "run" + os.makedirs(WORK, exist_ok=True) + if stage == "cov": + run_cov(CANDS) + return + # full pipeline; start from a clean instrumented tree (as the ec-aac lane does) + subprocess.run(["cargo", "llvm-cov", "clean", "--workspace"], cwd=ROOT, env=ENV, + stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) + fast_r, per = run_cov(CANDS) + muts = mutants_list() + print("RESULT\tmutants_listed\t%d" % len(muts), flush=True) + deleted = set() + heavy_all = [n for n, _s, _c in CANDS] + list(PROTECTED) + for name, secs, cls in CANDS: + remaining = [h for h in heavy_all if h not in deleted and h != name] + tr, U = per[name] + if not VALID.get(name): + print("RESULT\tdecision\t%s\t%s\tsecs=%.1f\tU=%d\ttried=0\tS=0\tK=0\tKp=0\tkeep (no valid evidence)\tex=" % ( + CRATE, name, secs, len(U)), flush=True) + continue + # mutants inside code T executes + eligible = [] + for line_txt, rel, line in muts: + hit = innermost(tr, rel, line) + if hit is None or hit[2] == 0: + continue + fh = innermost(fast_r, rel, line) + fast_hit = fh[2] if fh else 0 + in_u = hit[1] in U + eligible.append((0 if in_u else 1, fast_hit, line_txt)) + eligible.sort() + sample = [e[2] for e in eligible[:N_SAMPLE]] + tag = name[:24] + # S: survivors of the fast suite + new = [m for m in sample if m not in FAST_CACHE] + fc, fm = mutate(os.path.join(WORK, "fast-" + tag), new, ["--profile", "fast"], False) + print("SANITY\t%s\tmissed=%d\tcaught=%d" % (name, len(fm), len(fc)), flush=True) + for m in fc: + FAST_CACHE[m] = True + for m in fm: + FAST_CACHE[m] = False + viable = [m for m in sample if m in FAST_CACHE] + if not viable: + print("RESULT\tdecision\t%s\t%s\tsecs=%.1f\tU=%d\ttried=%d\tS=0\tK=0\tKp=0\tkeep (no valid evidence: 0 viable mutants)\tex=" % ( + CRATE, name, secs, len(U), len(sample)), flush=True) + continue + S = sorted(m for m in viable if not FAST_CACHE[m]) + # K: survivors of fast that T kills + tc, tm = mutate(os.path.join(WORK, "t-" + tag), S, + ["-E", sel(name)], True) + K = sorted(set(S) - tm) + # K': K mutants that no other remaining heavy test kills + if K and remaining: + expr = " | ".join(sel(h) for h in remaining) + kc, km = mutate(os.path.join(WORK, "k-" + tag), K, ["-E", expr], False) + Kp = sorted(set(K) - kc) + else: + Kp = list(K) + if cls == "pseudo": + decision = "delete" if not K else "keep (weak oracle, kills %d)" % len(K) + else: + decision = "delete" if not Kp else "keep" + if decision == "delete" and not PROTECTED.get(name): + deleted.add(name) + tried = len(viable) + ex = Kp[0] if Kp else (K[0] if K and cls == "pseudo" else "") + print("RESULT\tdecision\t%s\t%s\tsecs=%.1f\tU=%d\ttried=%d\tS=%d\tK=%d\tKp=%d\t%s\tex=%s" % ( + CRATE, name, secs, len(U), tried, len(S), len(K), len(Kp), decision, + ex), flush=True) + print("RESULT\tdeleted\t%s" % ",".join(sorted(deleted)), flush=True) + + +if __name__ == "__main__": + main() diff --git a/lanes/testcut/p2h264/probe.sh b/lanes/testcut/p2h264/probe.sh new file mode 100644 index 00000000..78b678ef --- /dev/null +++ b/lanes/testcut/p2h264/probe.sh @@ -0,0 +1,10 @@ +set -u +cd "$HOME/lanes/testcut-p2-h264/edith_codecs" 2>/dev/null || { echo "no lane tree"; exit 1; } +export PATH="$HOME/.cargo/bin:$PATH" +echo "host=$(hostname)" +command -v cargo-nextest ffmpeg python3 >/dev/null 2>&1 && echo TOOLS_OK +cargo nextest --version | head -1 +cargo llvm-cov clean --help | grep -i profraw +cargo nextest run --help | grep -E -- "--filter-expr|-E," | head -2 +cargo mutants -p ec-h264 --list 2>/dev/null | head -3 +cargo mutants -p ec-h264 --list 2>/dev/null | wc -l