loader tests: probe the forced range far above where allocations go #283

Manually merged
github merged 3 commits from github-bot/gh-283 into main 2026-11-27 12:02:38 +00:00 AGit
Owner

@⁠maaalrey on GitHub · 2026-11-27 08:44 UTC · original
maaalrey:fix/loader-test-free-range → main · +17 −5 · 1 files · 3 commits · merged 2026-11-27 11:42 UTC

What this changes

Refs #281

native::image::tests::malformed_relocations_return_error_and_release_mapping fails about 1 run in 3 on main. Step 3 fails with failed maps must release their range: mapping 0x4000 bytes of image at 0x1…: mach_vm_allocate failed: kern_return 3 (KERN_NO_SPACE).

The test picks its forced address by allocating anywhere and releasing it. That range is the next one the system hands out, so another test's allocation, made between the release and step 3, takes it. The test now probes fixed ranges from 0x5000_0000_0000 up, which allocations made anywhere don't reach. Step 3 can then fail only if one of the failed maps kept the range, which is what it checks. Test-only change.

How it was tested

  • cargo test -p victory-loader --lib (arm64): 5 failures in 12 runs before, 0 in 30 after
  • cargo test --target x86_64-apple-darwin -p victory-hle -p victory-loader -p victory: 380 passed, 0 failed
  • cargo clippy --workspace --all-targets --locked --target x86_64-pc-windows-gnullvm -- -D warnings: clean
  • cargo xtask policy: ok
  • Ran the game: not needed (test only)

Checklist

  • No game files, game code, disassembly listings or SDK files are included
  • Guesses about undocumented console behaviour are marked in the code and in docs/native-host.md (none)
  • New diagnostics are behind a VICTORY_* variable and documented (none)
**@⁠maaalrey** on GitHub · 2026-11-27 08:44 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/283) `maaalrey:fix/loader-test-free-range` → `main` · +17 −5 · 1 files · 3 commits · merged 2026-11-27 11:42 UTC ## What this changes Refs #281 `native::image::tests::malformed_relocations_return_error_and_release_mapping` fails about 1 run in 3 on `main`. Step 3 fails with `failed maps must release their range: mapping 0x4000 bytes of image at 0x1…: mach_vm_allocate failed: kern_return 3` (KERN_NO_SPACE). The test picks its forced address by allocating anywhere and releasing it. That range is the next one the system hands out, so another test's allocation, made between the release and step 3, takes it. The test now probes fixed ranges from `0x5000_0000_0000` up, which allocations made anywhere don't reach. Step 3 can then fail only if one of the failed maps kept the range, which is what it checks. Test-only change. ## How it was tested - [x] `cargo test -p victory-loader --lib` (arm64): 5 failures in 12 runs before, 0 in 30 after - [x] `cargo test --target x86_64-apple-darwin -p victory-hle -p victory-loader -p victory`: 380 passed, 0 failed - [x] `cargo clippy --workspace --all-targets --locked --target x86_64-pc-windows-gnullvm -- -D warnings`: clean - [x] `cargo xtask policy`: ok - [x] Ran the game: not needed (test only) ## Checklist - [x] No game files, game code, disassembly listings or SDK files are included - [x] Guesses about undocumented console behaviour are marked in the code and in docs/native-host.md (none) - [x] New diagnostics are behind a `VICTORY_*` variable and documented (none)
malformed_relocations_return_error_and_release_mapping picked its forced
address by allocating anywhere and releasing it, then expected the range
to be free again at step 3. That range is the next one the system hands
out, so another test's allocation in between took it about 1 run in 3
(`mach_vm_allocate failed: kern_return 3` at step 3).

The test now probes fixed ranges from 0x5000_0000_0000 up, which
allocations made anywhere do not reach, so step 3 fails only if one of
the failed maps kept the range.

Before: 5 failures in 12 runs of `cargo test -p victory-loader --lib`
(arm64). After: 0 in 30; also passes as x86_64 under Rosetta.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 08:47:26 +00:00
Author
Owner

@⁠LakshanSivakumar on GitHub · 2026-11-27 10:32 UTC · original

Thank you. A test-only change, and 0 failures in 30 runs after 5 in 12 is the evidence I wanted. Your workflow has not run; it needs my approval. The branch is behind main, please update it. I have not run it.

**@⁠LakshanSivakumar** on GitHub · 2026-11-27 10:32 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/283#issuecomment-7216007518) Thank you. A test-only change, and 0 failures in 30 runs after 5 in 12 is the evidence I wanted. Your workflow has not run; it needs my approval. The branch is behind main, please update it. I have not run it.
Author
Owner

@⁠maaalrey on GitHub · 2026-11-27 10:50 UTC · original

Updated: main (ce2b786) merged in. Since then, cargo test -p victory-loader --lib has 0 failures in 15 runs (arm64), cargo clippy --workspace --all-targets --locked --target x86_64-pc-windows-gnullvm -- -D warnings is clean with and without --all-features, and cargo xtask policy is ok. Thanks for the review.

**@⁠maaalrey** on GitHub · 2026-11-27 10:50 UTC · [original](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/283#issuecomment-7216372095) Updated: main (ce2b786) merged in. Since then, `cargo test -p victory-loader --lib` has 0 failures in 15 runs (arm64), `cargo clippy --workspace --all-targets --locked --target x86_64-pc-windows-gnullvm -- -D warnings` is clean with and without `--all-features`, and `cargo xtask policy` is ok. Thanks for the review.
github manually merged commit 875a926100 into main 2026-11-27 12:02:38 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.