Skip to content

Build: gate Windows-only paths so the workspace builds and tests on Linux - #235

Closed
SkippySteve wants to merge 23 commits into
Marvisak:mainfrom
SkippySteve:linux-workspace-gates
Closed

SkippySteve wants to merge 23 commits into
Marvisak:mainfrom
SkippySteve:linux-workspace-gates

Conversation

@SkippySteve

@SkippySteve SkippySteve commented Nov 24, 2026 •

Copy link
Copy Markdown

Makes the workspace check, build and test on x86_64-unknown-linux-gnu. Closes #90.

Credit and context

This is the approach from #39 by @LaunchDoesntCode, rebased as a minimal change onto main (merged up to 58fed37). #39 was marked superseded by #112, which is the larger effort (Linux workspace, contributor setup, CI and a bulk cargo fmt). It currently conflicts with main. This PR doesn't replace #112. It only adds the cfg gates, so main builds and tests on Linux now and #112 can rebase onto it or drop the overlapping parts.

Changes

  • cfg(windows) gates on the remaining Windows-only paths:

    • view_format (D3D12 host copy) in victory-gpu
    • the xgameui host dialog
    • the xmem allocator hookup in D3D12XCreateDevice
    • XLaunchNewGame's relaunch
  • apps/victory/src/translate.rs: on non-Windows hosts, the validator and pipeline checks use an off-host stub that reports them as unavailable.

  • Tests that parse their own test binary as PE, or that depend on Windows path rules, run on Windows only.

  • No cfg-induced warnings on Linux. Once the host paths are gated, a Linux build warned about imports, helpers and console-side state that only those paths use:

    • victory-gpu: off Windows only, dead_code, unused_variables and unused_mut are allowed crate-wide, because the host halves of the objects are gated out there. The OnceLock import and the fence/root test modules (every test in them calls host D3D12) are gated.
    • victory-hle: gates the put import in display, the w test helper in kernel, and XLaunchNewGame's park loop (unreachable after exit off Windows). It also allows the Linux-only unused mut in modules::all and the unused host::function.
    • victory: gates the anyhow::Context import that only run uses.
  • Windows behaviour doesn't change. Every change is a cfg gate or a non-Windows stub. victory run on Linux still bails with "running titles requires Windows".

  • .github/workflows/ci.yml: a linux job on ubuntu-latest next to the Windows one. It runs cargo check --workspace --all-targets --all-features --locked and cargo test --workspace --locked, so a Windows-only path that leaks into shared code fails on the PR that adds it. It needs no titles or game files. It doesn't run clippy with -D warnings yet: two unused test imports in victory-shader/src/emit/mod.rs warn on Linux, and Shaders: DXBC/DXIL parser and sampler/SP3 robustness fixes #326 already removes them.

Test plan

Arch Linux, x86_64-unknown-linux-gnu:

Gate the remaining Windows-only paths so the workspace checks, builds and
tests on x86_64-unknown-linux-gnu: view_format (D3D12 host copy), the
xgameui host dialog, the xmem allocator hookup in D3D12XCreateDevice,
XLaunchNewGame's relaunch, and translate's validator/pipeline checks
(stubbed as unavailable). Tests that parse their own test binary as PE or
rely on Windows path rules run on Windows only.

victory run still bails with 'running titles requires Windows'.
@SkippySteve

Copy link
Copy Markdown
Author

Windows target check at head fb59109, cross-compiled from Arch Linux with cargo-xwin (MSVC CRT/SDK via xwin):

Command Result
cargo xwin build -p victory --release --target x86_64-pc-windows-msvc ✅ Finished, 0 warnings, produces a PE32+ x86-64 victory.exe
cargo xwin build --workspace --target x86_64-pc-windows-msvc ✅ Finished, 0 warnings, 0 errors
cargo xwin test --workspace --target x86_64-pc-windows-msvc --no-run ✅ All 13 test binaries compile, including the Windows-only tests this PR gates (victory-loader load_probe / no_dll_planting, victory-pe, victory-gpu, victory-hle)

So the Windows side of every cfg(windows) gate still compiles cleanly. I compiled the tests but didn't run them, because this machine has no Wine. A native Windows cargo test --workspace (or CI) would still be needed to confirm runtime behaviour, though the PR only adds cfg gates and doesn't change any Windows code paths.

@SkippySteve

Copy link
Copy Markdown
Author

