Skip to content

Shaders: lower's tests in their own file, under the policy's size limit - #3097

Open
neonbyte1 wants to merge 1 commit into
Marvisak:mainfrom
neonbyte1:pr/lower-tests
Open

neonbyte1 wants to merge 1 commit into
Marvisak:mainfrom
neonbyte1:pr/lower-tests

Conversation

@neonbyte1

Copy link
Copy Markdown

emit/lower.rs is 520,563 bytes on main, 3,725 under the asset policy's 512 KiB per-file limit. Two open PRs grow it: #2968 by 601 bytes and #2977 by 3,097, which together leave about 27 bytes. The maintainer triage on #2977 suggested moving the tests out, so this does it on its own.

The mod tests block moves to emit/lower_tests.rs, still a child module of lower through #[path], so it keeps access to the private items it tests. Its contents are unchanged except for rustfmt's layout after losing one indentation level. lower.rs drops to 468,320 bytes.

Checks:

  • Tests: emit::lower::tests, 33 before and 33 after, all pass. Run under cargo xtask wine-test (xtask: wine-test runs the Windows tests on a Linux host under Wine #1218) on Linux: GE-Proton11-14 Wine, RTX 5090. These tests don't touch the GPU's results except through the optional DXIL validator.
  • Lint: cargo clippy --workspace --all-targets, with and without diagnostics, is clean, and cargo xtask policy passes.

No behaviour change.

AI-assisted (Claude); measured on my machine, no game data shared.

emit/lower.rs is 520,563 bytes, 3,725 under the asset policy's 512 KiB
per-file limit, and open PRs that grow it (Marvisak#2968, Marvisak#2977) leave it about 27
bytes short. Its test module moves, unchanged but for rustfmt's layout of
the one indentation level less, to emit/lower_tests.rs, still a child
module of `lower` (`#[path]`), so it keeps its access to the private items
it tests. lower.rs is now 468,320 bytes.

Copy link
Copy Markdown
Owner

Automated triage for the maintainers.

Merge candidate. The mod tests block of crates/victory-shader/src/emit/lower.rs moves to emit/lower_tests.rs, still a child of lower through #[path] under #[cfg(test)]. I compared the moved text with main's block, and it is identical apart from indentation and rustfmt's commas. This brings lower.rs to 468,320 bytes, well under xtask/src/policy.rs's MAX_FILE_SIZE (512 KiB), and it follows the *_tests.rs layout emit/mod.rs already uses. Open PRs that edit lower.rs's tests (#2968, #2977) will need a rebase after this lands.

CI: passing.


Generated by Claude Code

@fuzeofficlal fuzeofficlal left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified 9bca0871 locally on Windows 11 x64:

  • cargo clippy --all-targets --locked -- -D warnings and cargo clippy -p victory-shader --all-targets --all-features --locked -- -D warnings: clean (3.36s / 4.11s).
  • cargo test -p xtask --locked policy::tests::repository_passes_policy: 1 passed, 0 failed (0.33s).
  • cargo test -p victory-shader --lib --locked emit::lower::tests: 33 passed, 0 failed (0.02s).
  • rustfmt --edition 2024 --check crates/victory-shader/src/emit/lower_tests.rs: clean.

The production prefix of emit/lower.rs (468,320 bytes total) is byte-for-byte identical to main, #[cfg(test)] #[path = "lower_tests.rs"] mod tests; keeps lower::tests module visibility intact, and all 33 tests and helpers in emit/lower_tests.rs (47,450 bytes) match the original inline block aside from de-indentation and formatting. Both files sit comfortably under the 524,288-byte asset-policy limit.

LGTM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants