Commit Graph

3 Commits

Author SHA1 Message Date
4ab5fdc5de tests: two Windows reds on main's check job (CI-MAIN-WINDOWS-TESTS)
test_gen_gdk_runtime_classes imported the POSIX-only resource module at the top, so the whole file failed to import on Windows. Import it guarded and skip the two failed-write tests that need RLIMIT_FSIZE.

test_make_game_plain_logs compared the child's getcwd() with the temp folder as strings; on the Windows runner the temp folder is an 8.3 short name (RUNNER~1) and getcwd() returns the long one. Compare with os.path.samefile.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 20:17:28 +01:00
48ca87fa24 make_game: the plain stage logs show a command's output as decoded text, in the caller's encoding (MAKE-GAME-PLAIN-LOG)
PlainStageLogs passed a command's raw bytes to sys.stdout.buffer. A Windows console's buffer takes UTF-8, so
non-ASCII text a command wrote in its own code page showed U+FFFD on screen, where main's --no-tui (the command
inheriting the console) shows it right. Measured in a console with OEM 850 / ANSI 1252: a child writing cp850
"n\xc6o par\x83metro" showed "n\ufffdo par\ufffdmetro".

- run() decodes the output once as it arrives (an incremental decoder, so a character split between two reads
  stays whole) and sends that text to the console, encoded for sys.stdout with errors="replace", and to the log;
- the encoding is the one the caller names with run(..., encoding=), else what a text-mode pipe decodes with, as
  on the board.

Three new tests: the caller's encoding on the console and in the log, a UTF-8 character split between reads, and
a character the console's code page lacks.
2026-11-29 11:23:16 -03:00
24d89be173 make_game: a run without the LEONIDA board still writes <work>/logs/<stage>.log (MAKE-GAME-PLAIN-LOG)
Only the board wrote the stage logs, so a build with --no-tui (or with stdout redirected) left nothing in
<work>/logs to read afterwards. PlainStageLogs now covers that case while the build stages run:

- log() and fail() lines go to the console as before and to the running stage's log;
- a command run() starts for a build stage has its stdout and stderr through one pipe: every byte goes on to
  the console as it arrives (a \r progress line still redraws) and every \r- or \n-ended piece to the stage's
  log, the same split the board uses. The child keeps the console, so Ctrl+C reaches it as before; on Ctrl+C it
  gets 0.25 s to stop and is then killed, as subprocess.run does;
- a caller that sets its own pipes, and commands outside a build stage, keep subprocess.run;
- a stage's file is opened with its first line; an unwritable folder gives one note on stderr and the build
  goes on without the logs.

The module docstring and the --no-tui help say where the logs are in both modes.
tests/test_make_game_plain_logs.py covers the cases above with real child processes.
2026-11-29 10:16:57 -03:00