Tests: PE parser on a hand-built image, in both layouts #831

Open
github-bot wants to merge 1 commit from github-bot/gh-831 into main AGit
Owner

@⁠mastrr9 on GitHub · 2026-11-24 06:23 UTC · original
mastrr9:tests/pe-synthetic → main · +568 −0 · 1 files · 1 commits · open

Adds a test-only suite (crates/xcl/tests/pe_synthetic.rs) exercising xcl::pe against a synthetic PE32+ image built in-memory (no system DLL dependencies), verified identically in both Layout::File and Layout::Mapped:

  • Header fields, section table, SizeOfOptionalHeader and NumberOfRvaAndSizes variants, and invalid machine/magic/NT-offset errors
  • rva_to_offset verified across the full image range against a reference section-table model, including .text/.data zero tails and vsize == 0 sections
  • Reads straddling section raw ends and SizeOfHeaders, plus cstr_at termination and 4096-byte cap
  • Imports (named + ordinal + INT-less IAT), delay imports (RVA-based), base relocations (DIR64, HIGHLOW, ABSOLUTE padding, malformed block lengths), IMAGE_TLS_DIRECTORY64, and exports with forwarders (OwnedExports)
  • Exhaustive byte-by-byte truncation sweep over every prefix of both layouts verifying no panics and consistent error-or-prefix results

Tested

  • Hardware/OS: NVIDIA RTX 5080 (driver 617.42 / 32.0.16.1742), Windows 11 Pro 25H2 (26200.9974), rustc 1.100.0 (0ef1bc386 2026-11-09) MSVC debug, DXC Windows SDK 10.0.26100.0, d3d12SDKLayers.dll installed
  • Commit tested: 1a7f6a519df414a3fe91d66ef6b039952e2672aa
  • cargo build --workspace: clean (only pre-existing fetch_update deprecation warning)
  • cargo test --workspace -- --test-threads=4: 723 passed, 0 failed, 41 ignored (pe_synthetic: 10 passed, 0 failed, 0 ignored)
  • SKIPPED GPU tests: gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask: no wave64, gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware: no wave64

Not tested

  • Test-only diff (crates/xcl/tests/pe_synthetic.rs); no runtime code changed and no retail title run performed.

