PE tests: cover ImportLibrary::parse short imports and archive errors #1813

Open
n-romanovich wants to merge 1 commit from upstream-pr/1814 into main
n-romanovich commented 2026-11-24 22:57:18 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by n-romanovich on 2026-11-24T22:57:18Z.


Adds synthetic COFF archive unit tests in crates/victory-pe/src/implib.rs covering Code/Data/Const short imports, named and ordinal exports, sorting/deduplication, other_members counting, and invalid archive rejection.

AI-assisted; verified with rustfmt --check, cargo clippy -p victory-pe --all-targets --locked -- -D warnings, and cargo test -p victory-pe --locked (9 passed).

<!-- greyfinch-sync:Marvisak/VIctory:issue:6593088088 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1814). Originally posted by [n-romanovich](https://github.com/n-romanovich) on 2026-11-24T22:57:18Z. --- Adds synthetic COFF archive unit tests in `crates/victory-pe/src/implib.rs` covering `Code`/`Data`/`Const` short imports, named and ordinal exports, sorting/deduplication, `other_members` counting, and invalid archive rejection. AI-assisted; verified with `rustfmt --check`, `cargo clippy -p victory-pe --all-targets --locked -- -D warnings`, and `cargo test -p victory-pe --locked` (9 passed).
catminou4 commented 2026-11-25 00:06:14 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-24T23:05:50Z.

Review: APPROVED


Tested locally on macOS arm64 (rustc 1.98.1): PR head merged cleanly into current main (70564ae).

cargo test -p victory-pe --locked → 5 passed, 4 failed — the 4 failures are the PRE-EXISTING macOS image::tests ones (test binary is Mach-O, parsed as PE; same on main), NOT this PR. The PR's own tests pass: implib::tests::parses_short_imports_sorts_dedups_and_counts_other_members + rejects_invalid_archive_header both ok. ImportLibrary::parse coverage for short imports and archive errors is exactly the missing PE coverage.

<!-- greyfinch-sync:Marvisak/VIctory:review:6048826405 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1814#pullrequestreview-6048826405). Originally posted by [catminou4](https://github.com/catminou4) on 2026-11-24T23:05:50Z. **Review:** APPROVED --- Tested locally on macOS arm64 (rustc 1.98.1): PR head merged cleanly into current main (70564ae). cargo test -p victory-pe --locked → 5 passed, 4 failed — the 4 failures are the PRE-EXISTING macOS image::tests ones (test binary is Mach-O, parsed as PE; same on main), NOT this PR. The PR's own tests pass: implib::tests::parses_short_imports_sorts_dedups_and_counts_other_members + rejects_invalid_archive_header both ok. ImportLibrary::parse coverage for short imports and archive errors is exactly the missing PE coverage.
Melow-code commented 2026-11-25 00:06:14 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Melow-code on 2026-11-24T23:07:32Z.

Review: APPROVED


Test-only PR, synthetic COFF archive covers short imports, sorting/dedup, and invalid-archive rejection. Clean.

<!-- greyfinch-sync:Marvisak/VIctory:review:6048843463 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1814#pullrequestreview-6048843463). Originally posted by [Melow-code](https://github.com/Melow-code) on 2026-11-24T23:07:32Z. **Review:** APPROVED --- Test-only PR, synthetic COFF archive covers short imports, sorting/dedup, and invalid-archive rejection. Clean.
DesertGamer commented 2026-11-25 00:06:42 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by DesertGamer on 2026-11-24T23:07:18Z.


VIctory V2: community PRs, merged and tested

Open PRs sitting in the queue? V2 pulls them into one build, screens each one (binaries, build scripts, hooks, new deps) and runs tests after every batch.

Where it stands today: launches, runs the menu at 30 fps, plays the intro video, reaches the start screen and loads the world (~50 s). Entering the world is the current blocker: rendering fails with a GPU "device removed" error (tracked in issue #1).

⚠️ Entering the world on a real GPU can hang it and make Windows reset the driver. Try it at your own risk.

Not playable yet, but every batch of merged fixes moves it closer. If you have a PR that's stuck, or a GPU to test on, I'd love your help:
https://DesertGamer/VIctory-V2

Unofficial community fork of Marvisak/VIctory, GPL-3.0.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7147037525 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1814#issuecomment-7147037525). Originally posted by [DesertGamer](https://github.com/DesertGamer) on 2026-11-24T23:07:18Z. --- ### VIctory V2: community PRs, merged and tested Open PRs sitting in the queue? V2 pulls them into one build, screens each one (binaries, build scripts, hooks, new deps) and runs tests after every batch. **Where it stands today:** launches, runs the menu at 30 fps, plays the intro video, reaches the start screen and loads the world (~50 s). Entering the world is the current blocker: rendering fails with a GPU "device removed" error (tracked in issue #1). :warning: Entering the world on a real GPU can hang it and make Windows reset the driver. Try it at your own risk. Not playable yet, but every batch of merged fixes moves it closer. If you have a PR that's stuck, or a GPU to test on, I'd love your help: https://DesertGamer/VIctory-V2 *Unofficial community fork of Marvisak/VIctory, GPL-3.0.*
Headache3318 commented 2026-11-25 02:06:05 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Headache3318 on 2026-11-25T01:28:28Z.


Tested on Linux (Arch, kernel 7.3.5, 3× RTX 4090 driver 620.73.04), Rust 1.98.1 (pinned by rust-toolchain.toml). PR head 32ad8f6 applied cleanly onto current main ccfb029.

  • cargo test -p victory-pe --locked: 2 implib tests passed (the 4 image tests fail on Linux as expected, parsing the test binary as a PE); total 5 passed.
  • cargo clippy -p victory-pe --all-targets --locked -- -D warnings: clean.

Not tested: Windows MSVC build, the title itself. AI-assisted.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7149586364 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1814#issuecomment-7149586364). Originally posted by [Headache3318](https://github.com/Headache3318) on 2026-11-25T01:28:28Z. --- Tested on Linux (Arch, kernel 7.3.5, 3× RTX 4090 driver 620.73.04), Rust 1.98.1 (pinned by `rust-toolchain.toml`). PR head `32ad8f6` applied cleanly onto current `main` `ccfb029`. - `cargo test -p victory-pe --locked`: 2 implib tests passed (the 4 `image` tests fail on Linux as expected, parsing the test binary as a PE); total 5 passed. - `cargo clippy -p victory-pe --all-targets --locked -- -D warnings`: clean. Not tested: Windows MSVC build, the title itself. AI-assisted.
Marvisak commented 2026-11-25 02:06:15 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T01:36:47Z.


Automated triage for the maintainers.

Proposed close: already covered in main. Update after your reply: thanks for dropping the duplicate helpers. Both of the new tests in crates/victory-pe/src/implib.rs repeat cases that main's mod tests already checks:

  • malformed_short_import_counts_as_other_member: members_that_are_not_import_objects_are_counted already has a short.lib/ member, an import_object truncated to 24 bytes, and asserts that it lands in other_members.
  • named_import_normalizes_hint_to_zero: parses_named_code_imports already builds ExitProcess with hint 7 and asserts hint: 0, with a comment explaining why.

A test for a path ImportLibrary::parse does not cover yet would change the verdict. One example is a member whose ArchiveFile data cannot be read, so the ? propagates an error.

CI: passing (check).

This pull request will be closed in 48 hours unless the author pushes a change or a maintainer removes the triage: proposed close label.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7149750402 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1814#issuecomment-7149750402). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T01:36:47Z. --- <!-- victory-triage v1 head=8e6b1162d29bb0f908583ce0d9cb7b9ead9adc09 verdict=proposed-close at=2026-11-25T07:18:47Z --> Automated triage for the maintainers. **Proposed close: already covered in main.** Update after your reply: thanks for dropping the duplicate helpers. Both of the new tests in `crates/victory-pe/src/implib.rs` repeat cases that `main`'s `mod tests` already checks: - `malformed_short_import_counts_as_other_member`: `members_that_are_not_import_objects_are_counted` already has a `short.lib/` member, an `import_object` truncated to 24 bytes, and asserts that it lands in `other_members`. - `named_import_normalizes_hint_to_zero`: `parses_named_code_imports` already builds `ExitProcess` with hint 7 and asserts `hint: 0`, with a comment explaining why. A test for a path `ImportLibrary::parse` does not cover yet would change the verdict. One example is a member whose `ArchiveFile` data cannot be read, so the `?` propagates an error. CI: passing (`check`). This pull request will be closed in 48 hours unless the author pushes a change or a maintainer removes the `triage: proposed close` label. --- _Generated by [Claude Code](https://claude.ai/code)_
n-romanovich commented 2026-11-25 02:06:18 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by n-romanovich on 2026-11-25T01:45:57Z.


@Marvisak, rebased onto the current main and resolved the conflict in crates/victory-gpu/src/descriptor/host.rs.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7149930130 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1814#issuecomment-7149930130). Originally posted by [n-romanovich](https://github.com/n-romanovich) on 2026-11-25T01:45:57Z. --- @Marvisak, rebased onto the current main and resolved the conflict in crates/victory-gpu/src/descriptor/host.rs.
n-romanovich commented 2026-11-25 07:03:22 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by n-romanovich on 2026-11-25T06:43:17Z.


@Marvisak, updated test/pe-implib (8e6b116):

  • Removed the duplicate push_member / short_import helpers and the tests already covered in main.
  • Added two tests using main's archive / import_object helpers for cases ImportLibrary::parse didn't cover yet:
    • malformed_short_import_counts_as_other_member: verifies a truncated short-import header increments other_members instead of failing ImportLibrary::parse.
    • named_import_normalizes_hint_to_zero: verifies named imports normalize a non-zero ordinal_or_hint to hint: 0.
<!-- greyfinch-sync:Marvisak/VIctory:comment:7155087704 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1814#issuecomment-7155087704). Originally posted by [n-romanovich](https://github.com/n-romanovich) on 2026-11-25T06:43:17Z. --- @Marvisak, updated `test/pe-implib` (`8e6b116`): - Removed the duplicate `push_member` / `short_import` helpers and the tests already covered in `main`. - Added two tests using `main`'s `archive` / `import_object` helpers for cases `ImportLibrary::parse` didn't cover yet: - `malformed_short_import_counts_as_other_member`: verifies a truncated short-import header increments `other_members` instead of failing `ImportLibrary::parse`. - `named_import_normalizes_hint_to_zero`: verifies named imports normalize a non-zero `ordinal_or_hint` to `hint: 0`.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/1814:upstream-pr/1814'
git switch 'upstream-pr/1814'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/1814'
git switch 'upstream-pr/1814'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1814'
git switch 'upstream-pr/1814'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1814'
git switch 'main'
git merge --squash 'upstream-pr/1814'
git switch 'main'
git merge --ff-only 'upstream-pr/1814'
git switch 'main'
git merge 'upstream-pr/1814'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
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.

Reference
Marvisak/VIctory!1813
No description provided.