Windows test binaries under Wine (UMU-Proton 11.0-2e)

I ran the x86_64-pc-windows-msvc workspace test binaries under Proton's Wine (wine-11.0). I ran the same binaries from main (d2a4bae) to compare. This is Wine, not native Windows, so it doesn't replace a native or CI run.

Setup: cargo xwin test --no-run --target x86_64-pc-windows-msvc --workspace on fb59109. Each .exe ran under files/bin/wine from its crate directory, in a fresh prefix. The bare Wine prefix has no D3D12 runtime, so I copied in the DLLs the Proton launcher normally installs: DXVK dxgi/d3d11/d3d10core, vkd3d-proton d3d12/d3d12core, and Wine's libvkd3d*. I ran with WINEDLLOVERRIDES=dxgi,d3d11,d3d10core,d3d12,d3d12core=n,b. GPU: RTX 2060 SUPER. No titles or game assets were used.

Result: 257 passed, 7 failed, 4 ignored, the same as main. The same 7 tests fail on both, so this PR adds no regressions under Wine.

binary PR #235 main
victory-core 8 ok 8 ok
victory-formats 20 ok, 3 ignored same
victory-game 2 ok same
victory-pe 7 ok same
victory-pipeline 3 ok same
victory-loader (lib) 18 ok same
victory-loader load_probe 1 ok, 1 fail same
victory-shader 68 ok, 1 fail same
victory-gpu 40 ok, 3 fail, 1 ignored same
victory-hle (lib) 85 ok, 1 fail same
victory-hle no_dll_planting 1 ok same
victory (app) 1 ok same
xtask 3 ok, 1 fail same

Failures. They come from Wine or the test harness, and none of them is in code this PR touches:

I'm ticking the Windows-tests item with the note "under Wine". A native Windows or CI run is still worth doing before merge.

@CesarLopesO

Copy link
Copy Markdown

Independent Linux validation — Debian 13

I tested this PR on a separate Debian 13 (Trixie) machine.

Environment

  • OS: Debian GNU/Linux 13 (Trixie)
  • rustc: 1.98.1 (48a229cea 2026-09-01)
  • cargo: 1.98.1 (797e8a9bc 2026-08-05)
  • Tested commit: fb59109

Command

cargo test --workspace --locked

Result: 162 passed, 0 failed, 3 ignored.

The workspace compiled and all runnable tests completed successfully. The build emitted compiler warnings, including unused/dead-code warnings and an unreachable-expression warning in crates/victory-hle/src/modules/xgame.rs:94, but no compilation errors.

No game files or game data were used.

Thanks for the Linux portability work!

With the host paths gated, a Linux build warned about the imports,
helpers and console-side state only those paths use. Gate or allow them
off Windows so `cargo clippy --workspace --all-targets` on Linux reports
only real issues:

- victory-gpu: off Windows, allow dead_code/unused_variables/unused_mut
  crate-wide (the host halves of the objects are gated out); gate the
  OnceLock import and the host-only fence/root test modules.
- victory-hle: gate the `put` import in display, the `w` test helper,
  and XLaunchNewGame's park loop (unreachable after exit off Windows);
  allow the unused `mut` in modules::all and the unused host::function.
- victory: gate the anyhow::Context import used only by `run`.

Windows behaviour and Windows warnings are unchanged.
@LazyHatGuy

LazyHatGuy commented Nov 24, 2026 •

Copy link
Copy Markdown

I have verified #235 on Garuda Linux

Environment

  • Commit: 16704a564b88d7e2b6b5f0e34c7c375c2b25b0c5
  • OS: Garuda Linux x86_64
  • Kernel: Linux 7.3.5-zen1-1-zen
rustc --version
rustc 1.100.0 (0ef1bc386 2026-11-09) (Arch Linux rust 1:1.100.0-1)
rustc --version
rustc 1.100.0 (0ef1bc386 2026-11-09) (Arch Linux rust 1:1.100.0-1)

Results

  • cargo fmt --all -- --check -> Reports format issues
  • cargo-summary test --workspace --locked -> TEST OK total=165 passed=162 failed=0 ignored=3 in 5.6s
  • cargo xtask policy -> asset policy: 151 files ok
  • cargo xtask policy --staged -> asset policy: 0 files ok

@pedrofort

Copy link
Copy Markdown

Independent Apple Silicon validation

Tested on Apple M5, macOS 27.2.1, native ARM64, Rust 1.98.1.

