CI: build and test the host-independent crates on Linux #1241

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

@⁠MIchiel1234 on GitHub · 2026-11-24 16:45 UTC · original
MIchiel1234:ci/linux-host-independent-crates → main · +167 −21 · 8 files · 1 commits · open

Build and test the host-independent crates on Linux

Nothing checked that the crates carrying no Windows dependency still build off Windows, and they did not: on a Linux host seven tests failed and victory-gpu did not compile at all. CI runs only windows-latest, and rust-toolchain.toml lists only the MSVC target, so there was nowhere for this to show up.

After this change the six crates in the new job are clean: 50 tests pass, 0 fail on ubuntu-latest.

current_exe() is not a PE on other hosts

victory-pe and victory-loader read current_exe() when they needed a real PE32+ image:

/// The test binary itself is a real MSVC-linked PE32+ image.
fn own_image() -> Vec<u8> {
    std::fs::read(std::env::current_exe().unwrap()).unwrap()
}

That holds only when the tests are built for Windows. On any other host the test binary is an ELF, which ImageInfo::parse rightly rejects, so four tests in victory-pe and three in victory-loader failed for reasons unrelated to the code under test. The parser was never at fault.

They now use a PE32+ image assembled in a new victory-pe::fixtures module, behind a fixtures feature that victory-loader enables as a dev-dependency. It has two sections, an entry point, one KERNEL32 import with a real import name table and IAT, a TLS directory with no callbacks, and a one-entry exception table.

Building the image also pins down what the tests assert — the import count, the TLS directory RVA, an empty callback array — rather than depending on whatever the current linker emits. rejects_iat_outside_image still drives the real overflow path it was written for.

The one test that needs a genuinely loadable image, windows_assigns_static_tls_to_a_prepared_dll, stays cfg(windows) and keeps using current_exe(), now with a comment saying why.

A cfg(windows) function called from ungated code

resource::view_format in victory-gpu calls host_resource, which is #[cfg(windows)], from an ungated function — one E0425 that stopped the crate compiling anywhere else. Its only caller, host_desc, is already gated, so gating view_format too is a no-op on Windows and lets the crate build elsewhere.

Scope of the CI job

The job covers the six crates that are clean today. Deliberately not the whole workspace yet, and the job's comment records why so the list can be widened:

crate on Linux
victory-core, victory-pe, victory-formats, victory-pipeline, victory-game, victory-loader in the job: 50 tests pass, clippy -D warnings clean
victory-gpu, victory-shader compile and pass their tests (24 and 96) after the cfg fix, but still warn in this configuration
victory-hle needs its module tree gated (xmem, lifecycle, files referenced from ungated code)

Checks

  • cargo clippy -D warnings and cargo test on the six crates: clean, 50 passed
  • cargo test -p xtask (asset policy, incl. repository_passes_policy): 4 passed
  • .githooks/pre-commit (cargo xtask policy --staged): 8 files ok
  • victory-pe for x86_64-pc-windows-msvc, clippy -D warnings, default and --all-features: clean, so the fixture compiles on Windows too

No game files, no assets and no generated data are added. The full workspace could not be typechecked for the MSVC target from Linux because blake3's build script wants cl.exe; the victory-gpu change is inert on Windows by construction, as described above.

