test(victory-gpu): pin native::list pure helpers (decode_signed, dxil_bitcode, dedup_stage_elems) #618

Open
AnastasisKon wants to merge 1 commit from upstream-pr/618 into main
AnastasisKon commented 2026-11-28 15:18:34 +00:00 (Migrated from github.com)

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by AnastasisKon on 2026-11-28T15:18:34Z.


Test-only change: the pure helpers in crates/victory-gpu/src/native/list.rs had no unit tests. 91 lines appended (#[cfg(test)] mod tests at the end of the file); no production code touched.

What the tests pin

  • decode_signed: zigzag decode — even raw maps to raw >> 1, odd raw to -((raw >> 1)), plus a round trip over 0, ±1, ±42, i64::MAX, i64::MIN + 1.
  • dxil_bitcode: a hand-built minimal DXBC container with one DXIL part whose bitcode starts with the BC C0 DE magic is parsed and returns the bitcode past the magic; rejects empty/short containers, a bad DXBC magic, a part count past EOF, a part without the DXIL tag, and bitcode without the BC C0 DE magic.
  • dedup_stage_elems: keeps exactly one element per key — Table by (slot, offset), Pairs and Fixed by kind/index — and because the sort key ends in !writes, the writes: true variant sorts first and is the one kept.

How it was tested

  • cargo test --target x86_64-apple-darwin -p victory-gpu --lib native::list::tests — 4 pass (the native module is x86_64-only, so this runs under Rosetta)
  • cargo test --target x86_64-apple-darwin -p victory-gpu -- --test-threads=4 — 453 pass, 0 fail. At the default thread count a few pre-existing Metal GPU tests in native/tests.rs flake on this M1 under Rosetta; the same failures reproduce on a clean upstream/main checkout (issue #548 territory), and each failing test passes in isolation.
  • cargo test -p victory-hle -p victory -p victory-gpu -p xtask (host arm64) — all pass
  • cargo clippy --workspace --all-targets --locked --target x86_64-pc-windows-gnullvm -- -D warnings — clean
  • cargo xtask policy — clean
  • Not game-related; no game run needed

Checklist

  • One change, one PR; branch vibe/list-helpers-tests-1705ac from upstream/main, pushed to my fork only
  • No game/GDK files, no dumps/logs in the repo
  • No new diagnostics, no undocumented console-behaviour guesses (test-only)
  • No AI attribution in the diff
<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:issue:5541622835 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/618). Originally posted by [AnastasisKon](https://github.com/AnastasisKon) on 2026-11-28T15:18:34Z. --- Test-only change: the pure helpers in `crates/victory-gpu/src/native/list.rs` had no unit tests. 91 lines appended (`#[cfg(test)] mod tests` at the end of the file); no production code touched. ## What the tests pin - `decode_signed`: zigzag decode — even raw maps to `raw >> 1`, odd raw to `-((raw >> 1))`, plus a round trip over `0, ±1, ±42, i64::MAX, i64::MIN + 1`. - `dxil_bitcode`: a hand-built minimal DXBC container with one DXIL part whose bitcode starts with the `BC C0 DE` magic is parsed and returns the bitcode past the magic; rejects empty/short containers, a bad `DXBC` magic, a part count past EOF, a part without the `DXIL` tag, and bitcode without the `BC C0 DE` magic. - `dedup_stage_elems`: keeps exactly one element per key — `Table` by `(slot, offset)`, `Pairs` and `Fixed` by kind/index — and because the sort key ends in `!writes`, the `writes: true` variant sorts first and is the one kept. ## How it was tested - [x] `cargo test --target x86_64-apple-darwin -p victory-gpu --lib native::list::tests` — 4 pass (the `native` module is x86_64-only, so this runs under Rosetta) - [x] `cargo test --target x86_64-apple-darwin -p victory-gpu -- --test-threads=4` — 453 pass, 0 fail. At the default thread count a few pre-existing Metal GPU tests in `native/tests.rs` flake on this M1 under Rosetta; the same failures reproduce on a clean `upstream/main` checkout (issue #548 territory), and each failing test passes in isolation. - [x] `cargo test -p victory-hle -p victory -p victory-gpu -p xtask` (host arm64) — all pass - [x] `cargo clippy --workspace --all-targets --locked --target x86_64-pc-windows-gnullvm -- -D warnings` — clean - [x] `cargo xtask policy` — clean - [x] Not game-related; no game run needed ## Checklist - [x] One change, one PR; branch `vibe/list-helpers-tests-1705ac` from `upstream/main`, pushed to my fork only - [x] No game/GDK files, no dumps/logs in the repo - [x] No new diagnostics, no undocumented console-behaviour guesses (test-only) - [x] No AI attribution in the diff
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/618:upstream-pr/618'
git switch 'upstream-pr/618'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/618'
git switch 'upstream-pr/618'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/618'
git switch 'upstream-pr/618'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/618'
git switch 'main'
git merge --squash 'upstream-pr/618'
git switch 'main'
git merge --ff-only 'upstream-pr/618'
git switch 'main'
git merge 'upstream-pr/618'
git push origin 'main'
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!618
No description provided.