tests: make the real-library sweeps LOCAL-ONLY, and report the class
Browse files at this commitfcb9ffb46e2612ea3654a70a3ccdb44dc72c7927Parent: a460dca3 changed files +216 -0
- crates/ec-aac/tests/oracle.rs +10 -0
- crates/ec-h264/tests/conformance.rs +26 -0
- lanes/h264reallib.report.md +180 -0
crates/ec-aac/tests/oracle.rsmodified+10 -0
| @@ -676,6 +676,16 @@ fn esds_asc(mp4: &[u8]) -> Option<Vec<u8>> { | |||
| 676 | 676 | ||
| 677 | /// AAC tracks from the machine's own library, not just generated fixtures: the | 677 | /// AAC tracks from the machine's own library, not just generated fixtures: the |
| 678 | /// elementary stream is copied out to ADTS and decoded both ways. | 678 | /// elementary stream is copied out to ADTS and decoded both ways. |
| 679 | +// lane-h264reallib: same shape as the ec-h264 `real_library_streams_match_ffmpeg` | ||
| 680 | +// fix, same reason. The manifest is generated by `scripts/scan-real-library.sh` | ||
| 681 | +// from `~/Videos ~/Downloads ~/Music` and is gitignored because it is | ||
| 682 | +// machine-local. The guard below makes a host with NO manifest print green | ||
| 683 | +// (nothing was checked), and a host that ran the scan but has since moved or | ||
| 684 | +// deleted files falls through to `checked >= 3` and goes red for a reason that | ||
| 685 | +// has nothing to do with the decoder. An ignore is visible in `--list` and | ||
| 686 | +// cannot go green silently, which an env gate would. | ||
| 687 | +// Run on the workstation: cargo test -p ec-aac --test oracle real_library_tracks_match_ffmpeg -- --ignored | ||
| 688 | +#[ignore = "sweeps the PERSONAL media library (~/Videos, ~/Downloads, ~/Music) through the gitignored fixtures/real-library-manifest.tsv and asserts >= 3 tracks swept; a runner host has no such library, so it is either a silent green or a red for the wrong reason. Run it on the workstation with --ignored."] | ||
| 679 | #[test] | 689 | #[test] |
| 680 | fn real_library_tracks_match_ffmpeg() { | 690 | fn real_library_tracks_match_ffmpeg() { |
| 681 | if !have_ffmpeg() { | 691 | if !have_ffmpeg() { |
crates/ec-h264/tests/conformance.rsmodified+26 -0
| @@ -1842,6 +1842,32 @@ fn compare_container_streamed( | |||
| 1842 | /// resolutions and GOP structures the fixtures never use, and they are the ones | 1842 | /// resolutions and GOP structures the fixtures never use, and they are the ones |
| 1843 | /// a user actually opens. Every file either decodes bit-exactly or is refused | 1843 | /// a user actually opens. Every file either decodes bit-exactly or is refused |
| 1844 | /// by name; a file that decodes to different pixels is a failure. | 1844 | /// by name; a file that decodes to different pixels is a failure. |
| 1845 | +// lane-h264reallib: LOCAL-ONLY, and the reason lives in the attribute so it | ||
| 1846 | +// shows in `cargo test -- --list` instead of hiding in a skip print. | ||
| 1847 | +// | ||
| 1848 | +// The precondition is a PERSONAL MEDIA LIBRARY: the manifest is generated by | ||
| 1849 | +// `scripts/scan-real-library.sh`, which scans `~/Videos ~/Downloads ~/Music` | ||
| 1850 | +// by default and is gitignored precisely because it is machine-local. A | ||
| 1851 | +// runner host has none of those directories, so both of this test's possible | ||
| 1852 | +// behaviours there are wrong: | ||
| 1853 | +// | ||
| 1854 | +// - manifest absent -> the `SKIP: ... missing` early return, which prints | ||
| 1855 | +// green. That is the silent-skip class this batch is removing: a green | ||
| 1856 | +// that means "nothing was checked". | ||
| 1857 | +// - manifest present but its absolute paths unresolvable (a host that ran | ||
| 1858 | +// the scan script against an empty library) -> zero files swept and | ||
| 1859 | +// `decoded >= 3` fails. That is the red every fleet run currently eats, | ||
| 1860 | +// and it is red for a reason that has nothing to do with the decoder. | ||
| 1861 | +// | ||
| 1862 | +// Hence `#[ignore]` rather than an env gate: an env gate whose variable is | ||
| 1863 | +// absent on the runner prints the same green the missing manifest already | ||
| 1864 | +// prints, which is the defect rather than the fix. An ignore is visible in | ||
| 1865 | +// `--list`, cannot go green silently, and leaves the assertion itself intact | ||
| 1866 | +// -- "the sweep is the point" still holds on the machine that can run it. | ||
| 1867 | +// | ||
| 1868 | +// Run it on the workstation, where the library is: | ||
| 1869 | +// cargo test -p ec-h264 --test conformance real_library_streams_match_ffmpeg -- --ignored | ||
| 1870 | +#[ignore = "sweeps the PERSONAL media library (~/Videos, ~/Downloads, ~/Music) through the gitignored fixtures/real-library-manifest.tsv; MINUTES of wall time (measured past 840 s on the workstation), so workstation only -- budget an hour, it is not wedged. A runner host has no such library, so the test is either a silent green or a red for the wrong reason. Run it on the workstation with --ignored."] | ||
| 1845 | #[test] | 1871 | #[test] |
| 1846 | fn real_library_streams_match_ffmpeg() { | 1872 | fn real_library_streams_match_ffmpeg() { |
| 1847 | if !have_ffmpeg() { | 1873 | if !have_ffmpeg() { |
lanes/h264reallib.report.mdadded+180 -0
| @@ -0,0 +1,180 @@ | |||
| 1 | +# lane-h264reallib — real-library sweep: shape, local verdict, class sweep | ||
| 2 | + | ||
| 3 | +Branch `lane-h264reallib` (worktree `~/.cache/wt/h264reallib`, base `a21f3680`). | ||
| 4 | +Tests only. No decoder change, no assertion weakened. | ||
| 5 | + | ||
| 6 | +Three separate deliverables, per Main's request to keep them apart: | ||
| 7 | +(a) the local verdict on the real library, (b) the shape change that stops | ||
| 8 | +runners reporting a false red, (c) the count and table of the rest of the class. | ||
| 9 | + | ||
| 10 | +--- | ||
| 11 | + | ||
| 12 | +## (a) Local verdict — PASSES on the workstation, no decoder defect | ||
| 13 | + | ||
| 14 | +Run on the workstation, where the library is: | ||
| 15 | + | ||
| 16 | +``` | ||
| 17 | +EC_NOMEMGUARD=1 cargo test -p ec-h264 --test conformance \ | ||
| 18 | + real_library_streams_match_ffmpeg -- --ignored --nocapture | ||
| 19 | +``` | ||
| 20 | + | ||
| 21 | +`fixtures/real-library-manifest.tsv` is gitignored and generated by | ||
| 22 | +`scripts/scan-real-library.sh` (ffprobe sweep of `~/Videos ~/Downloads ~/Music`). | ||
| 23 | +Copied from the primary checkout into the worktree for the run; **111 h264 rows, | ||
| 24 | +all 111 paths resolve** on this host. | ||
| 25 | + | ||
| 26 | +Result — **15 decoded bit-exact, 0 refused by name, 0 failures**, 1918 s: | ||
| 27 | + | ||
| 28 | +| file | container | width | frames | | ||
| 29 | +|---|---|---|---| | ||
| 30 | +| reel-24f2c8 | matroska,webm | 2560px | 500 bit-exact | | ||
| 31 | +| reel-7538d2 | mov,mp4,m4a,3gp,3g2,mj2 | 2560px | 500 bit-exact | | ||
| 32 | +| reel-1c3a81 | matroska,webm | 1280px | 500 bit-exact | | ||
| 33 | +| reel-286c86 | mov,mp4,… | 3840px | 500 bit-exact | | ||
| 34 | +| reel-010d74 | mov,mp4,… | 576px | 500 bit-exact | | ||
| 35 | +| reel-ab1f6d | mov,mp4,… | 640px | 500 bit-exact | | ||
| 36 | +| reel-e99558 | mov,mp4,… | 1920px | 500 bit-exact (container demux) | | ||
| 37 | +| reel-436303 | mov,mp4,… | 1274px | 439 bit-exact | | ||
| 38 | +| reel-28cd87 | mov,mp4,… | 720px | 500 bit-exact | | ||
| 39 | +| reel-bf1a18 | matroska,webm | 1920px | 500 bit-exact | | ||
| 40 | +| reel-92d5fc | mov,mp4,… | 1080px | 500 bit-exact | | ||
| 41 | +| reel-6ee243 | mov,mp4,… | 1078px | 500 bit-exact | | ||
| 42 | +| reel-1db5fd | mov,mp4,… | 1280px | 185 bit-exact | | ||
| 43 | +| reel-4148f8 | mov,mp4,… | 1916px | 500 bit-exact | | ||
| 44 | +| reel-ccbe4e | mov,mp4,… | 1138px | 500 bit-exact | | ||
| 45 | + | ||
| 46 | +Both demuxers are exercised (matroska + mov/mp4), the sweep covers 576px→3840px, | ||
| 47 | +and one file took the container-demux fallback exactly as designed. **The | ||
| 48 | +decoder is fine; the fleet red was never about the decoder.** | ||
| 49 | + | ||
| 50 | +Runtime: **1918 s (~32 min)**, matching Main's independent observation that it | ||
| 51 | +runs past 840 s. That number is now in the ignore reason so the next person does | ||
| 52 | +not read the wall time as a wedge. | ||
| 53 | + | ||
| 54 | +## (b) Shape change — why `#[ignore]`, and what it stops | ||
| 55 | + | ||
| 56 | +`crates/ec-h264/tests/conformance.rs:1846` `real_library_streams_match_ffmpeg`. | ||
| 57 | + | ||
| 58 | +The precondition is a personal media library, which has exactly two possible | ||
| 59 | +behaviours on a runner, and **both are wrong**: | ||
| 60 | + | ||
| 61 | +- manifest absent → the existing `SKIP: … missing` early return prints | ||
| 62 | + **green**. That is the silent-skip class this batch is removing: a green that | ||
| 63 | + means "nothing was checked". | ||
| 64 | +- manifest present but its absolute paths unresolvable (a host that ran the scan | ||
| 65 | + script against an empty library) → zero files swept and `decoded >= 3` fails. | ||
| 66 | + That is **the red every fleet run currently eats**, and it is red for a reason | ||
| 67 | + that has nothing to do with the decoder. | ||
| 68 | + | ||
| 69 | +`#[ignore]` over an env-gated SKIP, justified: an env gate whose variable is | ||
| 70 | +absent on the runner prints *the same green the missing manifest already prints* — | ||
| 71 | +that is the defect, not the fix. An ignore is visible in | ||
| 72 | +`cargo test -- --list`, cannot go green silently, and needs no runner-side | ||
| 73 | +configuration that could itself drift. The assertion is untouched: `decoded >= 3` | ||
| 74 | +still stands, and still holds, on the machine that can run it (it did: 15 ≥ 3). | ||
| 75 | + | ||
| 76 | +Verified — the target is no longer red, and the reason is printed verbatim: | ||
| 77 | + | ||
| 78 | +``` | ||
| 79 | +test real_library_streams_match_ffmpeg ... ignored, sweeps the PERSONAL media | ||
| 80 | +library (~/Videos, ~/Downloads, ~/Music) through the gitignored | ||
| 81 | +fixtures/real-library-manifest.tsv; MINUTES of wall time (measured past 840 s on | ||
| 82 | +the workstation), so workstation only -- budget an hour, it is not wedged. ... | ||
| 83 | +test result: ok. 0 passed; 0 failed; 1 ignored; 0 measured; 22 filtered out | ||
| 84 | +``` | ||
| 85 | + | ||
| 86 | +Also fixed, because the fix is the *identical* one-line `#[ignore]` + reason and | ||
| 87 | +no judgement call: `crates/ec-aac/tests/oracle.rs:680` | ||
| 88 | +`real_library_tracks_match_ffmpeg` — same manifest, same | ||
| 89 | +"skip if manifest missing, then assert `checked >= 3`" shape, same two failure | ||
| 90 | +modes. Verified reporting `1 ignored`. | ||
| 91 | + | ||
| 92 | +## (c) Class sweep — 51 sites examined, 2 fixed, 3 need a decision, 46 already correct | ||
| 93 | + | ||
| 94 | +The class: a test that reads `~/Music`, `~/Videos`, `~/Downloads`, a hardcoded | ||
| 95 | +`/home/<user>/` path, or the generated manifest; **or** asserts a minimum count | ||
| 96 | +of personal files. Swept `crates/*/tests/**`, `crates/*/src/**` (incl. | ||
| 97 | +`#[cfg(test)]`), `tests/**`, `tools/**`, `shims/**`, and the scripts. | ||
| 98 | + | ||
| 99 | +**Members of the class that are RED-ON-RUNNER and not ignored — the ones that | ||
| 100 | +still need a decision (not fixed here, because the right fix is NOT the | ||
| 101 | +identical one-liner):** | ||
| 102 | + | ||
| 103 | +| file:line | what it needs | runs on a runner? | current behaviour | proposed shape | | ||
| 104 | +|---|---|---|---|---| | ||
| 105 | +| `crates/ec-probe/tests/library.rs:490` `a_real_library_sweep` | manifest + ≥1 row whose path still exists | partially | red-on-runner | **Remove the minimum-count assert, do not ignore.** The file's own header (:5-6) states moved files are "skipped and reported, never failed" — the `:490` assert contradicts the stated contract. This is a real bug in the test's own spec, not a shape problem. | | ||
| 106 | +| `crates/ec-aac/tests/sbr_real_library.rs:4797` `sbr_residual_locator` | `$HOME` set at all — bare `env::var("HOME").unwrap()` | partially | red-on-runner | **One-line `unwrap_or_default()`**, matching the five sibling HOME reads in the same file (:2710, :3426, :4109, :4182, :4575). The `:4803` `path.exists()` guard already handles the absent file; only the bare `unwrap` panics. | | ||
| 107 | +| `crates/ec-aac/tests/obs_real_content.rs:151` `obs_content_table` | `$HOME` set — bare `unwrap()` | partially | silent-skip | **One-line `unwrap_or_default()`**, same reason. The `read_dir` guard at :152 already handles the absent directory. | | ||
| 108 | + | ||
| 109 | +**Already correctly shaped — `leave alone` (14 named, rest by the same pattern):** | ||
| 110 | +these read personal paths but handle absence correctly, so they are NOT the | ||
| 111 | +class. The template worth copying: | ||
| 112 | + | ||
| 113 | +- `crates/ec-h264/tests/encode.rs:751` `real_library_frames_encode_and_decode_exactly` | ||
| 114 | + — **the reference "correct" shape of this class**: `:728-731` soft-skips when no | ||
| 115 | + qualifying row survives, so the `sources.len() >= 6` assert is only reachable | ||
| 116 | + once a real file was actually opened. This is what the two sites above should | ||
| 117 | + be rewritten to. | ||
| 118 | +- `crates/ec-aac/tests/oracle.rs:848` `he_aac_library_track_decodes_to_its_core` | ||
| 119 | + — sibling of the one I ignored, correctly shaped: prints a named SKIP at :919 | ||
| 120 | + and returns at :917, so the :912 assert only fires on a file it decoded. | ||
| 121 | +- `crates/ec-image/tests/real_library.rs:52`, `:132`; `crates/ec-truehd/tests/library.rs:78`, | ||
| 122 | + `crates/ec-truehd/tests/oracle.rs:87`; `crates/ec-probe/tests/library.rs:585`, `:621`, | ||
| 123 | + `:756`; `crates/ec-aac/tests/reelh_per_frame.rs:29`; `crates/ec-hw/tests/gpu.rs:2050` | ||
| 124 | + (and the three other gpu.rs personal-path sites, all GPU-guarded) — all guard | ||
| 125 | + on `exists()`/`read_dir` and print a named skip. | ||
| 126 | +- `crates/ec-aac/tests/sbr_real_library.rs:2710`, `:3690`, `:4176`, `:4566` — filter | ||
| 127 | + candidates on `.exists()`, empty list skips, no minimum-count assert. | ||
| 128 | + | ||
| 129 | +**Already `#[ignore]`d with a reason naming the precondition — `leave alone` | ||
| 130 | +(~20):** `ec-mp3/tests/encode_matrix.rs:639`, `:851`; `ec-mp4/tests/mp4.rs:789`; | ||
| 131 | +`ec-matroska/tests/matroska.rs:538`, `:965`, `:1058`, `:1282`, `:1400`; | ||
| 132 | +`ec-vorbis/tests/oracle.rs:1190`; `ec-opus/tests/conformance.rs:758`, `:2958`, | ||
| 133 | +`:3149`, `:3428`, `:3654`, `:3859`, `:4091`, `:4572`; `ec-av1/src/encode.rs:16808`, | ||
| 134 | +`:19748`, `:20068`, `:20175`, `:21054`, `:21163`, `:22857`, `:22982`. The repo's | ||
| 135 | +dominant convention is already "ignore + reason", which is why this lane's fix | ||
| 136 | +follows it rather than inventing a new shape. | ||
| 137 | + | ||
| 138 | +**False positives — do NOT touch (the class looks bigger than it is):** | ||
| 139 | + | ||
| 140 | +- `scripts/extract_vp8_tables.py:15`, `scripts/build-aom-oracle.sh:17`, | ||
| 141 | + `build-aom-affine-oracle.sh:23`, `instrument-aom-oracle.sh:73`, | ||
| 142 | + `gen_vp8_fixtures.sh:52`, `memguard-runner.sh:39` — `$HOME/.cache/{aom-oracle,vp8}` | ||
| 143 | + and `$HOME/.config/systemd`: build/toolchain locations, all env-overridable, | ||
| 144 | + none read media. | ||
| 145 | +- `tools/ec-bench/src/main.rs:82` — non-test bench binary; reports "no candidate". | ||
| 146 | +- `crates/ec-aac/tests/sbr_real_library.rs:3715`, `:4572` — `$CARGO_MANIFEST_DIR/../../.cache/heaac-fixtures`, | ||
| 147 | + a generated-fixture cache relative to the repo. | ||
| 148 | +- `crates/ec-vp9/tests/scaledref_exact.rs:18` — a doc comment recording how a | ||
| 149 | + *committed* .ivf was produced; the test reads the tracked file. | ||
| 150 | +- `crates/ec-mp4/tests/mp4.rs:635` — personal file is purely additive to a repo | ||
| 151 | + fixture that is always present; not a dependency. | ||
| 152 | + | ||
| 153 | +**Non-test dependents of the manifest** (why it exists on some hosts and not | ||
| 154 | +others — worth knowing when reading a red): | ||
| 155 | + | ||
| 156 | +- `scripts/scan-real-library.sh` — the generator; defaults to | ||
| 157 | + `$HOME/Videos $HOME/Downloads $HOME/Music`, writes the gitignored | ||
| 158 | + `fixtures/real-library-manifest.tsv`, honours `EC_FIXTURES`. | ||
| 159 | +- `lanes/b64b/bin-control:59261` — a built binary that reads the manifest. | ||
| 160 | +- No CI workflow file in the repo runs the scan, which is exactly why runner | ||
| 161 | + behaviour differs: a host that once ran the script by hand keeps a manifest | ||
| 162 | + whose paths no longer resolve, and that is the state that produces the false red. | ||
| 163 | + | ||
| 164 | +**One incidental finding, not fixed (out of scope, flagged not hidden):** | ||
| 165 | +`crates/ec-matroska/tests/matroska.rs:966` reads the manifest at a **hardcoded | ||
| 166 | +absolute** `/home/user/Documents/Code/Rust/edith_codecs/fixtures/…` instead | ||
| 167 | +of `CARGO_MANIFEST_DIR`-relative like every sibling. It is already `#[ignore]`d | ||
| 168 | +with a soft skip, so it is harmless today, and it also silently defeats | ||
| 169 | +worktree isolation. Worth converting to the relative form if that ignore is ever | ||
| 170 | +lifted. | ||
| 171 | + | ||
| 172 | +## Change list | ||
| 173 | + | ||
| 174 | +| file | change | | ||
| 175 | +|---|---| | ||
| 176 | +| `crates/ec-h264/tests/conformance.rs:1870` | `#[ignore = "…"]` + 25-line reason above the test; assertion untouched | | ||
| 177 | +| `crates/ec-aac/tests/oracle.rs:688` | `#[ignore = "…"]` + reason; identical shape, assertion untouched | | ||
| 178 | + | ||
| 179 | +No decoder change. No new `#[ignore]` beyond the two class members above (both | ||
| 180 | +were red-on-runner, never green). No assertion weakened anywhere. | ||