edith_codecs
Clone
0 watching0 forksRust370.3 MiB9b67700Tahinli3 days ago4021 commits
av1splitp0: test-only source reader for module directories (plan step P0)
Base: main @ d271a92b (rebased; the ec-av1 tree is identical between e6274ff1 and d271a92b, and the rebased-in commits touch no crates/ec-av1 file). Plan: lanes/av1split.plan.md, sections 1a and Phase 0.
Goal
The source-scanning tests read files by path with include_str!("decode.rs") and friends.
Once decode.rs, stream.rs, encode.rs, tile.rs, qm.rs, encoder.rs and cdf.rs become
directories, those includes stop compiling. This step repoints them so a later split changes
no test, and it moves 0 lines of production code.
What changed
crates/ec-av1/src/test_source.rs(new,#![cfg(test)], declared#[cfg(test)] mod test_source;inlib.rs). Two helpers, both returning&'static str(each module is read once per process and cached):module_source(name):src/<name>.rsif present, plus every*.rsundersrc/<name>/recursively, in sorted path order. Read at test run time fromCARGO_MANIFEST_DIR/src. Panics if the module has neither form, so a typo cannot read as an empty module.module_production_source(name): the same, minus test-only files (tests.rs,*_tests.rs). Used where a gate scans a module's production body (see below).
- Every
include_str!of one of the seven split modules is replaced bymodule_source(..), ingate_coverage.rs,stack_budget.rs,refusal_inventory.rs,decode.rs,stream.rs,encode.rs. Non-split includes (cdf_state.rs,lib.rs,stack_budget.rs, ...) are unchanged. - Sites that cut the production prefix at the inline
mod testsmarker now take that prefix frommodule_production_source: threedecode_bodysites indecode.rs, andhead(..)in the encode chroma gate (encode.rs). Without this, after a split the test files would be counted as production text and the census would change meaning. For an unsplit file the result is the same. stack_budget.rs: theconst FILEStable becamefn files(), since the entries are now read at run time. The seven split modules come from the helper, so a newdecode/foo.rsis scanned automatically.test_source.rsis listed, whichevery_by_value_module_is_scannedrequires becauselib.rsdeclares it. The localFILESin the encoder pin test became alet.refusal_inventory.rs:const GATE_SOURCESbecamefn gate_sources(), same reason.- Two bindings that became unused after the change were removed:
encoder_srcinencode.rsandsrcin onedecode.rsgate (clippy caught both).
Production code: no change. Diff is 91 insertions, 83 deletions, plus the new file.
Verify
Commands run through scripts/remote-run.sh av1splitp0 -- <cmd> (every run landed on host c, or a
after host c was busy). Logs are in ~/.cache/av1splitp0-logs/.
| Check | Baseline (main, unmodified) | After |
|---|---|---|
cargo test -p ec-av1 --release --lib -- --list (count) |
856 tests, 0 benchmarks | 856 tests, 0 benchmarks |
cargo test -p ec-av1 --release --lib -- gate_coverage stack_budget |
28 passed, 0 failed | 28 passed, 0 failed |
full cargo test -p ec-av1 --release --lib |
not run on base | 807 passed, 0 failed, 49 ignored (see note) |
cargo clippy -p ec-av1 --all-targets |
lib test: 321 warnings, 1 deny-level error (below) | 321 warnings, same per-file counts |
cargo check --workspace --all-targets (5 probes) |
not run on base | Finished, exit 0 (probes compile) |
Notes:
- The full suite's first run was killed by the memory guard (
SIGKILLfrommemguard-runner.shat the default 3500M cap, after 339 tests passed). The rerun usedEC_MEMGUARD_MAX=10G -- --test-threads=4and passed 807 with 0 failed. The 49 ignored tests are pre-existing#[ignore]s; this diff adds none, and it removes no test. - Final-tree targeted run after the last two cosmetic edits (unused bindings, indentation):
gate_coverage stack_budget refusal_inventoryplus the decode/encode pins by name: 55 passed, 0 failed. - Clippy: the baseline already fails
ec-av1 (lib test)on a deny-level lint atgate_coverage.rs:2645(unpinned <= UNPINNED_CEILING, absurd comparison). That is not from this lane and was left alone. Per-file warning counts were compared before and after and are identical. cargo check --workspace --all-targetsshows 14 warnings in lib and probe code. None is in the test-only code this step touched; cfg(test) code is not compiled by that command.
Split proof (scratch, reverted)
In the worktree, uncommitted: git mv crates/ec-av1/src/qm.rs crates/ec-av1/src/qm/mod.rs, then
scripts/remote-run.sh av1splitp0 -- cargo test -p ec-av1 --release --lib -- gate_coverage stack_budget
gave 28 passed, 0 failed. The rename was then reverted with git mv back and the empty directory
removed. Nothing from it is committed.
Left
- Steps D1 onward (
decode.rstodecode/mod.rsand beyond) are not started. - The pre-existing clippy deny error in
gate_coverage.rs:2645still blocks a cleancargo clippy --all-targets -- -D warningson ec-av1.