four longroad-pe tests fail on a Linux host build; gate them on Windows #3

Manually merged
github merged 1 commit from github-bot/gh-3 into gh-pr/3/base 2026-12-03 10:29:20 +00:00 AGit
Owner

@⁠Headache3318 on GitHub · 2026-12-03 04:00 UTC · original
Headache3318:pe-tests-host-independent → main · +19 −3 · 1 files · 1 commits · merged 2026-12-03 10:25 UTC

What. cargo test -p longroad-pe on a Linux host build turns four tests red at head 87feabed8efd2c7879181cf007f2d049db961648. This gates the four that read the test binary itself as a PE image, so a Linux host build is green and the Windows build still runs every one of them.

Why it fails — nothing GPU, Wine or title-side: own_image() reads std::env::current_exe() and its comment says the test binary is "a real MSVC-linked PE32+ image". That is true only for a Windows build of the tests. Built for the Linux host the same file is ELF, so ImageInfo::parse answers Unknown file magic before the rva / import-table checks these tests are about can run. The four that read their image through own_image() panic there:

image::tests::parses_own_test_binary                     panicked at crates/longroad-pe/src/image.rs:451:51
image::tests::rva_to_file_offset_rejects_offsets_past_4_gib   panicked at crates/longroad-pe/src/image.rs:478:55
image::tests::rejects_iat_outside_image                  panicked at crates/longroad-pe/src/image.rs:502:14
called `Result::unwrap()` on an `Err` value: Malformed("Unknown file magic")
failures:
    image::tests::parses_own_test_binary
    image::tests::rejects_iat_outside_image
    image::tests::rva_to_file_offset_maps_entry_point
    image::tests::rva_to_file_offset_rejects_offsets_past_4_gib
test result: FAILED. 32 passed; 4 failed; 0 ignored; ...

Measured here (Arch Linux, kernel 7.3.6-arch1-2, 8 cores, rustc 1.98.1 pinned by rust-toolchain.toml, cargo 1.98.1, --locked, host target x86_64-unknown-linux-gnu):

command head result
cargo test --locked -p longroad-pe 87feabed as pushed 32 passed; 4 failed
cargo test --locked -p longroad-pe this branch 32 passed; 0 failed
CARGO_TARGET_X86_64_PC_WINDOWS_MSVC_RUNNER=wine cargo xwin test --locked -p longroad-pe --lib --target x86_64-pc-windows-msvc this branch 36 passed; 0 failed

So the Windows path loses nothing: cross-built with cargo-xwin 0.24.2 (clang 23.1.5, ld.lld 23.1.5), the x86_64-pc-windows-msvc test binary was run directly under wine 11.23 on this machine and all 36 tests — including the four gated here — pass.

Clean for reference at the same head, Linux host, same machine, --locked: longroad-formats 47 passed; 5 ignored; 0 failed, longroad-core 16 passed; 0 failed, longroad-pipeline 7 passed; 0 failed. This is the only place where a host build turns the suite red, and the repository has no CI workflow that would have caught it (.github/ holds only the issue templates).

rejects_garbage_without_panicking keeps its two platform-independent garbage checks on every host and gates only the truncated-image check, which is the part that needs a real PE. No title files anywhere: everything is the crate's own test data, per docs/asset-policy.md.

AI-assisted (Hermes Agent, Nous Hermes; measured and reviewed on one machine).

