Skip to content

tests: when the test title does not finish, print the exit code and the log tail - #512

Closed
Luislariosss wants to merge 2 commits into
xcl-dev:mainfrom
Luislariosss:test/e2e-diagnosable-assert
Closed

Luislariosss wants to merge 2 commits into
xcl-dev:mainfrom
Luislariosss:test/e2e-diagnosable-assert

Conversation

@Luislariosss

Copy link
Copy Markdown

Follow-up to #500.

The assertion in the debug-layer end-to-end test only printed the launcher's opening lines:

the test title did not run to the end:
XCL 0.1.0 – starting 'XCL.TestTitle'
  ...
  console: imports kernelx.dll, xgameruntime.dll

with no exit code and no log, so a failure could not be told apart from a refusal, a crash, or a title that never started. I hit that once on this machine (it did not reproduce in five later runs, see #500) and could not diagnose it.

Change

Test-only, one file:

  • the log is read before the assertion and with unwrap_or_default(), so a missing log no longer panics on its own and hides why the title stopped;
  • the failure now carries the process exit code, the launcher's stdout and stderr, and the last 40 lines of xcl.log;
  • the "debug layer did not come up" assertion prints the same tail.

A forced failure shows what it looks like now:

the test title did not run to the end (exit Some(0)):
--- xcl stdout ---
...
--- xcl stderr ---
--- xcl.log, last 40 lines ---
xcl: D3D12: debug layer enabled
xcl: D3D12 debug layer (error, id 93): ID3D12Device::CreatePixelShader: Pixel Shader is corrupt or in an unrecognized format.
xcl: D3D12 debug layer (error, id 93): ID3D12Device::CreatePixelShader: Shader is corrupt or in an unrecognized format.
...

That last part is worth a second look on its own: the debug layer is reporting a corrupt pixel shader in this test, which the old message hid completely.

Testing

  • cargo test -p xcl --test e2e test_title_draws_with_a_root_signature_under_the_debug_layer: ok, 1 passed.
  • The message above comes from inverting the assertion for one run, then reverting it.

AI-assisted.

commit() removed the page from LAZY before VirtualAlloc, so a failed commit - the system's commit limit, which a retail title on a 16 GB machine gets close to - left the page out of the set with nothing committed. The next access to it was no longer recognised as lazy, the handler returned EXCEPTION_CONTINUE_SEARCH, and the title died with 0xc0000005 on a page that was still MEM_RESERVE, with no log line: the crash named a wild write instead of an out-of-memory.

The page now leaves the set only once the allocation succeeded. The allocation is a parameter (commit_with), so a test can make it fail and assert that the page stays lazy, that a retry that succeeds takes it out, and that a page that was never lazy is not touched.
The assertion in the debug-layer end-to-end test only printed the launcher's
opening lines, so a failure looked like "the test title did not run to the end"
with no exit code and no log. I hit exactly that once here (it did not
reproduce in five later runs, issue xcl-dev#500) and could not tell whether the title
crashed, was refused, or never started.

Now the failure carries the process exit code, the launcher's stdout and
stderr, and the last 40 lines of xcl.log, which is where the debug layer's own
objections end up:

    the test title did not run to the end (exit Some(0)):
    --- xcl stdout ---
    ...
    --- xcl stderr ---
    --- xcl.log, last 40 lines ---
    xcl: D3D12 debug layer (error, id 93): ID3D12Device::CreatePixelShader: ...

The log is read before the assertion and with unwrap_or_default, so a missing
log no longer panics on its own and hides the reason the title stopped; the
"debug layer did not come up" assertion prints the same tail.

cargo test -p xcl --test e2e test_title_draws: ok, 1 passed. Test-only, no
production code touched.
@Luislariosss

Copy link
Copy Markdown
Author

About the debug-layer errors I quoted: I chased them and they are not a bug, so nobody should follow me there.

The log shows what happens, in order:

[SHADER] ps 8a5d1b6c5b50f11e: 56 B, format container-unknown, parts [XBOX] D3D12 debug layer (error, id 93): ID3D12Device::CreatePixelShader: Pixel Shader is corrupt or in an unrecognized format. D3D12.X: graphics PSO rejected by the driver (0x80004005) - fallback shaders used (#1)

The test title ships a 56-byte synthetic console container, the driver refuses it, and the layer falls back to its own shaders and carries on - which is the point of that fixture. So those three messages are the expected output of a deliberate refusal, not a defect, and the test passing is correct.

What PR #512 is worth is only the diagnosis: the failure message now contains those lines instead of hiding them, which is what was missing when #500 failed once without a reason. I have edited the paragraph about it above rather than leave a false lead in the description.

AI-assisted.

@H0UNDZER0

Copy link
Copy Markdown

Tested on an RTX 5080, release build: pass, 677 passed, 0 failed.

  • Commit a01193bbb8141f542be6a0f0c7f135b5bab3c55b, this PR's head as is (on its base 2997c9a; it includes kernelx: a lazy page whose commit fails stays lazy, and says so #502's commit), release build.
  • NVIDIA GeForce RTX 5080 16 GB, driver 621.24 (32.0.16.2124), 32-lane waves; Ryzen 7 9700X; Windows 11 Pro 24H2 (26100.9711); Rust 1.100.0 MSVC; DXC 1.9.2602.17 (Windows SDK 10.0.26100.0); D3D12 debug layer installed. No XCL_* variables set.
  • cargo build --release --workspace --locked: OK, the same single fetch_update warning as main.
  • cargo test --workspace --release --no-fail-fast --locked -- --test-threads=4, run twice (the second with --show-output): 677 passed, 0 failed, 41 ignored both times. main 2997c9a gives 676 / 0 / 41 on this PC: the difference is the new a_failed_commit_leaves_the_page_lazy, which passes.
  • SKIPPED: the usual 2, gpu_geometry_wave32_prefix_count_over_a_mask and gpu_wave32_program_in_wave64_hardware (no wave64).
  • Both test-title tests in e2e pass, test_title_draws_with_a_root_signature_under_the_debug_layer included, so the new failure messages had nothing to print here.

Not tested

  • The new messages themselves: they print only when the test title does not finish.
  • This PR merged onto a newer main. At the time of the run that was 9ce2070; git merge-tree showed no conflict.
  • Debug build, retail titles, scripts/smoke.ps1.

AI use: Claude Code (Claude Opus 5.5, Claude Fable 5.2)

@upipibi upipibi mentioned this pull request Nov 24, 2026
@MesshM

MesshM commented Nov 24, 2026

Copy link
Copy Markdown

Test run of a01193bbb8141f542be6a0f0c7f135b5bab3c55b on AMD RDNA4. I merged it onto current main f4ce27c locally (clean merge) and tested that tree.

Tested

  • AMD Radeon RX 9060 XT 16 GB (RDNA4), driver 32.0.32029.2010; Ryzen 7 5700X, 64 GB RAM, Windows 11 Pro build 26200, Rust 1.100.0 stable-x86_64-pc-windows-msvc, debug
  • cargo build --workspace + cargo test --workspace -- --test-threads=4 on the merge: 702 passed, 0 failed, 41 ignored, exit code 0; xcl lib tests 661 passed, 0 failed, 21 ignored
  • 0 SKIPPED; a_failed_commit_leaves_the_page_lazy and the other lazy tests pass, as does the e2e test.

Review: The title says this is about the e2e test's failure output, but the PR also changes kernelx/lazy.rs so a failed MEM_COMMIT leaves the page in the lazy set, which is a runtime change and what #487 does for #467. CONTRIBUTING asks for one change per PR and a regression run for runtime changes; splitting the lazy.rs part out (or leaving it to #487) would let the test-output part land as a test-only change. The lazy.rs change itself looks right: the page is only removed from the set once the commit succeeded.

Not tested: no retail title or regression run (I have no unpacked game), no XCL_SAMPLE_* tests, release build; the PR's head on its old base was not run, only its merge onto main.

Run and review by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code.

@raylitebull

Copy link
Copy Markdown
Member

Closing because it fails the required PR description check (missing required template / AI-use sections per CONTRIBUTING.md). Feel free to reopen once updated to match the template.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants