Build and test the host-independent crates on Linux (patch on a fork) #892

Open
opened 2026-11-26 04:14:07 +00:00 by github-bot · 3 comments
Owner

@⁠JulianChavezdev on GitHub · 2026-11-24 13:34 UTC · original

Hi! I'd like to contribute a small, test-and-CI-only change, but pull requests are limited to collaborators, so I'm posting it here.

Branch: https://github.com/JulianChavezdev/VIctory/tree/linux-ci-and-pe-tests (3 commits on top of ffe310e) Diff: https://github.com/Marvisak/VIctory/compare/main...JulianChavezdev:VIctory:linux-ci-and-pe-tests

What it does:

victory-pe: four image tests read the test binary itself, which is PE32+ only on Windows, so they fail on Linux. They now use a synthetic DLL; the two that need a real MSVC image stay Windows-only. Adds tests for implib, which had none.
victory-gpu compiles on Linux (view_format is now cfg(windows) like host_resource), and two Windows-only test imports in victory-shader no longer warn there.
CI: a linux job running clippy -D warnings and tests for core, pe, formats, shader, pipeline, game and xtask, plus victory-gpu's host-independent tests.
docs/architecture.md: BCPack is no longer "planned".
Nothing changes on Windows other than the new tests. On Linux (toolchain 1.98.1): clippy clean, 175 tests passed, 5 ignored (need game files), asset policy ok.

Could you either merge the branch / cherry-pick the commits, or add me as a collaborator so I can open the PR? Happy to adjust anything.

