Tests: cover mapped module table, lock-free lookup, and HLE handles #1473

Open
amazedturnip wants to merge 1 commit from upstream-pr/1483 into main
amazedturnip commented 2026-11-24 16:48:50 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by amazedturnip on 2026-11-24T16:48:50Z.


Add integration tests in crates/xcl/tests/modules_table.rs covering crates/xcl/src/modules.rs (mapped module registration/unregistration, lock-free image_base_for_addr lookup, set_main/main_module, HLE pseudo-handles, and describe_address for mapped and host modules). Previously only 2 inline unit tests covered module_offset and arbitrary stack words.

What is in it

  • crates/xcl/tests/modules_table.rs: add 5 integration tests covering MappedModule::contains, register_mapped/unregister_mapped, lock-free image_base_for_addr, find_mapped_by_{name,base,addr}, set_main/main_module, hle_handle/find_hle_handle/hle_name_by_handle, and describe_address for mapped and host modules

Tested

  • Hardware / OS / Rust: AMD Ryzen 7 9800X3D 8-Core Processor, Windows 11 Pro 10.0.26100 (Build 26100), rustc 1.94.1 (e408947bf 2026-03-25), stable-x86_64-pc-windows-msvc, debug build
  • AMD (AMD Radeon(TM) Graphics (driver 32.0.21043.19003, DXC 1.9.2609, native wave64), XCL_ADAPTER=radeon): cargo test --workspace -- --test-threads=2 — 775 passed, 0 failed, 41 ignored (SKIPPED GPU tests: none)
  • Verification / negative control: new test suite — verified 3x deterministic

Not tested

  • Retail Xbox Series X|S title (not available on this host)
  • NVIDIA wave32 GPU (not run in this pass; verified on AMD Radeon native wave64)

AI use

  • Antigravity CLI (Gemini 4 Hydrogen (Medium)) assisted with diagnosis, implementation, tests, review, and description; all tests executed locally on AMD Radeon (native wave64).
<!-- greyfinch-sync:ivall/xcl:issue:5476494475 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1483). Originally posted by [amazedturnip](https://github.com/amazedturnip) on 2026-11-24T16:48:50Z. --- Add integration tests in `crates/xcl/tests/modules_table.rs` covering `crates/xcl/src/modules.rs` (mapped module registration/unregistration, lock-free `image_base_for_addr` lookup, `set_main`/`main_module`, HLE pseudo-handles, and `describe_address` for mapped and host modules). Previously only 2 inline unit tests covered `module_offset` and arbitrary stack words. **What is in it** - `crates/xcl/tests/modules_table.rs`: add 5 integration tests covering `MappedModule::contains`, `register_mapped`/`unregister_mapped`, lock-free `image_base_for_addr`, `find_mapped_by_{name,base,addr}`, `set_main`/`main_module`, `hle_handle`/`find_hle_handle`/`hle_name_by_handle`, and `describe_address` for mapped and host modules **Tested** - Hardware / OS / Rust: AMD Ryzen 7 9800X3D 8-Core Processor, Windows 11 Pro 10.0.26100 (Build 26100), rustc 1.94.1 (e408947bf 2026-03-25), stable-x86_64-pc-windows-msvc, debug build - AMD (`AMD Radeon(TM) Graphics (driver 32.0.21043.19003, DXC 1.9.2609, native wave64)`, `XCL_ADAPTER=radeon`): `cargo test --workspace -- --test-threads=2` — 775 passed, 0 failed, 41 ignored (SKIPPED GPU tests: none) - Verification / negative control: new test suite — verified 3x deterministic **Not tested** - Retail Xbox Series X|S title (not available on this host) - NVIDIA wave32 GPU (not run in this pass; verified on AMD Radeon native wave64) **AI use** - Antigravity CLI (Gemini 4 Hydrogen (Medium)) assisted with diagnosis, implementation, tests, review, and description; all tests executed locally on AMD Radeon (native wave64).
dcastell1 commented 2026-11-24 17:06:41 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by dcastell1 on 2026-11-24T16:55:27Z.


Verified on Windows 11 10.0.26300, NVIDIA GeForce RTX 5090 (driver 621.24), Rust 1.100.0 MSVC 14.44.35207, debug build, on main@b7aa9f3 (baseline 770 passed, 0 failed, 41 ignored on this box):

patch -p1 < this PR            # clean, no fuzz
cargo test --workspace -- --test-threads=4
775 passed; 0 failed; 41 ignored   (exit 0)

Five more passing tests than the baseline: the mapped module table and its lock-free lookup ship real coverage and it runs green.

Tree restored afterwards (full diff against a clean checkout), hardware adapter, no Wine, no game data. AI-assisted (opencode): applied the patch to a built tree, ran the suite, reverted it.

<!-- greyfinch-sync:ivall/xcl:comment:7138416340 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/1483#issuecomment-7138416340). Originally posted by [dcastell1](https://github.com/dcastell1) on 2026-11-24T16:55:27Z. --- Verified on Windows 11 10.0.26300, NVIDIA GeForce RTX 5090 (driver 621.24), Rust 1.100.0 MSVC 14.44.35207, debug build, on `main@b7aa9f3` (baseline **770 passed, 0 failed, 41 ignored** on this box): ``` patch -p1 < this PR # clean, no fuzz cargo test --workspace -- --test-threads=4 775 passed; 0 failed; 41 ignored (exit 0) ``` Five more passing tests than the baseline: the mapped module table and its lock-free lookup ship real coverage and it runs green. Tree restored afterwards (full diff against a clean checkout), hardware adapter, no Wine, no game data. AI-assisted (opencode): applied the patch to a built tree, ran the suite, reverted it.
futurepro62 commented 2026-11-24 18:08:57 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by futurepro62 on 2026-11-24T17:18:18Z.


An AMD run to go with the RTX 5090 report above. Tested exact head 84e7d21 (on its base b7aa9f3).

Tested

  • AMD Radeon iGPU of a Ryzen 7 9800X3D (RDNA2, native wave64), XCL_ADAPTER=radeon cargo test --workspace -- --test-threads=4: 775 passed, 0 failed, 41 ignored, nothing skipped.
  • Same head on an RTX 5070 Ti (driver 616.64), XCL_REQUIRE_GPU=mesh: 775 passed, 0 failed (the usual two wave64-only skips).

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and wrote this comment. I checked it before posting.
<!-- greyfinch-sync:ivall/xcl:comment:7138993322 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1483#issuecomment-7138993322). Originally posted by [futurepro62](https://github.com/futurepro62) on 2026-11-24T17:18:18Z. --- An AMD run to go with the RTX 5090 report above. Tested exact head `84e7d21` (on its base `b7aa9f3`). **Tested** - AMD Radeon iGPU of a Ryzen 7 9800X3D (RDNA2, native wave64), `XCL_ADAPTER=radeon cargo test --workspace -- --test-threads=4`: **775 passed, 0 failed, 41 ignored**, nothing skipped. - Same head on an RTX 5070 Ti (driver 616.64), `XCL_REQUIRE_GPU=mesh`: 775 passed, 0 failed (the usual two wave64-only skips). **AI use** - Claude Code (Claude Opus 5.5) ran the tests and wrote this comment. I checked it before posting.
DavidM1911 commented 2026-11-24 19:07:45 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T18:53:25Z.


Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, ~21 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodified main.)

