Skip to content

Handle non-UTF-8 program output in the native case runner - #743

Merged
LunaStev merged 1 commit into
wavefnd:masterfrom
amandeavor:fix/711-non-utf8-program-output
Sep 25, 2026
Merged

LunaStev merged 1 commit into
wavefnd:masterfrom
amandeavor:fix/711-non-utf8-program-output

Conversation

@amandeavor

Copy link
Copy Markdown
Contributor

Summary

Fixes #711.

The native case runner captured subprocess stdout/stderr with text=True and the default strict UTF-8 decoder. A program that wrote arbitrary bytes (for example 0xff) raised UnicodeDecodeError and aborted the suite before the JSON report was written.

This change:

  • Defaults captured process text decoding to errors="replace" in ProcessTree (callers can still request strict decoding explicitly).
  • Passes errors="replace" at the native runner capture sites in tools/run_tests.py, matching the existing QEMU/WASM runtime reporter.
  • Leaves source and manifest input decoding strict.
  • Keeps bounded failure diagnostics (failure_detail truncation) UTF-8-safe for report generation.
  • Preserves ordinary UTF-8 output and nonzero-exit / artifact classification.

Test plan

  • Reproduced the issue repro from Handle non-UTF-8 program output in the native case runner #711 (stdout and stderr); both now classify as PASS without raising.
  • PYTHONPATH=. python3 -m unittest tools.test_run_tests tools.test_process_tree
  • New coverage for binary stdout/stderr, nonzero exit with binary diagnostics, and ordinary UTF-8 preservation.

Define a replacement decoding policy for captured process text so binary
stdout/stderr (for example byte 0xff) cannot raise UnicodeDecodeError and
abort the suite before report generation. Keep source and manifest decoding
strict, preserve ordinary UTF-8, and retain bounded failure diagnostics.

Closes wavefnd#711

Signed-off-by: Aman Awasthi <[email protected]>
Copilot AI lite review requested due to automatic review settings September 25, 2026 08:00

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@LunaStev LunaStev left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM thanks

@LunaStev
LunaStev merged commit bf3484d into wavefnd:master Sep 25, 2026
25 checks passed
@LunaStev LunaStev mentioned this pull request Sep 30, 2026
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.

Handle non-UTF-8 program output in the native case runner

3 participants