shader: decode the RDNA 2 scanner's CLI output as UTF-8 #839

Merged
lukaslw-lab merged 1 commit from upstream-pr/845 into main 2026-11-23 12:15:06 +00:00
lukaslw-lab commented 2026-11-23 12:02:47 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by lukaslw-lab on 2026-11-23T12:02:47Z.


Change

test_cli_scanner runs tools/scan_unsupported_shaders.py with PYTHONIOENCODING=utf-8 and decodes its output as UTF-8, instead of text=True in the locale encoding. With PYTHONIOENCODING=utf-8 on a non-UTF-8 Windows code page, the scanner printed its block progress bar as UTF-8 and the test failed to decode it (stdout was None). The test now also requires \N{FULL BLOCK}, so it always covers that output. Test-only; the scanner is unchanged. Fixes #844.

#704 and #531 also edit tests/rdna2_tools_check.py, but not test_cli_scanner.

Verification

Commit 68d849a on Windows 10 22H2 (build 19045, ANSI code page 1250), Python 3.13.7.

$env:PYTHONIOENCODING = '<value>'   # or PYTHONUTF8=1
python -B tests/rdna2_tools_check.py TestRdna2Scanner.test_cli_scanner
Caller environment Base (b358dc1) This change
PYTHONIOENCODING unset OK OK
PYTHONIOENCODING=utf-8 FAILED (errors=1) OK
PYTHONIOENCODING=utf-8:surrogateescape FAILED (errors=1) OK
PYTHONIOENCODING=cp1252 OK (ASCII bar) OK
PYTHONUTF8=1 OK OK
ctest --preset dev --no-tests=error -R '^rdna2_tools_check$'

100% passed, both with PYTHONIOENCODING=utf-8:surrogateescape and with it unset. The whole file runs 72 tests: OK (skipped=1) both ways; the skip is test_llvm_comparison (LLVM_LIB not set). Not run: Linux or macOS. There the locale is usually UTF-8 already, and the test now sets the child's encoding itself.

Evidence and follow-up

Synthetic assembly input already in the test; no new fixture. Negative control: the base fails both UTF-8 rows above. The other text=True calls in the file run disasm_rdna2.py and extract_shaders.py, which print only ASCII, so they are unchanged.

Checklist

  • This pull request covers one reviewable behavior.
  • I included the exact command and result for every check I ran.
  • I considered a negative control or failure case for a new fixture.
  • I updated README/docs when a capability or build requirement changed.
  • I did not include game files, dumps, distribution links or secrets.

AI-assisted: prepared with Claude Code; the commands and results above were run on the author's PC.

🤖 Generated with Claude Code

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6558843360 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/845). Originally posted by [lukaslw-lab](https://github.com/lukaslw-lab) on 2026-11-23T12:02:47Z. --- ## Change `test_cli_scanner` runs `tools/scan_unsupported_shaders.py` with `PYTHONIOENCODING=utf-8` and decodes its output as UTF-8, instead of `text=True` in the locale encoding. With `PYTHONIOENCODING=utf-8` on a non-UTF-8 Windows code page, the scanner printed its block progress bar as UTF-8 and the test failed to decode it (`stdout` was `None`). The test now also requires `\N{FULL BLOCK}`, so it always covers that output. Test-only; the scanner is unchanged. Fixes #844. #704 and #531 also edit `tests/rdna2_tools_check.py`, but not `test_cli_scanner`. ## Verification Commit `68d849a` on Windows 10 22H2 (build 19045, ANSI code page 1250), Python 3.13.7. $env:PYTHONIOENCODING = '<value>' # or PYTHONUTF8=1 python -B tests/rdna2_tools_check.py TestRdna2Scanner.test_cli_scanner | Caller environment | Base (`b358dc1`) | This change | |---|---|---| | `PYTHONIOENCODING` unset | OK | OK | | `PYTHONIOENCODING=utf-8` | `FAILED (errors=1)` | OK | | `PYTHONIOENCODING=utf-8:surrogateescape` | `FAILED (errors=1)` | OK | | `PYTHONIOENCODING=cp1252` | OK (ASCII bar) | OK | | `PYTHONUTF8=1` | OK | OK | ctest --preset dev --no-tests=error -R '^rdna2_tools_check$' 100% passed, both with `PYTHONIOENCODING=utf-8:surrogateescape` and with it unset. The whole file runs 72 tests: `OK (skipped=1)` both ways; the skip is `test_llvm_comparison` (`LLVM_LIB` not set). Not run: Linux or macOS. There the locale is usually UTF-8 already, and the test now sets the child's encoding itself. ## Evidence and follow-up Synthetic assembly input already in the test; no new fixture. Negative control: the base fails both UTF-8 rows above. The other `text=True` calls in the file run `disasm_rdna2.py` and `extract_shaders.py`, which print only ASCII, so they are unchanged. ## Checklist - [x] This pull request covers one reviewable behavior. - [x] I included the exact command and result for every check I ran. - [x] I considered a negative control or failure case for a new fixture. - [ ] I updated README/docs when a capability or build requirement changed. - [x] I did not include game files, dumps, distribution links or secrets. _AI-assisted: prepared with Claude Code; the commands and results above were run on the author's PC._ 🤖 Generated with [Claude Code](https://claude.com/claude-code)
upstream-sync closed this pull request 2026-11-24 06:45:03 +00:00
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
R0Y00/Xbox2Windows!839
No description provided.