test(libc): match the crash thread name check against the thread name lines only #15578

Merged
dantdmdarealguy merged 1 commit from upstream-pr/15578 into main 2026-11-07 10:40:30 +00:00
dantdmdarealguy commented 2026-11-03 19:53:19 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by dantdmdarealguy on 2026-11-03T19:53:19Z.


What

On main 1e658521a0, windows_crash_thread_name fails in a Windows Debug build, though the crash report it checks is correct. The test names the main thread 'a'×126 + 'Z' + 'b'×70 and a worker 'c'×126 + 'Y' + 'd'×70, then faults. Its FAIL_REGULAR_EXPRESSION "Zb|Yd|did not fault" (core/libs/CMakeLists.txt:708) is meant to catch a thread name the report prints past the 127 bytes it keeps (#14406). It also matches the crash report's register text dump, and in a Debug build rbx still points at the description string:

FATAL: unhandled exception 0xc0000005 on thread 55020 'aaaa…aaaaZ'
  [rbx] u"aaaa…aaaaZbbbbbbbbbbbbbbbbbbbbbbbbb…"
  thread 28172 'cccc…ccccY': rip 0x00007ffc81736a64 ntdll.dll+0x166a64 …
Test #599: windows_crash_thread_name ...***Failed  Error regular expression found in output. Regex=[Zb|Yd|did not fault]

The failure check now only looks at the name the report prints after thread <id> ': thread [0-9]+ 'a+Z[^']|thread [0-9]+ 'c+Y[^']|did not fault. The test still fails if anything other than the closing quote follows Z or Y: an unterminated buffer, a name that isn't truncated, or stray bytes. A name cut short before Z/Y still fails the unchanged PASS_REGULAR_EXPRESSION. The check is tied to the test's own names because other threads in the process carry their own descriptions (on this machine an injected WindhawkMainLoopThreadAttachExempt thread shows up in the all-threads list). Only the test registration changes; libc is untouched.

Tested

Windows 11 Pro, Intel Core i9-14900K, 128 GB RAM, NVIDIA GeForce RTX 5080 (driver 32.0.16.1742), WinLibs GCC 15.2.0. The Debug build has #15398 cherry-picked so that it links; it is not part of this PR.

  • Debug, ctest -R '^windows_crash_thread_name$' -V: main fails 3/3 (Error regular expression found in output. Regex=[Zb|Yd|did not fault]); with this change it passes 5/5.
  • Release: main passes 3/3; with this change it passes 5/5.
  • The test still fails with this change when the thread-name output in CrashReport.cpp is deliberately broken:
    • #14406 reverted (sizeof(buf) again): Debug prints 'a…Zb' / 'c…Yd', Release prints 'a…Zb<garbage>'. Both fail on the new FAIL regex.
    • Faulting-thread buffer raised to 256 bytes (full name printed, 'a…Zb…'): fails on the FAIL regex.
    • Captured worker-name buffers raised to 256 bytes ('c…Yd…'): fails on the FAIL regex.
    • Faulting-thread name cut to 64 bytes ('a…'): fails on Required regular expression not found.
  • Release ctest --output-on-failure --timeout 120 --parallel 2 -R "windows_crash_thread_name|patched_libraries": 2/2 pass. cmake --build build and --target libs succeed. tools/check_test_registration.py build and tools/check_conventions.py --base origin/main pass.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes, some AI assistance was used
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5143596774 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15578). Originally posted by [dantdmdarealguy](https://github.com/dantdmdarealguy) on 2026-11-03T19:53:19Z. --- ### What On `main` 1e658521a0, `windows_crash_thread_name` fails in a Windows Debug build, though the crash report it checks is correct. The test names the main thread `'a'×126 + 'Z' + 'b'×70` and a worker `'c'×126 + 'Y' + 'd'×70`, then faults. Its `FAIL_REGULAR_EXPRESSION "Zb|Yd|did not fault"` (`core/libs/CMakeLists.txt:708`) is meant to catch a thread name the report prints past the 127 bytes it keeps (#14406). It also matches the crash report's register text dump, and in a Debug build `rbx` still points at the description string: ``` FATAL: unhandled exception 0xc0000005 on thread 55020 'aaaa…aaaaZ' [rbx] u"aaaa…aaaaZbbbbbbbbbbbbbbbbbbbbbbbbb…" thread 28172 'cccc…ccccY': rip 0x00007ffc81736a64 ntdll.dll+0x166a64 … Test #599: windows_crash_thread_name ...***Failed Error regular expression found in output. Regex=[Zb|Yd|did not fault] ``` The failure check now only looks at the name the report prints after `thread <id> '`: `thread [0-9]+ 'a+Z[^']|thread [0-9]+ 'c+Y[^']|did not fault`. The test still fails if anything other than the closing quote follows `Z` or `Y`: an unterminated buffer, a name that isn't truncated, or stray bytes. A name cut short before `Z`/`Y` still fails the unchanged `PASS_REGULAR_EXPRESSION`. The check is tied to the test's own names because other threads in the process carry their own descriptions (on this machine an injected `WindhawkMainLoopThreadAttachExempt` thread shows up in the all-threads list). Only the test registration changes; libc is untouched. ### Tested Windows 11 Pro, Intel Core i9-14900K, 128 GB RAM, NVIDIA GeForce RTX 5080 (driver 32.0.16.1742), WinLibs GCC 15.2.0. The Debug build has #15398 cherry-picked so that it links; it is not part of this PR. - Debug, `ctest -R '^windows_crash_thread_name$' -V`: `main` fails 3/3 (`Error regular expression found in output. Regex=[Zb|Yd|did not fault]`); with this change it passes 5/5. - Release: `main` passes 3/3; with this change it passes 5/5. - The test still fails with this change when the thread-name output in `CrashReport.cpp` is deliberately broken: - #14406 reverted (`sizeof(buf)` again): Debug prints `'a…Zb'` / `'c…Yd'`, Release prints `'a…Zb<garbage>'`. Both fail on the new FAIL regex. - Faulting-thread buffer raised to 256 bytes (full name printed, `'a…Zb…'`): fails on the FAIL regex. - Captured worker-name buffers raised to 256 bytes (`'c…Yd…'`): fails on the FAIL regex. - Faulting-thread name cut to 64 bytes (`'a…'`): fails on `Required regular expression not found`. - Release `ctest --output-on-failure --timeout 120 --parallel 2 -R "windows_crash_thread_name|patched_libraries"`: 2/2 pass. `cmake --build build` and `--target libs` succeed. `tools/check_test_registration.py build` and `tools/check_conventions.py --base origin/main` pass. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes, some AI assistance was used
Superseabas commented 2026-11-04 16:52:51 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Superseabas on 2026-11-04T16:52:51Z.

Review: APPROVED


Head 3b64a02fcb merged onto current main b11c7bf84f (clean merge, local only), on a second machine where main fails this test in a Release build. Here the trigger is rdi and r13 rather than rbx.

Windows 11 Home 10.0.26200, WinLibs GCC 16.2.0 (x86_64-ucrt-posix-seh, r3), Release, BUILD_TESTING=ON. ctest -R '^windows_crash_thread_name$', 3 runs each:

Tree Result
main 0 of 3: Error regular expression found in output. Regex=[Zb|Yd|did not fault]
this PR 3 of 3 pass
this PR with #14406's fix taken out (sizeof(threadName) and sizeof(name) instead of - 1 in CrashReport.cpp) 0 of 3: the new FAIL_REGULAR_EXPRESSION matches on thread … 'a…aZb'

On main the names are cut where the test expects. The faulting thread prints 'a…aZ' and the list prints thread … 'c…cY':, but at the fault rdi and r13 still point at the worker's description, so the register dump prints [rdi] u"c…cYdddd…" and [r13] u"c…cYdddd…", and Yd matches there. The new pattern needs thread <id> ' before the name, and the dump lines start with [reg] u", so they no longer match. The control above shows that an unterminated name is still caught.

check_conventions.py --base main passes on the merge. I found nothing to change.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5772287126 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15578#pullrequestreview-5772287126). Originally posted by [Superseabas](https://github.com/Superseabas) on 2026-11-04T16:52:51Z. **Review:** APPROVED --- Head `3b64a02fcb` merged onto current `main` `b11c7bf84f` (clean merge, local only), on a second machine where `main` fails this test in a **Release** build. Here the trigger is `rdi` and `r13` rather than `rbx`. Windows 11 Home 10.0.26200, WinLibs GCC 16.2.0 (`x86_64-ucrt-posix-seh`, r3), Release, `BUILD_TESTING=ON`. `ctest -R '^windows_crash_thread_name$'`, 3 runs each: | Tree | Result | |---|---| | `main` | 0 of 3: `Error regular expression found in output. Regex=[Zb\|Yd\|did not fault]` | | this PR | 3 of 3 pass | | this PR with #14406's fix taken out (`sizeof(threadName)` and `sizeof(name)` instead of `- 1` in `CrashReport.cpp`) | 0 of 3: the new `FAIL_REGULAR_EXPRESSION` matches `on thread … 'a…aZb'` | On `main` the names are cut where the test expects. The faulting thread prints `'a…aZ'` and the list prints `thread … 'c…cY':`, but at the fault `rdi` and `r13` still point at the worker's description, so the register dump prints `[rdi] u"c…cYdddd…"` and `[r13] u"c…cYdddd…"`, and `Yd` matches there. The new pattern needs `thread <id> '` before the name, and the dump lines start with `[reg] u"`, so they no longer match. The control above shows that an unterminated name is still caught. `check_conventions.py --base main` passes on the merge. I found nothing to change. AI-assisted: yes (Claude Code)
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
boykopovar/AnyPS5!15578
No description provided.