AI use

  • Authored with Claude Code (Claude Opus 5.5); reviewed, audited (removed an #[ignore] test to adhere to CONTRIBUTING.md), and verified on native Windows/RTX 5080 hardware with Antigravity (Gemini 4 Neon + Claude Sonnet 5.5).
**@⁠mastrr9** on GitHub · 2026-11-24 06:23 UTC · [original](https://github.com/xcl-dev/xcl/pull/831) `mastrr9:tests/pe-synthetic` → `main` · +568 −0 · 1 files · 1 commits · open Adds a test-only suite (`crates/xcl/tests/pe_synthetic.rs`) exercising `xcl::pe` against a synthetic PE32+ image built in-memory (no system DLL dependencies), verified identically in both `Layout::File` and `Layout::Mapped`: - Header fields, section table, `SizeOfOptionalHeader` and `NumberOfRvaAndSizes` variants, and invalid machine/magic/NT-offset errors - `rva_to_offset` verified across the full image range against a reference section-table model, including `.text`/`.data` zero tails and `vsize == 0` sections - Reads straddling section raw ends and `SizeOfHeaders`, plus `cstr_at` termination and 4096-byte cap - Imports (named + ordinal + INT-less IAT), delay imports (RVA-based), base relocations (`DIR64`, `HIGHLOW`, `ABSOLUTE` padding, malformed block lengths), `IMAGE_TLS_DIRECTORY64`, and exports with forwarders (`OwnedExports`) - Exhaustive byte-by-byte truncation sweep over every prefix of both layouts verifying no panics and consistent error-or-prefix results **Tested** - Hardware/OS: NVIDIA RTX 5080 (driver `617.42` / `32.0.16.1742`), Windows 11 Pro 25H2 (`26200.9974`), `rustc 1.100.0 (0ef1bc386 2026-11-09)` MSVC debug, DXC Windows SDK `10.0.26100.0`, `d3d12SDKLayers.dll` installed - Commit tested: `1a7f6a519df414a3fe91d66ef6b039952e2672aa` - `cargo build --workspace`: clean (only pre-existing `fetch_update` deprecation warning) - `cargo test --workspace -- --test-threads=4`: **723 passed, 0 failed, 41 ignored** (`pe_synthetic`: 10 passed, 0 failed, 0 ignored) - `SKIPPED` GPU tests: `gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask: no wave64`, `gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware: no wave64` **Not tested** - Test-only diff (`crates/xcl/tests/pe_synthetic.rs`); no runtime code changed and no retail title run performed. **AI use** - Authored with Claude Code (Claude Opus 5.5); reviewed, audited (removed an `#[ignore]` test to adhere to `CONTRIBUTING.md`), and verified on native Windows/RTX 5080 hardware with Antigravity (Gemini 4 Neon + Claude Sonnet 5.5).
Build a PE32+ image in the test and check every directory the loader
reads (imports, delay imports, relocations, TLS, exports with
forwarders) as the file on disk and as the mapped image, plus a sweep
over every truncation of the image: each read is an error or exactly
what the whole image reads, never a panic.

Assisted-by: Claude Code (Claude Opus 5.5)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:33:59 +00:00
Author
Owner

@⁠dcastell1 on GitHub · 2026-11-24 06:39 UTC · original

Verified on Windows 11 10.0.26300 with an NVIDIA GeForce RTX 5090 (driver 621.24), Rust 1.100 stable (MSVC 14.44.35207), main at beaa245 + this PR's test file dropped in unchanged:

cargo build --workspace          # exit 0, before this
cargo test -p xcl --test pe_synthetic
test result: ok. 10 passed; 0 failed; 0 ignored

Nothing else of the tree was touched, and the suite passes natively on Windows (no Wine, no prefix). AI-assisted (opencode): copied the file, built and ran the target.

**@⁠dcastell1** on GitHub · 2026-11-24 06:39 UTC · [original](https://github.com/xcl-dev/xcl/pull/831#issuecomment-7124165189) Verified on Windows 11 10.0.26300 with an NVIDIA GeForce RTX 5090 (driver 621.24), Rust 1.100 stable (MSVC 14.44.35207), `main` at `beaa245` + this PR's test file dropped in unchanged: ``` cargo build --workspace # exit 0, before this cargo test -p xcl --test pe_synthetic test result: ok. 10 passed; 0 failed; 0 ignored ``` Nothing else of the tree was touched, and the suite passes natively on Windows (no Wine, no prefix). AI-assisted (opencode): copied the file, built and ran the target.
Author
Owner

@⁠milas6669 on GitHub · 2026-11-24 07:02 UTC · original

Test report on 1a7f6a5 (PR head; its base is main beaa245, which is still main; no merge conflict).

Tested

  • NVIDIA GeForce RTX 3070 (32-lane waves), Intel i9-10900KF, Windows 11 Pro 10.0.26200, rustc 1.100.0 x86_64-pc-windows-msvc, debug

  • cargo test --workspace --no-fail-fast -- --test-threads=4; the same command on main beaa245 (this PR's base): 713 passed, 0 failed, 41 ignored

  • on this head: 723 passed, 0 failed, 41 ignored (+10 over main: the ten new tests in pe_synthetic.rs, e.g. relocations, tls_directory, every_truncation_is_an_error_or_a_prefix_of_the_truth)

  • SKIPPED (no wave64) on this GPU: gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware

Not tested

  • a real game's PE (the tests use hand-built images), AMD / wave64 hardware, scripts/smoke.ps1 (test-only diff)

AI use

  • Claude Code, Claude Sonnet 5.5, ran the commands and wrote this report. I did not review the diff beyond reading it.
**@⁠milas6669** on GitHub · 2026-11-24 07:02 UTC · [original](https://github.com/xcl-dev/xcl/pull/831#issuecomment-7124551686) Test report on `1a7f6a5` (PR head; its base is `main` beaa245, which is still `main`; no merge conflict). **Tested** - NVIDIA GeForce RTX 3070 (32-lane waves), Intel i9-10900KF, Windows 11 Pro 10.0.26200, rustc 1.100.0 `x86_64-pc-windows-msvc`, debug - `cargo test --workspace --no-fail-fast -- --test-threads=4`; the same command on `main` beaa245 (this PR's base): **713 passed, 0 failed, 41 ignored** - on this head: **723 passed, 0 failed, 41 ignored (+10 over main: the ten new tests in `pe_synthetic.rs`, e.g. `relocations`, `tls_directory`, `every_truncation_is_an_error_or_a_prefix_of_the_truth`)** - SKIPPED (no wave64) on this GPU: `gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu_wave32_program_in_wave64_hardware` **Not tested** - a real game's PE (the tests use hand-built images), AMD / wave64 hardware, `scripts/smoke.ps1` (test-only diff) **AI use** - Claude Code, Claude Sonnet 5.5, ran the commands and wrote this report. I did not review the diff beyond reading it.
Author
Owner

@⁠SlopTart on GitHub · 2026-11-24 07:17 UTC · original

Linux / AMD RDNA3 datapoint.

Merged state: head 1a7f6a5 onto main beaa245, clean merge.

Full suite, cargo test --workspace --release --no-fail-fast --target x86_64-pc-windows-gnu -- --test-threads=4: 713 passed, 10 failed, 41 ignored. Failures are the known Wine-lane set from my #42 rows plus #718 trio members; nothing here fails because of your change. The hand-built PE image parser tests pass in both layouts, and the xg_oracle suite is green here.

Not tested: retail titles (none here), Windows, RDNA4.
Counts only, no game data.

Machine: RX 7900 XT (RADV NAVI31), Mesa 26.2.5, kernel 7.2 (Arch), Proton Experimental (wine-11.0), patched vkd3d-proton v3.1, Rust cross x86_64-pc-windows-gnu, XCL_NETWORK=0, release profile, --test-threads=4. Linux rows: #42 / #718.

AI use: Hermes agent (local Qwen-class) ran the suite and drafted this; I checked it before posting.

**@⁠SlopTart** on GitHub · 2026-11-24 07:17 UTC · [original](https://github.com/xcl-dev/xcl/pull/831#issuecomment-7124833117) Linux / AMD RDNA3 datapoint. **Merged state:** head `1a7f6a5` onto main `beaa245`, clean merge. **Full suite, `cargo test --workspace --release --no-fail-fast --target x86_64-pc-windows-gnu -- --test-threads=4`:** **713 passed, 10 failed, 41 ignored**. Failures are the known Wine-lane set from my #42 rows plus #718 trio members; nothing here fails because of your change. The hand-built PE image parser tests pass in both layouts, and the `xg_oracle` suite is green here. **Not tested:** retail titles (none here), Windows, RDNA4. Counts only, no game data. **Machine:** RX 7900 XT (RADV NAVI31), Mesa 26.2.5, kernel 7.2 (Arch), Proton Experimental (wine-11.0), patched vkd3d-proton v3.1, Rust cross `x86_64-pc-windows-gnu`, `XCL_NETWORK=0`, release profile, `--test-threads=4`. Linux rows: #42 / #718. AI use: Hermes agent (local Qwen-class) ran the suite and drafted this; I checked it before posting.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-25 10:39 UTC · original

Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib: 1038 passed, 1 failed in one parallel run; the failing test passes on a single-threaded rerun (1039/0). Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.

Thanks!

**@⁠DavidM1911** on GitHub · 2026-11-25 10:39 UTC · [original](https://github.com/xcl-dev/xcl/pull/831#issuecomment-7160003148) Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: 1038 passed, 1 failed in one parallel run; the failing test passes on a single-threaded rerun (1039/0). Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun. Thanks!
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/831/head:github-bot/gh-831'
git switch 'github-bot/gh-831'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-831'
git switch 'github-bot/gh-831'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-831'
git switch 'github-bot/gh-831'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-831'
git switch 'main'
git merge --squash 'github-bot/gh-831'
git switch 'main'
git merge --ff-only 'github-bot/gh-831'
git switch 'main'
git merge 'github-bot/gh-831'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.