edith_codecs
Clone
https://git.tahinli.com/Tahinli/edith_codecs.git
0 watching0 forksRust370.3 MiBd0fd4cbTahinli6 days ago3979 commits
| 1 | #!/usr/bin/env bash |
| 2 | # kill-matrix.sh: the heavy-compute steps of a batched mutation kill matrix for one crate. |
| 3 | # Reusable for any crate; defaults target ec-av1. Run it on a server through scripts/remote-run.sh, |
| 4 | # from the workspace root (remote-run's cwd), with the EC_* environment set by the caller: |
| 5 | # |
| 6 | # EC_MEMGUARD_MAX=12G EC_AV1_AOM_DIR=$HOME/fixtures/av1-aom EC_REQUIRE_FIXTURES=1 \ |
| 7 | # EC_TOOL_CACHE_DIR=$HOME/.cache/ec-tool-cache \ |
| 8 | # scripts/remote-run.sh <lane> --host auto -- scripts/kill-matrix.sh <subcommand> [args] |
| 9 | # |
| 10 | # Subcommands (CRATE defaults to ec-av1; OUT is a directory under the workspace): |
| 11 | # list <OUT> mutants of $CRATE as JSON (cargo mutants --list --json) |
| 12 | # cover <TESTS> <OUT> per-test region coverage: one instrumented run per test; TESTS |
| 13 | # lines are "<ordinal>\t<name>"; writes OUT/<ordinal>.json (compact) |
| 14 | # fastcov <OUT> coverage of the fast profile (the "fast suite") |
| 15 | # mutrun <SAMPLE.json> <IDXFILE> <OUT> fast|heavy |
| 16 | # apply each mutant index in IDX (one per line), run the fast |
| 17 | # profile or the given heavy test list, record the failing tests |
| 18 | # in OUT/<index>.fail, and revert the tree after each mutant. |
| 19 | # |
| 20 | # A mutant with a compile error is recorded as "unviable" and is not a kill or a survivor. |
| 21 | |
| 22 | |
| 23 | CRATE= |
| 24 | ROOT= |
| 25 | TMP= |
| 26 | |
| 27 | |
| 28 | |
| 29 | |
| 30 | |
| 31 | NEXTEST_J= |
| 32 | MUTATE="python3 /scripts/mutate.py" |
| 33 | |
| 34 | sub= |
| 35 | |
| 36 | |
| 37 | # Per-test profraw are kept per run; report merges what is on disk. |
| 38 | |
| 39 | |
| 40 | # A child process that dies mid-write leaves a truncated .profraw, and llvm-cov report then fails |
| 41 | # for the whole merge. Delete every profile that llvm-profdata cannot read, and log the count. |
| 42 | |
| 43 | |
| 44 | |
| 45 | |
| 46 | |
| 47 | |
| 48 | |
| 49 | |
| 50 | |
| 51 | |
| 52 | |
| 53 | |
| 54 | |
| 55 | # Heavy mode: apply one mutant to this tree (scripts/mutate.py), run the listed heavy tests with |
| 56 | # --no-fail-fast, and record every failing test in OUT/<idx>.fail. cargo-mutants stops at the first |
| 57 | # failing test, so it cannot produce the full kill set that the matrix needs. |
| 58 | # A timeout records every listed test as killing (conservative: it keeps them). |
| 59 | |
| 60 | |
| 61 | |
| 62 | |
| 63 | |
| 64 | |
| 65 | |
| 66 | |
| 67 | |
| 68 | |
| 69 | |
| 70 | |
| 71 | |
| 72 | |
| 73 | |
| 74 | |
| 75 | |
| 76 | |
| 77 | |
| 78 | |
| 79 | |
| 80 | |
| 81 | |
| 82 | |
| 83 | |
| 84 | |
| 85 | |
| 86 | |
| 87 | # Fast mode: apply one mutant, run the fast profile (fail-fast is fine: any failure is a kill). |
| 88 | # Status: fail (a test failed, timed out or the test run was killed), pass, unviable (no test run). |
| 89 | # Baseline-failing test (unmutated fast run fails it), excluded so fail-fast cannot make every mutant "killed". |
| 90 | FAST_EXCL='not test(/aom_vectors_match_per_frame_md5$/)' |
| 91 | |
| 92 | |
| 93 | |
| 94 | |
| 95 | |
| 96 | |
| 97 | |
| 98 | |
| 99 | |
| 100 | |
| 101 | |
| 102 | |
| 103 | |
| 104 | |
| 105 | case in |
| 106 | fastbase) |
| 107 | # Unmutated fast profile, no fail-fast: the baseline. Failing tests are listed in OUT/failing.txt. |
| 108 | out=; |
| 109 | |
| 110 | |
| 111 | |
| 112 | |
| 113 | | | || |
| 114 | | || |
| 115 | ;; |
| 116 | list) |
| 117 | out=; |
| 118 | ( && ) |
| 119 | |
| 120 | ;; |
| 121 | cover) |
| 122 | tests=; out=; |
| 123 | # TESTS lines: "<ordinal><TAB><test name>". The ordinal names the output files, so shards |
| 124 | # run on different hosts can be merged by ordinal. |
| 125 | while ; do |
| 126 | [ || continue |
| 127 | |
| 128 | # A failing test still leaves its profile behind; the coverage is what matters here. |
| 129 | |
| 130 | || { |
| 131 | # Coverage of a failing run is still reported, but it is not a clean baseline. |
| 132 | |
| 133 | |
| 134 | } |
| 135 | |
| 136 | # A missing report is not fatal: the test is recorded as "nocov" and the analysis keeps it. |
| 137 | if |
| 138 | && ; then |
| 139 | |
| 140 | else |
| 141 | |
| 142 | |
| 143 | |
| 144 | fi |
| 145 | |
| 146 | done |
| 147 | ;; |
| 148 | fastcov) |
| 149 | out=; |
| 150 | |
| 151 | || |
| 152 | |
| 153 | if ! { |
| 154 | && ; }; then |
| 155 | |
| 156 | fi |
| 157 | |
| 158 | ;; |
| 159 | mutrun) |
| 160 | # json: the sample; idxfile lines: "<index>" (fast) or "<index><TAB><tests file>" (heavy). |
| 161 | # Each run applies exactly one mutant (mutate.py, exact span) and runs the tests. cargo-mutants' |
| 162 | # --re/-F does not filter by name in this version (it tests the first N mutants of the list), so |
| 163 | # it is not used for selection here. |
| 164 | json=; idxfile=; out=; mode= |
| 165 | |
| 166 | while ; do |
| 167 | [ || continue |
| 168 | if [; then |
| 169 | |
| 170 | else |
| 171 | |
| 172 | fi |
| 173 | |
| 174 | done |
| 175 | ;; |
| 176 | *) |
| 177 | |
| 178 | |
| 179 | ;; |
| 180 | esac |