test(hle): align the ucrt serve test with #104, and add a macos verify gate #370

Merged
wz11wz merged 2 commits from upstream-pr/370 into main 2026-11-27 15:59:14 +00:00
wz11wz commented 2026-11-27 14:26:25 +00:00 (Migrated from github.com)

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by wz11wz on 2026-11-27T14:26:25Z.


What this does

  1. Aligns a test with #104. dlls_that_are_not_the_c_runtime_are_left_alone still asserts the pre-#104 behaviour: it expects lookup("vcruntime140.dll", "memcpy") to answer None. Since #104 the ucrt serves vcruntime140.dll's memory and string functions while the title has not mapped its own copy (its memset and memcpy came back as no-op stubs in a failed load), so the test fails on every clean checkout.

    The test is renamed to say what it now checks - only_the_ucrt_and_an_unloaded_vcruntime_are_served - keeps the msvcp140.dll assertions, and documents why a bare test process sees the served branch (the loader registry is empty, so serves answers yes; a title that mapped its own copy would make find answer and the ucrt step aside).

  2. Adds a one-command verification gate. tools/macos/verify.sh wraps the checks CONTRIBUTING.md already asks for - both documented test suites plus the CI clippy run for the Windows target - and prints one PASS/FAIL line per check with the counts:

== native VIctory verification gate (full) ==
suite-hle      ... PASS (384 passed, 0 failed)
suite-shader   ... PASS (520 passed, 0 failed)
clippy-win     ... PASS (0 passed, 0 failed)
== gate PASSED ==

It exits non-zero on any failure, so it can gate a pull request from a hook or CI. verify.sh quick runs only the two test suites.

How I found the stale test

While writing the gate, its first run on a clean checkout failed with exactly one failure - the ucrt test above - which is how I noticed serves and its test had drifted apart in #104.

Testing

The new gate, 3/3 PASS on this branch: suite-hle 384 passed, suite-shader 520 passed, clippy clean for x86_64-pc-windows-gnullvm.

Happy to split this into two PRs if you prefer the gate separate.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:issue:5528257028 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/370). Originally posted by [wz11wz](https://github.com/wz11wz) on 2026-11-27T14:26:25Z. --- ## What this does 1. **Aligns a test with #104.** `dlls_that_are_not_the_c_runtime_are_left_alone` still asserts the pre-#104 behaviour: it expects `lookup("vcruntime140.dll", "memcpy")` to answer `None`. Since #104 the ucrt serves `vcruntime140.dll`'s memory and string functions **while the title has not mapped its own copy** (its `memset` and `memcpy` came back as no-op stubs in a failed load), so the test fails on every clean checkout. The test is renamed to say what it now checks - `only_the_ucrt_and_an_unloaded_vcruntime_are_served` - keeps the `msvcp140.dll` assertions, and documents why a bare test process sees the served branch (the loader registry is empty, so `serves` answers yes; a title that mapped its own copy would make `find` answer and the ucrt step aside). 2. **Adds a one-command verification gate.** `tools/macos/verify.sh` wraps the checks CONTRIBUTING.md already asks for - both documented test suites plus the CI clippy run for the Windows target - and prints one PASS/FAIL line per check with the counts: ``` == native VIctory verification gate (full) == suite-hle ... PASS (384 passed, 0 failed) suite-shader ... PASS (520 passed, 0 failed) clippy-win ... PASS (0 passed, 0 failed) == gate PASSED == ``` It exits non-zero on any failure, so it can gate a pull request from a hook or CI. `verify.sh quick` runs only the two test suites. ## How I found the stale test While writing the gate, its first run on a clean checkout failed with exactly one failure - the ucrt test above - which is how I noticed `serves` and its test had drifted apart in #104. ## Testing The new gate, 3/3 PASS on this branch: suite-hle 384 passed, suite-shader 520 passed, clippy clean for `x86_64-pc-windows-gnullvm`. Happy to split this into two PRs if you prefer the gate separate.
Olima34 commented 2026-11-27 14:42:08 +00:00 (Migrated from github.com)

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by Olima34 on 2026-11-27T14:42:08Z.


Check report: 534370b6 merged onto main 728845d1 (M5 Pro 48 GB).

  • The test fix is right. On main, cargo test --target x86_64-apple-darwin -p victory-hle fails host_posix::ucrt::tests::dlls_that_are_not_the_c_runtime_are_left_alone at ucrt.rs:334 (320 passed, 1 failed). With this PR it passes (321 passed). On arm64 both pass (141), and CI on Windows never ran the failing case.
  • cargo test -p victory-hle -p victory -p victory-gpu -p xtask passes, Windows clippy is clean, cargo xtask policy passes, and sh -n tools/macos/verify.sh is ok.

One thing before merging: verify.sh doesn't run the checks AGENTS.md and CI ask for. It runs victory-hle, victory-loader, victory and victory-shader, but not victory-gpu (natively on arm64, where it runs on a Mac) nor cargo xtask policy. A gate that passes while those fail would mislead. @wz11wz, could you add them (cargo test -p victory-gpu without --target, and cargo xtask policy), or name the script for what it does run? The ucrt test fix alone could go in now if you split it out.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7221118696 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/370#issuecomment-7221118696). Originally posted by [Olima34](https://github.com/Olima34) on 2026-11-27T14:42:08Z. --- Check report: `534370b6` merged onto main `728845d1` (M5 Pro 48 GB). - **The test fix is right.** On main, `cargo test --target x86_64-apple-darwin -p victory-hle` fails `host_posix::ucrt::tests::dlls_that_are_not_the_c_runtime_are_left_alone` at `ucrt.rs:334` (320 passed, 1 failed). With this PR it passes (321 passed). On arm64 both pass (141), and CI on Windows never ran the failing case. - `cargo test -p victory-hle -p victory -p victory-gpu -p xtask` passes, Windows clippy is clean, `cargo xtask policy` passes, and `sh -n tools/macos/verify.sh` is ok. One thing before merging: `verify.sh` doesn't run the checks AGENTS.md and CI ask for. It runs `victory-hle`, `victory-loader`, `victory` and `victory-shader`, but not `victory-gpu` (natively on arm64, where it runs on a Mac) nor `cargo xtask policy`. A gate that passes while those fail would mislead. @wz11wz, could you add them (`cargo test -p victory-gpu` without `--target`, and `cargo xtask policy`), or name the script for what it does run? The ucrt test fix alone could go in now if you split it out.
wz11wz commented 2026-11-27 14:56:45 +00:00 (Migrated from github.com)

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by wz11wz on 2026-11-27T14:56:45Z.


Added both gates (2nd commit): cargo test -p victory-gpu natively, and cargo xtask policy.

That gate immediately found something on this machine worth knowing: victory-gpu's native tests need Apple's Metal Shader Converter, and a clean M1 Max without it fails 3 texture tests on main too (confirmed on main, not this branch): no mesh pipeline at texture_tests.rs:1101/1154/1207, one of them the libmetalirconverter.dylib dlopen directly. native-setup.sh does check for it (warns), and VICTORY_MSC_DYLIB is honoured - but GPTK's bundled copy (D3DMetal 4.0b3's libmetalirconverter.dylib) is not a compatible substitute: pointing VICTORY_MSC_DYLIB at it turns the 3 failures into 129. The standalone MSC distribution is the real prerequisite.

