PE tests: parse a synthetic image so ImageInfo is covered on every host #257
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!257
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/257/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@SkippySteve on GitHub · 2026-11-24 01:52 UTC · original
SkippySteve/victory-pr-own-next7→main· +225 −0 · 1 files · 1 commits · closed without mergingThe
ImageInfounit tests invictory-pethat cover imports, TLS and section mapping parse the test binary itself. That binary is a PE only on Windows, so on Linux they fail withUnknown file magic, and #235 limits them to Windows. This PR adds coverage that runs on every host and doesn't touch those tests or any non-test code.What it adds
crates/victory-pe/tests/synthetic_image.rsbuilds a small PE32+ executable in memory: one section, aKERNEL32.dllimport by name (with a hint) and by ordinal, and two TLS callbacks. It checks:rva_to_file_offset: section data maps correctly, headers and the section end don't map, raw padding past the virtual size isn't section data, and an offset near 4 GiB doesn't wrapSizeOfImage, including at the 4 GiB limit, is reported asMalformedUnsupported, and truncated input errors without panickingThe image is built byte by byte in the test. No game data, fixtures or files on disk.
Testing
On Arch Linux (x86_64-unknown-linux-gnu):
cargo test -p victory-pe --test synthetic_image: 8 passedcargo clippy -p victory-pe --all-targets -- -D warnings,cargo fmt --checkandcargo xtask policyare cleanimage.rs: the IAT bound, the virtual-size clamp and the TLS null terminator. Each one made a test fail.cargo test -p victory-peon Linux still shows the 4 existing own-binary failures frommain. #235 handles those. I haven't run this on Windows; the new file uses only the public API and doesn't depend on the host.@CesarLopesO on GitHub · 2026-11-24 02:08 UTC · original
Independent validation on Debian 13 (Trixie).
I tested this PR locally with the following results:
cargo test --locked -p victory-pe --test synthetic_image— 8 passed.cargo clippy -p victory-pe --all-targets -- -D warnings— passed, no warnings.rustfmt --edition 2024 --check crates/victory-pe/tests/synthetic_image.rs— passed.cargo xtask policy— passed (152 files OK).One note: workspace-wide
cargo fmt --all -- --checkreports formatting differences in unrelated existing files. The newsynthetic_image.rsfile passes its individual formatting check.No game data or external fixtures were used.
Thanks for the contribution!
@SkippySteve on GitHub · 2026-11-24 02:27 UTC · original
superseded by #287 (combined PE/loader hermetic synthetic tests)
Pull request closed