PE tests: read a synthetic import library so ImportLibrary is covered #268

Closed
github-bot wants to merge 1 commit from gh-pr/268/head into gh-pr/268/base
Owner

@⁠SkippySteve on GitHub · 2026-11-24 01:55 UTC · original
SkippySteve/victory-pr-own-next9 → main · +114 −0 · 1 files · 1 commits · closed without merging

crates/victory-pe/src/implib.rs (the reader behind victory lib-exports) had no tests. This adds two. Each builds an in-memory !<arch> archive of short-format import objects, so the tests need no SDK .lib and no game data and run on every host.

  • reads_short_imports_sorted_and_deduplicated: covers each name type: by name, no-prefix (_Prefixed → Prefixed), undecorated (_Stdcall@8 → Stdcall) and by ordinal. Each export keeps its code/data/const kind. The output is sorted. A repeat of an export under a different hint becomes one entry, because the hint is not part of the key. A member that is not a short import object is counted in other_members instead of being dropped.
  • rejects_what_is_not_an_archive: a file that is not an archive returns an error, and an empty archive has no imports.

This is a test-only change; no library code changes.

Testing on Linux:

  • cargo test -p victory-pe implib: 2 passed.
  • cargo clippy -p victory-pe --all-targets -- -D warnings: clean.
  • cargo fmt --check: clean.
  • cargo xtask policy: ok.

The other four image::tests failures under cargo test -p victory-pe on Linux already fail on main, because those tests parse the host test binary as a PE. #257 deals with them, and this PR does not touch them.

**@⁠SkippySteve** on GitHub · 2026-11-24 01:55 UTC · [original](https://github.com/Marvisak/VIctory/pull/268) `SkippySteve/victory-pr-own-next9` → `main` · +114 −0 · 1 files · 1 commits · closed without merging `crates/victory-pe/src/implib.rs` (the reader behind `victory lib-exports`) had no tests. This adds two. Each builds an in-memory `!<arch>` archive of short-format import objects, so the tests need no SDK `.lib` and no game data and run on every host. - **reads_short_imports_sorted_and_deduplicated**: covers each name type: by name, no-prefix (`_Prefixed` → `Prefixed`), undecorated (`_Stdcall@8` → `Stdcall`) and by ordinal. Each export keeps its code/data/const kind. The output is sorted. A repeat of an export under a different hint becomes one entry, because the hint is not part of the key. A member that is not a short import object is counted in `other_members` instead of being dropped. - **rejects_what_is_not_an_archive**: a file that is not an archive returns an error, and an empty archive has no imports. This is a test-only change; no library code changes. Testing on Linux: - `cargo test -p victory-pe implib`: 2 passed. - `cargo clippy -p victory-pe --all-targets -- -D warnings`: clean. - `cargo fmt --check`: clean. - `cargo xtask policy`: ok. The other four `image::tests` failures under `cargo test -p victory-pe` on Linux already fail on `main`, because those tests parse the host test binary as a PE. #257 deals with them, and this PR does not touch them.
implib.rs, the reader behind `victory lib-exports`, had no tests. Two are
added, built from an in-memory `!<arch>` archive of short-format import
objects (no SDK .lib, no game data), so they run on every host:

- every name type maps to the export the linker would bind (by name,
  no-prefix, undecorated, by ordinal), with its code/data/const kind;
- the result is sorted, and a repeat of an export under another hint is
  one entry (the hint is not part of the key);
- a member that is not a short import object is counted in
  other_members rather than dropped;
- a file that is not an archive is an error, an empty archive has no
  imports.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:57:16 +00:00
github-bot closed this pull request 2026-11-26 03:57:16 +00:00
Author
Owner

@⁠SkippySteve on GitHub · 2026-11-24 02:27 UTC · original

superseded by #287 (combined PE/loader hermetic synthetic tests)

**@⁠SkippySteve** on GitHub · 2026-11-24 02:27 UTC · [original](https://github.com/Marvisak/VIctory/pull/268#issuecomment-7120168154) superseded by #287 (combined PE/loader hermetic synthetic tests)

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No reviewers
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/Marvisak--VIctory!268
No description provided.