XTaskQueue/XAsync: 60 conformance scenarios as tests (57 pass on the real PC runtime, 36 on main, 24 differences listed) #48

Closed
github-bot wants to merge 1 commit from gh-pr/48/head into gh-pr/48/base
Owner

@⁠QuentinDanblon on GitHub · 2026-11-21 20:03 UTC · original
QuentinDanblon:test/xtaskqueue-conformance → main · +2502 −0 · 3 files · 104 commits · closed without merging

Library / area: compat-common tests for the emulated XTaskQueue / XAsync (interface 073b7dcb). Tests only: gdk/rt.rs is not changed.

Exports changed (exports.txt rows): none

Source of the behaviour: Microsoft libHttpClient (MIT, commit c5007fd), the reference implementation of this API: Tests/UnitTests/Tests/TaskQueueTests.cpp and AsyncBlockTests.cpp. Behaviour ported, no C++ code. Four scenarios come from #28 by zerkend.

Re-scoped on 51f5319

This PR used to replace most of rt.rs. Main has kept developing its own rt.rs since, so the replacement is dropped and only the scenarios remain. Three new files, nothing else touched:

  • tests/support/xtq.rs: 60 scenarios, each citing its libHttpClient test or saying it has none. They call the 073b7dcb vtable through QueryApiImpl, the way a title does.
  • tests/gdk_xtaskqueue_conformance.rs: runs them against the emulator.
  • tests/gdk_xtaskqueue_conformance_real.rs: runs the same scenarios against the PC Gaming Runtime's xgameruntime.dll loaded from System32 (skipped when Gaming Services is absent).

Results

result
real PC xgameruntime.dll 10.0.26100.9656 57 pass, 3 skipped (they check libHttpClient fixes newer than that runtime)
rt.rs of main 51f5319 36 pass, 24 differ

The 24 are listed in DIFFERS in gdk_xtaskqueue_conformance.rs, each with the result the emulator returned. They are skipped by default so the suite is green; TOMBOX_XTQ_ALL=1 runs them. Measured one scenario per process with a 25 s limit: 23 fail, none hangs. The 24th, verify_wait_for_completion, passes alone and with --test-threads=1 and fails when the scenarios run in parallel (3 runs of 3).

The 24 differences
scenario emulator on 51f5319 reference
verify_begin_after_terminate XAsyncBegin on a terminated queue returns S_OK E_ABORT
verify_cancellation, verify_cleanup_waits_for_work, verify_cleanup_waits_for_work_distributed after XAsyncCancel, XAsyncGetStatus(wait) returns before the completion callback has seen E_ABORT callback has run with E_ABORT
verify_wait_for_completion (parallel runs only) XAsyncGetStatus(wait) returns before the completion callback has finished waits for it
verify_cant_schedule_twice second XAsyncSchedule returns S_OK E_UNEXPECTED
verify_close_keeps_queued_callbacks closing the handle cancels the 21 queued callbacks all 21 run
verify_dispatch_on_pool_port XTaskQueueDispatch on a thread-pool port with a queued item returns false true
verify_duplicate_queue_handle XTaskQueueDuplicateHandle returns the same handle a new handle
verify_failed_begin_completes XAsyncBegin returns E_FAIL when the Begin op fails S_OK and a completed call
verify_failure_in_do_work DoWork returning S_OK without XAsyncComplete leaves status S_OK E_UNEXPECTED
verify_get_async_status_no_deadlock XAsyncRun on a reused block returns E_INVALIDARG S_OK
verify_global_queue XAsyncBegin with no process queue returns S_OK E_NO_TASK_QUEUE
verify_multithread_manual_dispatch terminating the queue does not release XTaskQueueDispatch(INFINITE) released
verify_queue_monitor_has_correct_ports the base queue monitor does not report its port for a shared port port reported
verify_queue_termination, verify_register_with_auto_reset, verify_termination_of_composite_queue, verify_shared_port_queue_rundown_keeps_other_waiters, verify_shared_port_queue_rundown_drops_its_wait_handles XTaskQueueRegisterWaiter returns E_NOTIMPL waiter registered
verify_result_buffer_checks XAsyncGetResult with a null buffer returns 0x8007007a E_INVALIDARG
verify_terminate_waits_for_async_in_flight termination finishes while an XAsync call on the queue is still pending waits for it
verify_termination_of_base_queue_keeps_composites the composite's pending callback runs canceled runs normally
verify_thread_pool_callbacks_can_block 24 blocking thread-pool callbacks cannot all run at once they can