**@⁠Headache3318** on GitHub · 2026-12-03 04:00 UTC · [original](https://github.com/Lesloo/longroad/pull/3) `Headache3318:pe-tests-host-independent` → `main` · +19 −3 · 1 files · 1 commits · merged 2026-12-03 10:25 UTC **What.** `cargo test -p longroad-pe` on a Linux host build turns four tests red at head `87feabed8efd2c7879181cf007f2d049db961648`. This gates the four that read the test binary itself as a PE image, so a Linux host build is green and the Windows build still runs every one of them. **Why it fails** — nothing GPU, Wine or title-side: `own_image()` reads `std::env::current_exe()` and its comment says the test binary is "a real MSVC-linked PE32+ image". That is true only for a Windows build of the tests. Built for the Linux host the same file is ELF, so `ImageInfo::parse` answers `Unknown file magic` before the rva / import-table checks these tests are about can run. The four that read their image through `own_image()` panic there: ```text image::tests::parses_own_test_binary panicked at crates/longroad-pe/src/image.rs:451:51 image::tests::rva_to_file_offset_rejects_offsets_past_4_gib panicked at crates/longroad-pe/src/image.rs:478:55 image::tests::rejects_iat_outside_image panicked at crates/longroad-pe/src/image.rs:502:14 called `Result::unwrap()` on an `Err` value: Malformed("Unknown file magic") failures: image::tests::parses_own_test_binary image::tests::rejects_iat_outside_image image::tests::rva_to_file_offset_maps_entry_point image::tests::rva_to_file_offset_rejects_offsets_past_4_gib test result: FAILED. 32 passed; 4 failed; 0 ignored; ... ``` **Measured here** (Arch Linux, kernel 7.3.6-arch1-2, 8 cores, `rustc 1.98.1` pinned by `rust-toolchain.toml`, `cargo 1.98.1`, `--locked`, host target `x86_64-unknown-linux-gnu`): | command | head | result | | --- | --- | --- | | `cargo test --locked -p longroad-pe` | `87feabed` as pushed | `32 passed; 4 failed` | | `cargo test --locked -p longroad-pe` | this branch | `32 passed; 0 failed` | | `CARGO_TARGET_X86_64_PC_WINDOWS_MSVC_RUNNER=wine cargo xwin test --locked -p longroad-pe --lib --target x86_64-pc-windows-msvc` | this branch | `36 passed; 0 failed` | So the Windows path loses nothing: cross-built with `cargo-xwin 0.24.2` (clang 23.1.5, `ld.lld` 23.1.5), the `x86_64-pc-windows-msvc` test binary was run directly under wine 11.23 on this machine and all 36 tests — including the four gated here — pass. Clean for reference at the same head, Linux host, same machine, `--locked`: `longroad-formats` `47 passed; 5 ignored; 0 failed`, `longroad-core` `16 passed; 0 failed`, `longroad-pipeline` `7 passed; 0 failed`. This is the only place where a host build turns the suite red, and the repository has no CI workflow that would have caught it (`.github/` holds only the issue templates). `rejects_garbage_without_panicking` keeps its two platform-independent garbage checks on every host and gates only the truncated-image check, which is the part that needs a real PE. No title files anywhere: everything is the crate's own test data, per `docs/asset-policy.md`. AI-assisted (Hermes Agent, Nous Hermes; measured and reviewed on one machine).
`cargo test -p longroad-pe` on a Linux host turns four tests red at `87feabed`:
`own_image()` reads `std::env::current_exe()`, which is a PE only when the test
binary is a Windows build, so `ImageInfo::parse` answers `Unknown file magic`
before the rva and import-table checks these tests exist for can run.

- `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`
  are now `cfg(windows)`, with the reason said where the helper is.
- `rejects_garbage_without_panicking` keeps its two garbage-buffer checks on
  every host and gates only the truncated-image check, so nothing is lost.

Measured on this box (Arch, kernel 7.3.6, the pinned rustc 1.98.1):
before `32 passed; 4 failed`, after `32 passed; 0 failed`; the Windows path
still runs all of them — the `x86_64-pc-windows-msvc` test binary run under
wine here gave `36 passed; 0 failed`.

Co-Authored-By: Hermes Agent (Nous Hermes, AI-assisted; one machine)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-03 04:02:37 +00:00
github-bot changed target branch from main to gh-pr/3/base 2026-12-03 10:29:17 +00:00
github manually merged commit bc27ac5666 into gh-pr/3/base 2026-12-03 10:29:20 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.