Thanks!

<!-- greyfinch-sync:ivall/xcl:comment:7141295002 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1483#issuecomment-7141295002). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-24T18:53:25Z. --- Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~21 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodified `main`.) Thanks!
github-actions[bot] commented 2026-11-28 08:00:41 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-11-28T08:00:41Z.


Nothing has happened on this PR for 3 days, so it is marked stale and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto main if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.

<!-- greyfinch-sync:ivall/xcl:comment:7236303065 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1483#issuecomment-7236303065). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-11-28T08:00:41Z. --- Nothing has happened on this PR for 3 days, so it is marked `stale` and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto `main` if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.
amazedturnip commented 2026-11-28 20:36:41 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by amazedturnip on 2026-11-28T20:36:41Z.


Still merges cleanly onto main (765b2c5b) with passing checks; pins mapped module table registration, lock-free lookup, and HLE handle contracts — waiting on maintainer / post-goal review.

<!-- greyfinch-sync:ivall/xcl:comment:7245412320 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1483#issuecomment-7245412320). Originally posted by [amazedturnip](https://github.com/amazedturnip) on 2026-11-28T20:36:41Z. --- Still merges cleanly onto main (765b2c5b) with passing checks; pins mapped module table registration, lock-free lookup, and HLE handle contracts — waiting on maintainer / post-goal review.
Foniass commented 2026-12-01 05:54:38 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T05:54:38Z.


Triage (#1607) – head 84e7d21

No open or merged PR adds the same tests; the unit tests in crates/xcl/src/modules.rs on main cover the RangeTable itself, this file covers the public register/lookup/unregister, main-module and HLE-handle API from outside the crate.
No problems found in the diff: the global-state tests are serialized by GLOBAL_LOCK, and set_main_and_main_module_track_latest_main relies on no other test in this binary setting the main module, which holds for this file.
Recommendation: keep open.

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

<!-- greyfinch-sync:ivall/xcl:comment:7302268710 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1483#issuecomment-7302268710). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T05:54:38Z. --- **Triage (#1607)** – head 84e7d21 No open or merged PR adds the same tests; the unit tests in crates/xcl/src/modules.rs on main cover the RangeTable itself, this file covers the public register/lookup/unregister, main-module and HLE-handle API from outside the crate. No problems found in the diff: the global-state tests are serialized by GLOBAL_LOCK, and `set_main_and_main_module_track_latest_main` relies on no other test in this binary setting the main module, which holds for this file. Recommendation: keep open. AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
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/1483:upstream-pr/1483'
git switch 'upstream-pr/1483'

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/1483'
git switch 'upstream-pr/1483'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1483'
git switch 'upstream-pr/1483'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1483'
git switch 'main'
git merge --squash 'upstream-pr/1483'
git switch 'main'
git merge --ff-only 'upstream-pr/1483'
git switch 'main'
git merge 'upstream-pr/1483'
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
xcl-dev/xcl!1473
No description provided.