The reference is libHttpClient and the PC runtime. None of this was measured on a console. Where the console is known to differ, the scenario should assert the console result instead, as verify_global_queue already does for terminating the process queue (your non-closable-queue check, xgameruntime 0x6d0d8). So the table is a list of differences from the PC side, not a list of 24 bugs.

Tests

  • cargo test -p compat-common --release --test gdk_xtaskqueue_conformance: 60 pass (24 of them skipped as listed), 5 runs of 5.

  • cargo test -p compat-common --release --test gdk_xtaskqueue_conformance_real -- --test-threads=1: 60 pass (3 of them skipped as above).

  • Not run against a title.

  • No game or console files and no binaries included

  • No fake success: a skipped scenario prints SKIP: with the difference

🤖 Generated with Claude Code

**@⁠QuentinDanblon** on GitHub · 2026-11-21 20:03 UTC · [original](https://github.com/omonkeyz/xbox-emulator/pull/48) `QuentinDanblon:test/xtaskqueue-conformance` → `main` · +2502 −0 · 3 files · 104 commits · closed without merging **Library / area:** compat-common tests for the emulated XTaskQueue / XAsync (interface 073b7dcb). Tests only: `gdk/rt.rs` is not changed. **Exports changed (exports.txt rows):** none **Source of the behaviour:** Microsoft libHttpClient (MIT, commit c5007fd), the reference implementation of this API: `Tests/UnitTests/Tests/TaskQueueTests.cpp` and `AsyncBlockTests.cpp`. Behaviour ported, no C++ code. Four scenarios come from #28 by zerkend. ### Re-scoped on 51f5319 This PR used to replace most of `rt.rs`. Main has kept developing its own `rt.rs` since, so the replacement is dropped and only the scenarios remain. Three new files, nothing else touched: - `tests/support/xtq.rs`: 60 scenarios, each citing its libHttpClient test or saying it has none. They call the 073b7dcb vtable through `QueryApiImpl`, the way a title does. - `tests/gdk_xtaskqueue_conformance.rs`: runs them against the emulator. - `tests/gdk_xtaskqueue_conformance_real.rs`: runs the same scenarios against the PC Gaming Runtime's `xgameruntime.dll` loaded from System32 (skipped when Gaming Services is absent). ### Results | | result | |---|---| | real PC `xgameruntime.dll` 10.0.26100.9656 | 57 pass, 3 skipped (they check libHttpClient fixes newer than that runtime) | | `rt.rs` of main 51f5319 | 36 pass, 24 differ | The 24 are listed in `DIFFERS` in `gdk_xtaskqueue_conformance.rs`, each with the result the emulator returned. They are skipped by default so the suite is green; `TOMBOX_XTQ_ALL=1` runs them. Measured one scenario per process with a 25 s limit: 23 fail, none hangs. The 24th, `verify_wait_for_completion`, passes alone and with `--test-threads=1` and fails when the scenarios run in parallel (3 runs of 3). <details><summary>The 24 differences</summary> | scenario | emulator on 51f5319 | reference | |---|---|---| | `verify_begin_after_terminate` | XAsyncBegin on a terminated queue returns S_OK | E_ABORT | | `verify_cancellation`, `verify_cleanup_waits_for_work`, `verify_cleanup_waits_for_work_distributed` | after XAsyncCancel, XAsyncGetStatus(wait) returns before the completion callback has seen E_ABORT | callback has run with E_ABORT | | `verify_wait_for_completion` (parallel runs only) | XAsyncGetStatus(wait) returns before the completion callback has finished | waits for it | | `verify_cant_schedule_twice` | second XAsyncSchedule returns S_OK | E_UNEXPECTED | | `verify_close_keeps_queued_callbacks` | closing the handle cancels the 21 queued callbacks | all 21 run | | `verify_dispatch_on_pool_port` | XTaskQueueDispatch on a thread-pool port with a queued item returns false | true | | `verify_duplicate_queue_handle` | XTaskQueueDuplicateHandle returns the same handle | a new handle | | `verify_failed_begin_completes` | XAsyncBegin returns E_FAIL when the Begin op fails | S_OK and a completed call | | `verify_failure_in_do_work` | DoWork returning S_OK without XAsyncComplete leaves status S_OK | E_UNEXPECTED | | `verify_get_async_status_no_deadlock` | XAsyncRun on a reused block returns E_INVALIDARG | S_OK | | `verify_global_queue` | XAsyncBegin with no process queue returns S_OK | E_NO_TASK_QUEUE | | `verify_multithread_manual_dispatch` | terminating the queue does not release XTaskQueueDispatch(INFINITE) | released | | `verify_queue_monitor_has_correct_ports` | the base queue monitor does not report its port for a shared port | port reported | | `verify_queue_termination`, `verify_register_with_auto_reset`, `verify_termination_of_composite_queue`, `verify_shared_port_queue_rundown_keeps_other_waiters`, `verify_shared_port_queue_rundown_drops_its_wait_handles` | XTaskQueueRegisterWaiter returns E_NOTIMPL | waiter registered | | `verify_result_buffer_checks` | XAsyncGetResult with a null buffer returns 0x8007007a | E_INVALIDARG | | `verify_terminate_waits_for_async_in_flight` | termination finishes while an XAsync call on the queue is still pending | waits for it | | `verify_termination_of_base_queue_keeps_composites` | the composite's pending callback runs canceled | runs normally | | `verify_thread_pool_callbacks_can_block` | 24 blocking thread-pool callbacks cannot all run at once | they can | </details> The reference is libHttpClient and the PC runtime. None of this was measured on a console. Where the console is known to differ, the scenario should assert the console result instead, as `verify_global_queue` already does for terminating the process queue (your non-closable-queue check, xgameruntime 0x6d0d8). So the table is a list of differences from the PC side, not a list of 24 bugs. ### Tests - `cargo test -p compat-common --release --test gdk_xtaskqueue_conformance`: 60 pass (24 of them skipped as listed), 5 runs of 5. - `cargo test -p compat-common --release --test gdk_xtaskqueue_conformance_real -- --test-threads=1`: 60 pass (3 of them skipped as above). - Not run against a title. - [x] No game or console files and no binaries included - [x] No fake success: a skipped scenario prints `SKIP:` with the difference 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Tests only, gdk/rt.rs is not changed.

tests/support/xtq.rs ports the behavioural scenarios of libHttpClient's
TaskQueueTests.cpp and AsyncBlockTests.cpp (MIT, commit c5007fd9) and runs
them through the 073b7dcb QueryApiImpl vtable:
- gdk_xtaskqueue_conformance.rs: against the emulated interface in gdk/rt.rs;
- gdk_xtaskqueue_conformance_real.rs: against the PC Gaming Runtime's
  xgameruntime.dll when Gaming Services is installed (10.0.26100.9656 here:
  57 scenarios pass, 3 are skipped because they check libHttpClient fixes
  newer than that runtime).

On main 51f5319 the emulator passes 36 scenarios. The 24 others are listed in
DIFFERS with the result the emulator returned, and are skipped unless
TOMBOX_XTQ_ALL=1. The reference is libHttpClient and the PC runtime. Where the
console differs, the scenario should assert the console result instead, as
verify_global_queue does for terminating the process queue (BLOCKERS: the
console's non-closable-queue check in xgameruntime 0x6d0d8).

Four scenarios come from omonkeyz/xbox-emulator PR #28 by zerkend (final
release of a serialized port, shared ownership, restart for a late completion
marker, cancellation and marker ordering during a running callback), ported
to the vtable so they also run against the PC runtime.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 06:08:24 +00:00
github-bot closed this pull request 2026-11-26 06:08:24 +00:00
Author
Owner

@⁠QuentinDanblon on GitHub · 2026-11-21 22:02 UTC · original

Rebased onto 0fc7295, with the targeted tests re-run on the new base. #49 keeps the fused f16 FMA at VOP2 0x36-0x38 (gfx1013 v_fmac/fmamk/fmaak_f16) and updates the upstream ISA-sweep cases to the fused model. #36 adapts to upstream's TB_CEN_Q centroid qualifier. #48 now also includes the 4 regression scenarios from #28, credited.

**@⁠QuentinDanblon** on GitHub · 2026-11-21 22:02 UTC · [original](https://github.com/omonkeyz/xbox-emulator/pull/48#issuecomment-7069900688) Rebased onto 0fc7295, with the targeted tests re-run on the new base. #49 keeps the fused f16 FMA at VOP2 0x36-0x38 (gfx1013 v_fmac/fmamk/fmaak_f16) and updates the upstream ISA-sweep cases to the fused model. #36 adapts to upstream's TB_CEN_Q centroid qualifier. #48 now also includes the 4 regression scenarios from #28, credited.
Author
Owner

@⁠QuentinDanblon on GitHub · 2026-11-22 00:54 UTC · original

@⁠omonkeyz rebased on 285a165 (round 3). Two measurements on the real PC runtime that concern your round-3 changes, in case they are useful whatever you do with this PR.

I ran your two new gdk_verifier_fixes scenarios against xgameruntime.dll 10.0.26100.9656 (System32, loaded directly, same harness as gdk_xtaskqueue_conformance_real):

scenario main 285a165 PC runtime
owner queue terminated, composite on its ports has a pending callback callback runs canceled callback runs (not canceled)
then submit / delayed submit on the composite E_ABORT S_OK, and the callbacks run
then XTaskQueueCreateComposite on the same ports E_ABORT S_OK
owner's own pending callback canceled canceled (same)
thread-pool callback calls XTaskQueueTerminate(own queue, wait = true) returns does not return in 5 s, termination callback not delivered (ThreadPool and SerializedThreadPool)

Both match the libHttpClient source: the Active / Canceled / Terminating / Terminated status lives on the port context, one per queue, not on the port (TaskQueue.cpp 538, 706, 1837-1839), and terminations are only signalled when no callback is running on the port (824-826). So the BLOCKERS note that calls the port-level E_ABORT the "libHttpClient model" does not match what libHttpClient does.

This is the PC runtime, not a console. The process queue already showed the two can differ (E_ACCESSDENIED on console, S_OK on PC), so if you traced these on the console DLL, yours is right and I'll align this branch. If the round-3 behaviour came from reading the code rather than from a console trace, the composite part is the one I would revert: a title that keeps a composite queue on the ports of a queue it terminated gets E_ABORT on main and S_OK on the PC runtime. The self-terminate part is harmless either way (a title cannot depend on a hang).

State of this branch, details in the description:

  • 60 scenarios (one new: verify_termination_of_base_queue_keeps_composites): 60 pass here, 57 pass + 3 skipped on the PC runtime.
  • Same 60 against main's rt.rs: 34 pass, 25 fail, 1 does not finish (verify_get_async_status_no_deadlock). The names are in the description. Most are not about terminate: slots 20/21/23/24/26 still return E_NOTIMPL, XTaskQueueDuplicateHandle returns the same handle, and several XAsync cases.
  • Your gdk_verifier_fixes: 12 of 14 pass with this branch's rt.rs. The 2 that fail are the two round-3 tests above. I left them untouched rather than edit your tests.
  • The default process queue and the null handle now return E_ACCESSDENIED on terminate, following your console check.
**@⁠QuentinDanblon** on GitHub · 2026-11-22 00:54 UTC · [original](https://github.com/omonkeyz/xbox-emulator/pull/48#issuecomment-7071852666) @⁠omonkeyz rebased on 285a165 (round 3). Two measurements on the real PC runtime that concern your round-3 changes, in case they are useful whatever you do with this PR. I ran your two new `gdk_verifier_fixes` scenarios against `xgameruntime.dll` 10.0.26100.9656 (System32, loaded directly, same harness as `gdk_xtaskqueue_conformance_real`): | scenario | main 285a165 | PC runtime | |---|---|---| | owner queue terminated, composite on its ports has a pending callback | callback runs canceled | callback **runs** (not canceled) | | then submit / delayed submit on the composite | E_ABORT | **S_OK**, and the callbacks run | | then `XTaskQueueCreateComposite` on the same ports | E_ABORT | **S_OK** | | owner's own pending callback | canceled | canceled (same) | | thread-pool callback calls `XTaskQueueTerminate(own queue, wait = true)` | returns | **does not return** in 5 s, termination callback not delivered (ThreadPool and SerializedThreadPool) | Both match the libHttpClient source: the Active / Canceled / Terminating / Terminated status lives on the port context, one per queue, not on the port (`TaskQueue.cpp` 538, 706, 1837-1839), and terminations are only signalled when no callback is running on the port (824-826). So the BLOCKERS note that calls the port-level E_ABORT the "libHttpClient model" does not match what libHttpClient does. This is the PC runtime, not a console. The process queue already showed the two can differ (E_ACCESSDENIED on console, S_OK on PC), so if you traced these on the console DLL, yours is right and I'll align this branch. If the round-3 behaviour came from reading the code rather than from a console trace, the composite part is the one I would revert: a title that keeps a composite queue on the ports of a queue it terminated gets E_ABORT on main and S_OK on the PC runtime. The self-terminate part is harmless either way (a title cannot depend on a hang). State of this branch, details in the description: - 60 scenarios (one new: `verify_termination_of_base_queue_keeps_composites`): 60 pass here, 57 pass + 3 skipped on the PC runtime. - Same 60 against main's `rt.rs`: 34 pass, 25 fail, 1 does not finish (`verify_get_async_status_no_deadlock`). The names are in the description. Most are not about terminate: slots 20/21/23/24/26 still return E_NOTIMPL, `XTaskQueueDuplicateHandle` returns the same handle, and several XAsync cases. - Your `gdk_verifier_fixes`: 12 of 14 pass with this branch's `rt.rs`. The 2 that fail are the two round-3 tests above. I left them untouched rather than edit your tests. - The default process queue and the null handle now return E_ACCESSDENIED on terminate, following your console check.
Author
Owner

@⁠omonkeyz on GitHub · 2026-11-22 13:12 UTC · original

Main's history was rewritten, which auto-closed this PR (sorry for the noise). Please strip the comment lines and rerun against the current rt.rs. Some DIFFERS entries may be stale now. To resubmit: git fetch this repo, branch from the current main, cherry-pick only your own commits (the old branch is based on the previous history and cannot be merged), and open a new PR.

**@⁠omonkeyz** on GitHub · 2026-11-22 13:12 UTC · [original](https://github.com/omonkeyz/xbox-emulator/pull/48#issuecomment-7079648195) Main's history was rewritten, which auto-closed this PR (sorry for the noise). Please strip the comment lines and rerun against the current rt.rs. Some DIFFERS entries may be stale now. To resubmit: `git fetch` this repo, branch from the current `main`, cherry-pick only your own commits (the old branch is based on the previous history and cannot be merged), and open a new PR.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.