**@⁠JulianChavezdev** on GitHub · 2026-11-24 13:34 UTC · [original](https://github.com/Marvisak/VIctory/issues/892) Hi! I'd like to contribute a small, test-and-CI-only change, but pull requests are limited to collaborators, so I'm posting it here. Branch: https://github.com/JulianChavezdev/VIctory/tree/linux-ci-and-pe-tests (3 commits on top of ffe310e) Diff: https://github.com/Marvisak/VIctory/compare/main...JulianChavezdev:VIctory:linux-ci-and-pe-tests What it does: victory-pe: four image tests read the test binary itself, which is PE32+ only on Windows, so they fail on Linux. They now use a synthetic DLL; the two that need a real MSVC image stay Windows-only. Adds tests for implib, which had none. victory-gpu compiles on Linux (view_format is now cfg(windows) like host_resource), and two Windows-only test imports in victory-shader no longer warn there. CI: a linux job running clippy -D warnings and tests for core, pe, formats, shader, pipeline, game and xtask, plus victory-gpu's host-independent tests. docs/architecture.md: BCPack is no longer "planned". Nothing changes on Windows other than the new tests. On Linux (toolchain 1.98.1): clippy clean, 175 tests passed, 5 ignored (need game files), asset policy ok. Could you either merge the branch / cherry-pick the commits, or add me as a collaborator so I can open the PR? Happy to adjust anything.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:14:07 +00:00
Author
Owner

@⁠DaniiL35 on GitHub · 2026-11-24 14:05 UTC · original

Independent Verification Review: JulianChavezdev:linux-ci-and-pe-tests (e87b26b..f8c107f)

Audited Julian Chavez's branch on non-Windows host (macOS Darwin aarch64 / POSIX):


1. Root Cause Resolution for Issue #90 (victory-gpu E0425)

  • In crates/victory-gpu/src/resource.rs:282, pub(crate) fn view_format invoked host_resource(this)?. Because host_resource is defined exclusively under #[cfg(windows)] (line 780), compiling victory-gpu on any non-Windows target (Linux or macOS) failed with error[E0425]: cannot find function 'host_resource' in this scope.
  • Gating correctness: The only call site for view_format across the entire codebase is inside RtvRecord::host_desc in crates/victory-gpu/src/descriptor.rs:226, which is already gated with #[cfg(windows)] at line 219. Gating view_format with #[cfg(windows)] is therefore completely self-contained and resolves the build failure tracked in #90 without breaking any API surface.

2. Cross-Platform PE Fixture & Test Correctness (victory-pe)

  • Previously, crates/victory-pe/src/image.rs read std::env::current_exe(). On non-Windows hosts, the test runner binary is ELF (Linux) or Mach-O 64-bit (macOS), causing all four image tests to fail immediately outside Windows.
  • Synthetic Fixture: Replacing own_image() in generic tests with the procedural import_image() fixture generates a synthetic PE32+ DLL importing kernel32.dll!ExitProcess (hint 7). The two tests requiring authentic MSVC-linked layout stay gated behind #[cfg(windows)].
  • Archive Parser Tests: In crates/victory-pe/src/implib.rs, the new test suite (reads_code_data_const_and_ordinal_imports, duplicates_are_merged_and_other_members_counted, an_empty_archive_has_no_imports, rejects_garbage_without_panicking) verifies COFF archive handling with synthetic 60-byte headers.
  • Rule #1 Policy Compliance: All fixtures are constructed in-memory via byte slices (Vec<u8>); zero game assets, binaries, or large base64/hex blobs are included.

3. Non-Windows HLE & Shader Hygiene (victory-hle, victory-shader)

  • Warning Free: crates/victory-shader/src/emit/mod.rs gates Attr and Shader test imports with #[cfg(windows)], eliminating -D unused-imports compiler errors under non-Windows.
  • HLE Gating:
    • crates/victory-hle/src/modules/d3d12x.rs: Correctly wraps victory_gpu::on_failure (a Windows-only export) and allocator hooks under #[cfg(windows)].
    • crates/victory-hle/src/modules/xgame.rs: #[cfg(not(windows))] drop(command); prevents -D unused-variable warnings.
    • crates/victory-hle/src/modules/xgameui.rs: Host dialog cleanly falls back to ask -> None off Windows.
    • Windows path tests (C:\... drives) in kernel.rs and storage.rs are gated #[cfg(windows)], resolving POSIX path separator incompatibilities.

4. CI Workflow Design (.github/workflows/ci.yml)

  • The separation in the new linux job is structurally sound:
    • cargo clippy $PORTABLE --all-targets --locked -- -D warnings ensures all truly portable crates stay strictly warning-clean.
    • cargo test $PORTABLE -p victory-gpu -p victory-hle --locked executes all host-independent unit tests across the workspace without triggering false-positive dead_code warnings on host-only structures in victory-gpu.
  • macOS Applicability: While the README and CI job focus on Linux, this portable test invocation runs identically and passes on macOS.

Ready to merge or cherry-pick cleanly onto main.

AI-assisted review with Antigravity.

**@⁠DaniiL35** on GitHub · 2026-11-24 14:05 UTC · [original](https://github.com/Marvisak/VIctory/issues/892#issuecomment-7133827368) ### Independent Verification Review: JulianChavezdev:linux-ci-and-pe-tests (`e87b26b`..`f8c107f`) Audited Julian Chavez's branch on non-Windows host (macOS Darwin aarch64 / POSIX): --- ### 1. Root Cause Resolution for Issue #90 (`victory-gpu` E0425) - In `crates/victory-gpu/src/resource.rs:282`, `pub(crate) fn view_format` invoked `host_resource(this)?`. Because `host_resource` is defined exclusively under `#[cfg(windows)]` (line 780), compiling `victory-gpu` on any non-Windows target (Linux or macOS) failed with `error[E0425]: cannot find function 'host_resource' in this scope`. - **Gating correctness**: The only call site for `view_format` across the entire codebase is inside `RtvRecord::host_desc` in `crates/victory-gpu/src/descriptor.rs:226`, which is already gated with `#[cfg(windows)]` at line 219. Gating `view_format` with `#[cfg(windows)]` is therefore completely self-contained and resolves the build failure tracked in #90 without breaking any API surface. --- ### 2. Cross-Platform PE Fixture & Test Correctness (`victory-pe`) - Previously, `crates/victory-pe/src/image.rs` read `std::env::current_exe()`. On non-Windows hosts, the test runner binary is ELF (Linux) or Mach-O 64-bit (macOS), causing all four image tests to fail immediately outside Windows. - **Synthetic Fixture**: Replacing `own_image()` in generic tests with the procedural `import_image()` fixture generates a synthetic PE32+ DLL importing `kernel32.dll!ExitProcess` (hint 7). The two tests requiring authentic MSVC-linked layout stay gated behind `#[cfg(windows)]`. - **Archive Parser Tests**: In `crates/victory-pe/src/implib.rs`, the new test suite (`reads_code_data_const_and_ordinal_imports`, `duplicates_are_merged_and_other_members_counted`, `an_empty_archive_has_no_imports`, `rejects_garbage_without_panicking`) verifies COFF archive handling with synthetic 60-byte headers. - **Rule #1 Policy Compliance**: All fixtures are constructed in-memory via byte slices (`Vec<u8>`); zero game assets, binaries, or large base64/hex blobs are included. --- ### 3. Non-Windows HLE & Shader Hygiene (`victory-hle`, `victory-shader`) - **Warning Free**: `crates/victory-shader/src/emit/mod.rs` gates `Attr` and `Shader` test imports with `#[cfg(windows)]`, eliminating `-D unused-imports` compiler errors under non-Windows. - **HLE Gating**: - `crates/victory-hle/src/modules/d3d12x.rs`: Correctly wraps `victory_gpu::on_failure` (a Windows-only export) and allocator hooks under `#[cfg(windows)]`. - `crates/victory-hle/src/modules/xgame.rs`: `#[cfg(not(windows))] drop(command);` prevents `-D unused-variable` warnings. - `crates/victory-hle/src/modules/xgameui.rs`: Host dialog cleanly falls back to `ask -> None` off Windows. - Windows path tests (`C:\...` drives) in `kernel.rs` and `storage.rs` are gated `#[cfg(windows)]`, resolving POSIX path separator incompatibilities. --- ### 4. CI Workflow Design (`.github/workflows/ci.yml`) - The separation in the new `linux` job is structurally sound: - `cargo clippy $PORTABLE --all-targets --locked -- -D warnings` ensures all truly portable crates stay strictly warning-clean. - `cargo test $PORTABLE -p victory-gpu -p victory-hle --locked` executes all host-independent unit tests across the workspace without triggering false-positive `dead_code` warnings on host-only structures in `victory-gpu`. - **macOS Applicability**: While the README and CI job focus on Linux, this portable test invocation runs identically and passes on macOS. Ready to merge or cherry-pick cleanly onto `main`. AI-assisted review with Antigravity.
Author
Owner

@⁠JulianChavezdev on GitHub · 2026-11-24 14:10 UTC · original

Thanks for the independent review, @⁠DaniiL35!

I also see now that #112 and #235 already gate the same Windows-only paths and add a Linux CI job, so I don't want to compete with them. Whichever of them lands, I'm happy to rebase on top of it and keep only what they don't cover:

•	the implib tests (the module had none),
•	the victory-pe image tests running on a synthetic DLL instead of being Windows-only,
•	the README section on working on Linux, including clippy for the Windows target from Linux with clang-cl/llvm-lib,
•	the small architecture.md fix (BCPack is no longer "planned").

The branch now has 5 commits (223 tests pass on Linux, and clippy for the Windows target is clean); I've updated the description above

**@⁠JulianChavezdev** on GitHub · 2026-11-24 14:10 UTC · [original](https://github.com/Marvisak/VIctory/issues/892#issuecomment-7133947916) Thanks for the independent review, @⁠DaniiL35! I also see now that #112 and #235 already gate the same Windows-only paths and add a Linux CI job, so I don't want to compete with them. Whichever of them lands, I'm happy to rebase on top of it and keep only what they don't cover: • the implib tests (the module had none), • the victory-pe image tests running on a synthetic DLL instead of being Windows-only, • the README section on working on Linux, including clippy for the Windows target from Linux with clang-cl/llvm-lib, • the small architecture.md fix (BCPack is no longer "planned"). The branch now has 5 commits (223 tests pass on Linux, and clippy for the Windows target is clean); I've updated the description above
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 06:50 UTC · original

Automated triage for the maintainers.

Thanks. The parts of this branch are already covered by open pull requests: the view_format gate that fixes the Linux build (#90) is in #2008, a Linux CI job for the host-independent crates is #1241 (and #112), and implib tests are in #1814. The docs/architecture.md fix has landed: BCPack is listed as implemented on main. Pull requests are open to everyone now, so what remains (the victory-pe image tests on a synthetic DLL, the README section on working from Linux) can be opened as a pull request against current main. The maintainers decide whether Linux CI fits the project.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 06:50 UTC · [original](https://github.com/Marvisak/VIctory/issues/892#issuecomment-7155217953) <!-- victory-issue-triage v1 verdict=tracked seen=2026-11-24T14:10:12Z at=2026-11-25T06:50:43Z --> Automated triage for the maintainers. Thanks. The parts of this branch are already covered by open pull requests: the `view_format` gate that fixes the Linux build (#90) is in #2008, a Linux CI job for the host-independent crates is #1241 (and #112), and `implib` tests are in #1814. The `docs/architecture.md` fix has landed: BCPack is listed as implemented on `main`. Pull requests are open to everyone now, so what remains (the `victory-pe` image tests on a synthetic DLL, the README section on working from Linux) can be opened as a pull request against current `main`. The maintainers decide whether Linux CI fits the project. --- _Generated by [Claude Code](https://claude.ai/code)_
This discussion has been locked. Commenting is limited to contributors.
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#892
No description provided.