So on this machine the full gate stays red until MSC is installed; every other gate is green (suite-hle 384, suite-shader 520, policy, clippy). The ucrt test fix itself needs none of that, so splitting it out as you suggested works if you want it now - say the word and I'll spin it off.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7221429356 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/370#issuecomment-7221429356). Originally posted by [wz11wz](https://github.com/wz11wz) on 2026-11-27T14:56:45Z. --- Added both gates (2nd commit): `cargo test -p victory-gpu` natively, and `cargo xtask policy`. That gate immediately found something on this machine worth knowing: victory-gpu's native tests need Apple's Metal Shader Converter, and a clean M1 Max without it fails 3 texture tests on main too (confirmed on `main`, not this branch): `no mesh pipeline` at texture_tests.rs:1101/1154/1207, one of them the `libmetalirconverter.dylib` dlopen directly. native-setup.sh does check for it (warns), and `VICTORY_MSC_DYLIB` is honoured - but GPTK's bundled copy (D3DMetal 4.0b3's `libmetalirconverter.dylib`) is **not** a compatible substitute: pointing `VICTORY_MSC_DYLIB` at it turns the 3 failures into 129. The standalone MSC distribution is the real prerequisite. So on this machine the full gate stays red until MSC is installed; every other gate is green (suite-hle 384, suite-shader 520, policy, clippy). The ucrt test fix itself needs none of that, so splitting it out as you suggested works if you want it now - say the word and I'll spin it off.
LakshanSivakumar commented 2026-11-27 16:01:12 +00:00 (Migrated from github.com)

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by LakshanSivakumar on 2026-11-27T16:01:12Z.


Merged in 002c3291. I fixed the usage comment at the top of verify.sh on top, since quick and full now run more than it said. Ran the tests, Windows clippy and the policy check on the merged tree. Thanks.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7222758322 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/370#issuecomment-7222758322). Originally posted by [LakshanSivakumar](https://github.com/LakshanSivakumar) on 2026-11-27T16:01:12Z. --- Merged in 002c3291. I fixed the usage comment at the top of verify.sh on top, since quick and full now run more than it said. Ran the tests, Windows clippy and the policy check on the merged tree. Thanks.
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
LakshanSivakumar/Native-Victory-macOS!370
No description provided.