Commit tested: 16704a5.

Check | Result -- | -- Main branch workspace check | FAIL PR workspace check | PASS Workspace build | PASS Workspace tests | 162 passed, 0 failed, 3 ignored Native CLI execution | PASS Empty-directory shader-info | PASS Empty-directory translate | PASS Asset policy | 151 files OK

The resulting executable is a native Mach-O 64-bit ARM64 binary.

This confirms that the portability changes also enable the offline tools and runnable workspace tests on Apple Silicon, without Rosetta, Wine or virtualization.

No game files were used. Title execution and GPU rendering were not tested.

Thanks for the portability work!

SkippySteve added 7 commits November 24, 2026 05:43
Formatting the crates touched unrelated sources; restore them.
The synthetic PE gains a delay-import descriptor (its own IAT, checked
against SizeOfImage like the ordinary one), forwarders by name and by
ordinal, the relocation/exception/load-config directory flags with
RELOCS_STRIPPED, every subsystem name, and the CodeView symbol key.
The storage test mounts a drive and is gated to Windows. This one checks,
on any host, that the path calls fail untouched without a drive, that used
space counts files at any depth but not links (a loop ends, an outside
target is not charged), the exact-rest prompt grant, and a quota shrunk
under saved data, set to zero, or a storage path naming a file.
The display test takes a host power request and is gated to Windows. This
one checks, on any host, that each display pair resolves to its object and
crossed pairs do not, that HDR stays SDR for any preference without
writing the info, that URIs and screenshots fail as unsupported, that the
shell table ends at the launch slot off Windows, and that the diagnostic
capture slots are unimplemented rather than crashes.
Off Windows, `run` refuses a title for every console and unimplemented
mode before reading it, and `translate` refuses validation and pipelines
before walking while translation alone still walks unreadable roots. The
host stand-ins (validator, device, stub vertex shader, every pipeline kind)
each report themselves unavailable.
Off Windows the host source reports every pad slot empty and no key down,
and rumble is a no-op, so a hub over it connects only the keyboard and its
idle stand-in pad: the four pad slots answer disconnected, the stand-in
reads at rest and the keyboard reads no keys.
The device-type key was gated to Windows whole, though only its fallthrough
to the host's advapi32 needs Windows. Off Windows there is no host registry
behind our key: other keys are missing and handles we never gave out are
refused. The key's tests now run on any host, with new edges for size-only,
type-only and data-without-size probes, a null value name and a null subkey.
SkippySteve and others added 5 commits November 24, 2026 06:17
Co-authored-by: Cursor <cursoragent@cursor.com>
The host-only paths stay gated; these cover argument refusals for device
creation, tiled page-pool registration, committed and address-backed
resources, and null pipeline descriptions on any host.

Co-authored-by: Cursor <cursoragent@cursor.com>
@0xKaji

0xKaji commented Nov 24, 2026

Copy link
Copy Markdown

