fix(pe,shader): allow victory-pe tests and victory-shader clippy --all-targets to pass on non-Windows hosts #313

Closed
opened 2026-12-02 08:59:57 +00:00 by github-bot · 0 comments
Owner

@⁠RUIZ-Enrique-25002136 on GitHub · 2026-12-02 08:59 UTC · original

Summary

Running the cross-platform Rust crates (victory-pe, victory-shader) on non-Windows hosts (e.g., Linux x86_64) currently fails tests and --all-targets clippy due to two small Windows-specific assumptions in test code:

  1. crates/victory-pe/src/image.rs:449-511 (victory-pe unit tests):

    • parses_own_test_binary, rva_to_file_offset_maps_entry_point, rva_to_file_offset_rejects_offsets_past_4_gib, and rejects_iat_outside_image call own_image() (std::fs::read(std::env::current_exe().unwrap())) and unwrap ImageInfo::parse(...).
    • On non-Windows hosts, current_exe() is an ELF or Mach-O binary rather than a PE32+ image, causing all 4 tests to fail with Malformed("Unknown file magic").
    • Adding #[cfg(windows)] to those 4 self-image tests keeps rejects_garbage_without_panicking and all synthetic PE tests active cross-platform while allowing cargo test -p victory-pe to pass on Linux/macOS.
  2. crates/victory-shader/src/emit/mod.rs:1402, 1551, 2431, 3055, 3298 (victory-shader test warnings):

    • Several test helpers in emit::mod::tests gate validator::Validator and host::Host assertions behind #[cfg(windows)], leaving 6 unused-import / unused-variable / unused-mut warnings under #[cfg(not(windows))]:
      • emit/mod.rs:1402: use super::bitcode::Attr;
      • emit/mod.rs:1551: use super::shader::Shader;
      • emit/mod.rs:2431: let ms = triangle_mesh(...) (only read inside #[cfg(windows)])
      • emit/mod.rs:3055: let mut dxil = l.dxil; (only read/mutated inside #[cfg(windows)])
      • emit/mod.rs:3298: let shader = emit(...) (only read inside #[cfg(windows)])
    • As a result, cargo clippy -p victory-shader --all-targets -- -D warnings fails on non-Windows hosts even though victory-shader itself is pure platform-independent Rust.
**@⁠RUIZ-Enrique-25002136** on GitHub · 2026-12-02 08:59 UTC · [original](https://github.com/Androtim/MiniVI/issues/313) ## Summary Running the cross-platform Rust crates (`victory-pe`, `victory-shader`) on non-Windows hosts (e.g., Linux `x86_64`) currently fails tests and `--all-targets` clippy due to two small Windows-specific assumptions in test code: 1. **`crates/victory-pe/src/image.rs:449-511` (`victory-pe` unit tests):** - `parses_own_test_binary`, `rva_to_file_offset_maps_entry_point`, `rva_to_file_offset_rejects_offsets_past_4_gib`, and `rejects_iat_outside_image` call `own_image()` (`std::fs::read(std::env::current_exe().unwrap())`) and unwrap `ImageInfo::parse(...)`. - On non-Windows hosts, `current_exe()` is an ELF or Mach-O binary rather than a PE32+ image, causing all 4 tests to fail with `Malformed("Unknown file magic")`. - Adding `#[cfg(windows)]` to those 4 self-image tests keeps `rejects_garbage_without_panicking` and all synthetic PE tests active cross-platform while allowing `cargo test -p victory-pe` to pass on Linux/macOS. 2. **`crates/victory-shader/src/emit/mod.rs:1402, 1551, 2431, 3055, 3298` (`victory-shader` test warnings):** - Several test helpers in `emit::mod::tests` gate `validator::Validator` and `host::Host` assertions behind `#[cfg(windows)]`, leaving 6 unused-import / unused-variable / unused-mut warnings under `#[cfg(not(windows))]`: - `emit/mod.rs:1402`: `use super::bitcode::Attr;` - `emit/mod.rs:1551`: `use super::shader::Shader;` - `emit/mod.rs:2431`: `let ms = triangle_mesh(...)` (only read inside `#[cfg(windows)]`) - `emit/mod.rs:3055`: `let mut dxil = l.dxil;` (only read/mutated inside `#[cfg(windows)]`) - `emit/mod.rs:3298`: `let shader = emit(...)` (only read inside `#[cfg(windows)]`) - As a result, `cargo clippy -p victory-shader --all-targets -- -D warnings` fails on non-Windows hosts even though `victory-shader` itself is pure platform-independent Rust.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-02 08:59:58 +00:00
This discussion has been locked. Commenting is limited to contributors.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/Androtim--MiniVI#313
No description provided.