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

Merged
maaalrey merged 3 commits from upstream-pr/283 into main 2026-11-27 11:42:57 +00:00
maaalrey commented 2026-11-27 08:44:17 +00:00 (Migrated from github.com)

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by maaalrey on 2026-11-27T08:44:17Z.


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)
<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:issue:5523747019 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/283). Originally posted by [maaalrey](https://github.com/maaalrey) on 2026-11-27T08:44:17Z. --- ## 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)
LakshanSivakumar commented 2026-11-27 10:32:27 +00:00 (Migrated from github.com)

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by LakshanSivakumar on 2026-11-27T10:32:27Z.


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.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7216007518 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/283#issuecomment-7216007518). Originally posted by [LakshanSivakumar](https://github.com/LakshanSivakumar) on 2026-11-27T10:32:27Z. --- 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.
maaalrey commented 2026-11-27 10:50:40 +00:00 (Migrated from github.com)

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by maaalrey on 2026-11-27T10:50:40Z.


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.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7216372095 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/283#issuecomment-7216372095). Originally posted by [maaalrey](https://github.com/maaalrey) on 2026-11-27T10:50:40Z. --- 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.
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!283
No description provided.