Found a deadlock + 3 test failures in victory-gpu::queue::host_free_tests when running cargo test --workspace on Linux (CachyOS x86_64, rustc 1.98.1, cargo test --workspace --no-fail-fast, no game data; PR #235 head=5d40ad817c).

Failure output

test queue::host_free_tests::fence_waits_complete_without_blocking_the_queue ... FAILED
test queue::host_free_tests::page_mapping_batches_run_through_the_runtime_mapper ... FAILED
test queue::host_free_tests::present_succeeds_without_copying_to_a_window ... FAILED
test queue::host_free_tests::timestamp_frequency_refuses_null_and_reports_the_rate has been running for over 60 seconds

Note: because device::tests::newer_device_levels_are_the_same_device sorts before queue::host_free_tests::* and mutates process-global state, parallel runs (cargo test) can trigger this depending on thread scheduling (which may explain why other Linux runs passed), whereas sequential execution (cargo test -p victory-gpu -- --test-threads=1) runs device::tests::* before queue::host_free_tests::*.

Root cause

  1. device::tests::newer_device_levels_are_the_same_device (crates/victory-gpu/src/device.rs:461) calls create_as(&LEVEL_IIDS[8]), which flips the process-global atomic device::NEWER (device.rs:153-155) to true.
  2. From that point on, queue::create (crates/victory-gpu/src/queue.rs:57-61) constructs queues with &NEWER_FUNCTIONS, shifting every method at slot >= 14 (0x70+) by +2 slots (+0x10 bytes):
    • signal: 0x70 -> 0x80
    • wait: 0x78 -> 0x88
    • timestamp_frequency: 0x80 -> 0x90
    • copy_page_mappings: 0xe8 -> 0xf8
    • present: 0xf0 -> 0x100
    • signal2_x: 0x100 -> 0x110
  3. queue::tests::queue_signals_complete_at_once already accounts for this with signal_slot(q) (queue.rs:472-480: "Another test may switch layouts while this one runs, so the queue's own table decides"), but queue::host_free_tests hardcodes the pre-newer vtable byte offsets:
    • In timestamp_frequency_refuses_null_and_reports_the_rate (queue.rs:576), slot::<Freq>(q, 0x80) dispatches to queue::signal(q, fence, value) instead of timestamp_frequency. freq(q, ptr::null_mut()) accidentally returns E_INVALIDARG (fence.is_null()), and then freq(q, &mut out) passes &mut out (a stack u64) as fence: This into crate::fence::signal, which dereferences &Fence on stack memory and locks fence.waiters (UB / infinite hang).
    • In the other three host_free_tests, 0x78 / 0xf0 / 0xe8 hit missing table slots (E_NOTIMPL) and 0x100 dispatches to present instead of signal2_x.

Suggested fix

Generalize queue::tests::signal_slot into a shared helper (e.g. slot_for(q: This, old_offset: usize) -> usize) that inspects q's own vtable pointer (table == NEWER_FUNCTIONS.0.as_ptr()) and shifts old_offset >= 0x70 by +0x10 bytes, and use it in queue::host_free_tests (0x80, 0x78, 0x100, 0xf0, 0xe8) — or invoke the queue's Rust handlers directly in host_free_tests.

@elgreams

Copy link
Copy Markdown

Tested 5d40ad817 on Linux Mint 22.1, rustc 1.98.1: the workspace builds, and every crate passes except victory-gpu. There, 3 of the new queue::host_free_tests fail and timestamp_frequency_refuses_null_and_reports_the_rate hangs, but only when they run after device::tests::newer_device_levels_are_the_same_device. Each one passes alone.

That test creates the device as ID3D12Device11, which sets the global NEWER flag (device.rs:154). Queues created after it use the newer layout, so the fixed offsets in host_free_tests (0x78, 0x80, 0x100…) land on different methods. Going through newer_slot / crate::device::newer(), or not sharing the flag between tests, should fix it. Repro and the other Linux PRs' results: #90 (comment)

@ramenbellic

Copy link
Copy Markdown

Tested 5d40ad8 on Bazzite (kernel 7.3.4, Ryzen 5 5600X, rustc 1.98.1), no game data.

  • cargo check --workspace --all-targets --all-features --locked: passes, 0 warnings.
  • cargo test --workspace --locked --no-fail-fast: hangs in 3 of 3 runs. Everything except victory-gpu passes (226 passed, 0 failed, 5 ignored).
  • cargo test -p victory-gpu: hangs in 6 of 6 runs here (5 parallel, 1 with --test-threads=1), so on this machine it is not scheduling-dependent. 41 pass, the same three queue::host_free_tests fail as reported above, and timestamp_frequency_refuses_null_and_reports_the_rate never returns.
  • With --skip newer_device_levels_are_the_same_device: 44 passed, 0 failed, parallel and single-threaded. That supports @elgreams' reading that the global NEWER flag set by that test is the cause.

The new linux CI job runs cargo test --workspace --locked, so it would hang on this head as it stands.

Not tested: Windows, Wine, running a title. AI use: Claude Code (Claude Fable 5.2) ran the commands and drafted this; I checked the results.

@elgreams

Copy link
Copy Markdown

@SkippySteve I opened SkippySteve/VIctory#2 against this branch with a fix for the order-dependent hang: the host_free_tests now find each method in the queue's own table, like tests::signal_slot does. On Linux, victory-gpu passes 45/45 in 15 parallel runs.

@Marvisak

Copy link
Copy Markdown
Owner

Automated triage for the maintainers. Closing because another open pull request covers the same change.

See #523. Linux build gating plus 2,000 lines of Linux-only test modules and a Linux CI job; #523 (clean, 100 lines) gates the same paths without them.

If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.

@Marvisak Marvisak closed this Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Linux: main does not build (E0425 in victory-gpu); with #39 the workspace builds and 156 tests pass

9 participants