**@⁠MIchiel1234** on GitHub · 2026-11-24 16:45 UTC · [original](https://github.com/Marvisak/VIctory/pull/1241) `MIchiel1234:ci/linux-host-independent-crates` → `main` · +167 −21 · 8 files · 1 commits · open # Build and test the host-independent crates on Linux Nothing checked that the crates carrying no Windows dependency still build off Windows, and they did not: on a Linux host **seven tests failed and `victory-gpu` did not compile at all**. CI runs only `windows-latest`, and `rust-toolchain.toml` lists only the MSVC target, so there was nowhere for this to show up. After this change the six crates in the new job are clean: **50 tests pass, 0 fail** on `ubuntu-latest`. ## `current_exe()` is not a PE on other hosts `victory-pe` and `victory-loader` read `current_exe()` when they needed a real PE32+ image: ```rust /// The test binary itself is a real MSVC-linked PE32+ image. fn own_image() -> Vec<u8> { std::fs::read(std::env::current_exe().unwrap()).unwrap() } ``` That holds only when the tests are built for Windows. On any other host the test binary is an ELF, which `ImageInfo::parse` rightly rejects, so four tests in `victory-pe` and three in `victory-loader` failed for reasons unrelated to the code under test. The parser was never at fault. They now use a PE32+ image assembled in a new `victory-pe::fixtures` module, behind a `fixtures` feature that `victory-loader` enables as a dev-dependency. It has two sections, an entry point, one KERNEL32 import with a real import name table and IAT, a TLS directory with no callbacks, and a one-entry exception table. Building the image also pins down what the tests assert — the import count, the TLS directory RVA, an empty callback array — rather than depending on whatever the current linker emits. `rejects_iat_outside_image` still drives the real overflow path it was written for. The one test that needs a genuinely loadable image, `windows_assigns_static_tls_to_a_prepared_dll`, stays `cfg(windows)` and keeps using `current_exe()`, now with a comment saying why. ## A `cfg(windows)` function called from ungated code `resource::view_format` in `victory-gpu` calls `host_resource`, which is `#[cfg(windows)]`, from an ungated function — one `E0425` that stopped the crate compiling anywhere else. Its only caller, `host_desc`, is already gated, so gating `view_format` too is a **no-op on Windows** and lets the crate build elsewhere. ## Scope of the CI job The job covers the six crates that are clean today. Deliberately not the whole workspace yet, and the job's comment records why so the list can be widened: | crate | on Linux | |---|---| | `victory-core`, `victory-pe`, `victory-formats`, `victory-pipeline`, `victory-game`, `victory-loader` | in the job: 50 tests pass, clippy `-D warnings` clean | | `victory-gpu`, `victory-shader` | compile and pass their tests (24 and 96) after the `cfg` fix, but still warn in this configuration | | `victory-hle` | needs its module tree gated (`xmem`, `lifecycle`, `files` referenced from ungated code) | ## Checks - `cargo clippy -D warnings` and `cargo test` on the six crates: **clean, 50 passed** - `cargo test -p xtask` (asset policy, incl. `repository_passes_policy`): **4 passed** - `.githooks/pre-commit` (`cargo xtask policy --staged`): **8 files ok** - `victory-pe` for `x86_64-pc-windows-msvc`, clippy `-D warnings`, default **and** `--all-features`: **clean**, so the fixture compiles on Windows too No game files, no assets and no generated data are added. The full workspace could not be typechecked for the MSVC target from Linux because `blake3`'s build script wants `cl.exe`; the `victory-gpu` change is inert on Windows by construction, as described above.
Nothing checked that the crates carrying no Windows dependency still
build off Windows, and they did not. Seven tests failed on a Linux host
and victory-gpu did not compile at all.

victory-pe and victory-loader read current_exe() when they needed a real
PE32+ image. That holds only when the tests are built for Windows: on
any other host the test binary is an ELF, which the parser rightly
rejects, so four tests in victory-pe and three in victory-loader failed
for reasons that had nothing to do with the code under test. They now
use a PE32+ image assembled in victory-pe's new fixtures module, behind
a `fixtures` feature that victory-loader enables as a dev-dependency.
Building the image also pins down what the tests assert -- the import
count, the TLS directory RVA, an empty callback array -- instead of
depending on whatever the current linker emits. The one test that needs
a genuinely loadable image stays Windows-only, now with a comment
saying why.

resource::view_format in victory-gpu called host_resource, which is
`cfg(windows)`, from an ungated function. Its only caller, host_desc,
is already gated, so gating view_format too is a no-op on Windows and
lets the crate compile elsewhere.

The new CI job covers the six crates that are clean today: 50 tests on
ubuntu-latest. victory-gpu and victory-shader now compile and pass
their tests on Linux as well, but still warn in that configuration, and
victory-hle needs its module tree gated; the job's comment records that
so the list can be widened as they are fixed.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:24:42 +00:00
Author
Owner

@⁠Zipettte on GitHub · 2026-11-24 17:59 UTC · original

Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at f02c702: cargo test -p victory-gpu -p victory-loader -p victory-pe passes, 82 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed).

Tested with AI assistance (Claude).

**@⁠Zipettte** on GitHub · 2026-11-24 17:59 UTC · [original](https://github.com/Marvisak/VIctory/pull/1241#issuecomment-7139999595) Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at f02c702: `cargo test -p victory-gpu -p victory-loader -p victory-pe` passes, 82 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed). _Tested with AI assistance (Claude)._
Author
Owner

@⁠Headache3318 on GitHub · 2026-11-25 00:59 UTC · original

Independent Linux verification at PR head f02c70246c (not merged with main: unrelated histories, 93 add/add conflicts).

cargo check --workspace --all-targets: 10 errors, all in victory-hle. 4× E0433 missing windows_sys crate (imported in xgameui.rs but not in Cargo.toml); 6× E0433 non-gated references to cfg(windows) modules (xmem in d3d12x.rs, lifecycle in xgame.rs, files in storage.rs).

cargo test --workspace --locked: 0 tests run (build failed first). Same 9 compilation errors as check.

cargo clippy --workspace --all-targets -- -D warnings: 50 errors (23 in victory-gpu lib, 25 in victory-gpu lib test, 2 in victory-shader lib test) — unused imports/variables/unused_mut/dead_code. Build failed before reaching victory-hle.

Verdict: the workspace does not build or test on Linux as the title claims. victory-hle needs proper cross-platform guards and the missing windows_sys dependency. Clippy lints would fail even if compilation succeeded.

Arch Linux, kernel 7.3.5-arch1-1, 8 cores, rustc 1.98.1 (pinned), AI-assisted.

**@⁠Headache3318** on GitHub · 2026-11-25 00:59 UTC · [original](https://github.com/Marvisak/VIctory/pull/1241#issuecomment-7149099193) Independent Linux verification at PR head f02c70246c43a4bc548f07ed42949a02a5d6fd05 (not merged with main: unrelated histories, 93 add/add conflicts). **cargo check --workspace --all-targets:** 10 errors, all in victory-hle. 4× E0433 missing `windows_sys` crate (imported in xgameui.rs but not in Cargo.toml); 6× E0433 non-gated references to cfg(windows) modules (`xmem` in d3d12x.rs, `lifecycle` in xgame.rs, `files` in storage.rs). **cargo test --workspace --locked:** 0 tests run (build failed first). Same 9 compilation errors as check. **cargo clippy --workspace --all-targets -- -D warnings:** 50 errors (23 in victory-gpu lib, 25 in victory-gpu lib test, 2 in victory-shader lib test) — unused imports/variables/unused_mut/dead_code. Build failed before reaching victory-hle. Verdict: the workspace does not build or test on Linux as the title claims. victory-hle needs proper cross-platform guards and the missing windows_sys dependency. Clippy lints would fail even if compilation succeeded. Arch Linux, kernel 7.3.5-arch1-1, 8 cores, rustc 1.98.1 (pinned), AI-assisted.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 01:27 UTC · original

Automated triage for the maintainers.

Needs work. Needs the maintainer's decision. This PR changes the CI workflow.

What it does:

  • Adds a linux job to .github/workflows/ci.yml that runs clippy and tests for six crates (core, pe, formats, pipeline, game, loader). It uses the same actions as the existing job.
  • Gates resource::view_format in victory-gpu with #[cfg(windows)]. Its only caller, host_desc, is already gated, so Windows builds are unchanged.
  • Replaces the current_exe() images in the victory-pe and victory-loader tests with a PE32+ image built by hand in the new victory_pe::fixtures module. It is plain header construction, with no copied bytes.

Points for the maintainer:

  • Whether VIctory wants a Linux CI job at all. #112, #523 and #1017 also aim at Linux builds, and #1218 runs tests under Wine.
  • Coverage loss on Windows. keeps_iat_slots_when_import_size_excludes_the_terminator and parses_a_synthetic_executable no longer see a real MSVC-linked layout. The first one's own comment ("This linker layout counts the descriptors for real modules only") now describes the fixture rather than a linker. Consider keeping the current_exe() variants under cfg(windows) next to the fixture tests.

CI: no checks have run on this head.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 01:27 UTC · [original](https://github.com/Marvisak/VIctory/pull/1241#issuecomment-7149561421) <!-- victory-triage v1 head=f02c70246c43a4bc548f07ed42949a02a5d6fd05 verdict=needs-work at=2026-11-25T01:27:08Z --> Automated triage for the maintainers. **Needs work. Needs the maintainer's decision.** This PR changes the CI workflow. What it does: - Adds a `linux` job to `.github/workflows/ci.yml` that runs clippy and tests for six crates (core, pe, formats, pipeline, game, loader). It uses the same actions as the existing job. - Gates `resource::view_format` in `victory-gpu` with `#[cfg(windows)]`. Its only caller, `host_desc`, is already gated, so Windows builds are unchanged. - Replaces the `current_exe()` images in the `victory-pe` and `victory-loader` tests with a PE32+ image built by hand in the new `victory_pe::fixtures` module. It is plain header construction, with no copied bytes. Points for the maintainer: - Whether VIctory wants a Linux CI job at all. #112, #523 and #1017 also aim at Linux builds, and #1218 runs tests under Wine. - **Coverage loss on Windows.** `keeps_iat_slots_when_import_size_excludes_the_terminator` and `parses_a_synthetic_executable` no longer see a real MSVC-linked layout. The first one's own comment ("This linker layout counts the descriptors for real modules only") now describes the fixture rather than a linker. Consider keeping the `current_exe()` variants under `cfg(windows)` next to the fixture tests. CI: no checks have run on this head. --- _Generated by [Claude Code](https://claude.ai/code)_
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/1241/head:github-bot/gh-1241'
git switch 'github-bot/gh-1241'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1241'
git switch 'github-bot/gh-1241'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1241'
git switch 'github-bot/gh-1241'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1241'
git switch 'main'
git merge --squash 'github-bot/gh-1241'
git switch 'main'
git merge --ff-only 'github-bot/gh-1241'
git switch 'main'
git merge 'github-bot/gh-1241'
git push origin 'main'
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!1241
No description provided.