tests: check the launch tool's containment on a source-built probe #1254

Merged
triggered02 merged 2 commits from upstream-pr/1261 into main 2026-11-24 06:21:16 +00:00
triggered02 commented 2026-11-24 05:56:51 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-11-24T05:56:51Z.


Change

tools/startup/launch.py runs one executable in a kill-on-close job with a timeout, a commit cap and captured stdout/stderr, but no source-built control read any of that back (#1149 asks for checks over tools/startup/). This adds one, with no GPU and no game files:

  • tests/startup_launch_probe.cpp — the only executable the check needs. Modes: report a known exit code while writing known bytes to stdout, stderr and X2W_TRAP_LOG; sleep so the timeout has to kill it; ask for more memory than the job cap allows; start a helper process; or do nothing.
  • tests/startup_launch_check.py (ctest startup_launch) — drives launch.py through each case:
    • finished run: exit code 0x00000007 in the report, and stdout.txt, stderr.txt and trap.log hold exactly the probe's bytes;
    • timeout: a 30 s child under --timeout 1 is reported as killed after 1 s timeout with exit code 0xdead0001, and the launcher returns in under 20 s;
    • commit cap: the same 1 GiB request fails under --memory-gib 0.5 (error=1455) and succeeds under --memory-gib 4 (allocate ok 1024 MiB);
    • process limit: the same helper is blocked under --max-processes 1 (error=1816) and starts under --max-processes 2;
    • a missing executable is reported as CreateProcess failed: error ... with launcher exit code 2 instead of looking like a finished run.
  • CMakePresets.json: the pr build preset builds startup_launch_probe and the pr test filter includes startup_launch, so the Windows jobs run it on pull requests. Main-branch runs pick it up with the rest of the suite.
  • docs/startup-runtime.md: a short "Launcher check" section with the ctest command.

Verification

Release configuration (MSVC 19.52, Windows 11, Ninja):

cmake --preset release
cmake --build --preset release --target startup_launch_probe
ctest --preset release --no-tests=error -R '^startup_launch$' -V
217: launch: exit code, stdout/stderr/trap capture, 1 s timeout kill, 0.5 GiB commit cap (and its 4 GiB control),
     1-process limit (and its 2-process control) and the missing-EXE path passed
1/1 Test #217: startup_launch ...   Passed    1.76 sec

Measured controls (the limits, not the request, are what the check measures):

case result
--memory-gib 0.5, allocate 1 GiB allocate failed error=1455
--memory-gib 4, allocate 1 GiB allocate ok 1024 MiB
--max-processes 1, spawn helper spawn failed error=1816
--max-processes 2, spawn helper spawn ok
missing executable CreateProcess failed: error 2, launcher exit 2

Negative controls: with the job memory and active-process limit flags removed from launch.py, the check fails at the commit-cap assertion with AssertionError: allocate ok 1024 MiB; with X2W_TRAP_LOG removed from the child environment it fails at the trap-log assertion with AssertionError: None. Both edits were reverted.

Neighbouring startup tests still pass: startup_draw_bmp (0.04 s) and startup_plane_refresh_warp / startup_plane_refresh_hardware.

I did not touch tools/startup/gfx2hlsl.py, tools/startup/debug_launch.py or src/startup_stubs/d3d12_xs_device.cpp. No game files, dumps or logs are involved; the probe and its output are source-built.

AI-assisted (Claude Code).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6575642736 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1261). Originally posted by [triggered02](https://github.com/triggered02) on 2026-11-24T05:56:51Z. --- ## Change `tools/startup/launch.py` runs one executable in a kill-on-close job with a timeout, a commit cap and captured stdout/stderr, but no source-built control read any of that back (#1149 asks for checks over `tools/startup/`). This adds one, with no GPU and no game files: - `tests/startup_launch_probe.cpp` — the only executable the check needs. Modes: report a known exit code while writing known bytes to stdout, stderr and `X2W_TRAP_LOG`; sleep so the timeout has to kill it; ask for more memory than the job cap allows; start a helper process; or do nothing. - `tests/startup_launch_check.py` (ctest `startup_launch`) — drives `launch.py` through each case: - finished run: `exit code 0x00000007` in the report, and `stdout.txt`, `stderr.txt` and `trap.log` hold exactly the probe's bytes; - timeout: a 30 s child under `--timeout 1` is reported as `killed after 1 s timeout` with `exit code 0xdead0001`, and the launcher returns in under 20 s; - commit cap: the same 1 GiB request fails under `--memory-gib 0.5` (`error=1455`) and succeeds under `--memory-gib 4` (`allocate ok 1024 MiB`); - process limit: the same helper is blocked under `--max-processes 1` (`error=1816`) and starts under `--max-processes 2`; - a missing executable is reported as `CreateProcess failed: error ...` with launcher exit code 2 instead of looking like a finished run. - `CMakePresets.json`: the `pr` build preset builds `startup_launch_probe` and the `pr` test filter includes `startup_launch`, so the Windows jobs run it on pull requests. Main-branch runs pick it up with the rest of the suite. - `docs/startup-runtime.md`: a short "Launcher check" section with the ctest command. ## Verification Release configuration (MSVC 19.52, Windows 11, Ninja): ```powershell cmake --preset release cmake --build --preset release --target startup_launch_probe ctest --preset release --no-tests=error -R '^startup_launch$' -V ``` ``` 217: launch: exit code, stdout/stderr/trap capture, 1 s timeout kill, 0.5 GiB commit cap (and its 4 GiB control), 1-process limit (and its 2-process control) and the missing-EXE path passed 1/1 Test #217: startup_launch ... Passed 1.76 sec ``` Measured controls (the limits, not the request, are what the check measures): | case | result | |---|---| | `--memory-gib 0.5`, allocate 1 GiB | `allocate failed error=1455` | | `--memory-gib 4`, allocate 1 GiB | `allocate ok 1024 MiB` | | `--max-processes 1`, spawn helper | `spawn failed error=1816` | | `--max-processes 2`, spawn helper | `spawn ok` | | missing executable | `CreateProcess failed: error 2`, launcher exit 2 | Negative controls: with the job memory and active-process limit flags removed from `launch.py`, the check fails at the commit-cap assertion with `AssertionError: allocate ok 1024 MiB`; with `X2W_TRAP_LOG` removed from the child environment it fails at the trap-log assertion with `AssertionError: None`. Both edits were reverted. Neighbouring startup tests still pass: `startup_draw_bmp` (0.04 s) and `startup_plane_refresh_warp` / `startup_plane_refresh_hardware`. I did not touch `tools/startup/gfx2hlsl.py`, `tools/startup/debug_launch.py` or `src/startup_stubs/d3d12_xs_device.cpp`. No game files, dumps or logs are involved; the probe and its output are source-built. AI-assisted (Claude Code).
upstream-sync closed this pull request 2026-11-24 06:47:23 +00:00
chatgpt-codex-connector[bot commented 2026-11-24 06:47:24 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T06:00:17Z.

Review: COMMENTED


💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7b9d561c8a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6034416986 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1261#pullrequestreview-6034416986). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-24T06:00:17Z. **Review:** COMMENTED --- <!-- codex-review-receipt:v1 --> ### 💡 Codex Review Here are some automated review suggestions for this pull request. **Reviewed commit:** `7b9d561c8a` <details> <summary>ℹ️ About Codex in GitHub</summary> <br/> [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". </details>
triggered02 commented 2026-11-24 06:47:24 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-11-24T06:02:15Z.

Review: COMMENTED


No description provided.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6034433806 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1261#pullrequestreview-6034433806). Originally posted by [triggered02](https://github.com/triggered02) on 2026-11-24T06:02:15Z. **Review:** COMMENTED --- _No description provided._
tedin7 commented 2026-11-24 06:47:24 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T06:05:17Z.

Review: COMMENTED


Dual-platform peer review at 9d05702e6a7a232c120538610a7c12506aa73894:

Checks

  • Linux (x2w-rev-venv):
    • git diff --check HEAD~1..HEAD — passed
    • python -B tests/docs_links_check.py — passed (16 Markdown files, 281 links)
    • python -B tests/bidi_controls_check.py — passed (1057 tracked files)
    • python -B -m py_compile tests/startup_launch_check.py — passed
  • Windows Server 2025 (MSVC 14.44):
    • Target: startup_launch_probe
    • ctest --preset dev --no-tests=error -R '^startup_launch$': 1/1 passed (startup_launch, 2.80 s)
    • ctest --preset release --no-tests=error -R '^startup_launch$': 1/1 passed (startup_launch, 1.90 s)

Review Notes

  • tests/startup_launch_probe.cpp and tests/startup_launch_check.py form a self-contained, source-built fixture covering all five containment behaviors in tools/startup/launch.py: exit code + stdout.txt/stderr.txt/trap.log capture, 1 s timeout termination (0xdead0001), 0.5 GiB commit cap vs. 4 GiB control, 1-process limit vs. 2-process control, and missing-executable error reporting (exit code 2).
  • The update to wide-character APIs (_wgetenv, _wfopen, GetModuleFileNameW, CreateProcessW) in tests/startup_launch_probe.cpp ensures Unicode paths from launch.py and temp/build directories work reliably.
  • Minor note (non-blocking): tests/startup_launch_check.py and tests/startup_launch_probe.cpp are missing a trailing newline at EOF.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6034464477 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1261#pullrequestreview-6034464477). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T06:05:17Z. **Review:** COMMENTED --- Dual-platform peer review at `9d05702e6a7a232c120538610a7c12506aa73894`: ### Checks - **Linux (`x2w-rev-venv`)**: - `git diff --check HEAD~1..HEAD` — passed - `python -B tests/docs_links_check.py` — passed (16 Markdown files, 281 links) - `python -B tests/bidi_controls_check.py` — passed (1057 tracked files) - `python -B -m py_compile tests/startup_launch_check.py` — passed - **Windows Server 2025 (MSVC 14.44)**: - Target: `startup_launch_probe` - `ctest --preset dev --no-tests=error -R '^startup_launch$'`: **1/1 passed** (`startup_launch`, 2.80 s) - `ctest --preset release --no-tests=error -R '^startup_launch$'`: **1/1 passed** (`startup_launch`, 1.90 s) ### Review Notes - `tests/startup_launch_probe.cpp` and `tests/startup_launch_check.py` form a self-contained, source-built fixture covering all five containment behaviors in `tools/startup/launch.py`: exit code + `stdout.txt`/`stderr.txt`/`trap.log` capture, 1 s timeout termination (`0xdead0001`), 0.5 GiB commit cap vs. 4 GiB control, 1-process limit vs. 2-process control, and missing-executable error reporting (exit code 2). - The update to wide-character APIs (`_wgetenv`, `_wfopen`, `GetModuleFileNameW`, `CreateProcessW`) in `tests/startup_launch_probe.cpp` ensures Unicode paths from `launch.py` and temp/build directories work reliably. - Minor note (non-blocking): `tests/startup_launch_check.py` and `tests/startup_launch_probe.cpp` are missing a trailing newline at EOF.
triggered02 commented 2026-11-24 06:50:29 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-11-24T05:59:34Z.


The pull-request Windows job ran it: run 45336851507 built startup_launch_probe ([158/169] linking) and ran 7/23 Test #217: startup_launch ... Passed 1.63 sec. The whole pr suite passed, so the pr preset wiring does put the test in front of every pull request.

AI-assisted (Claude Code).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7123467626 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1261#issuecomment-7123467626). Originally posted by [triggered02](https://github.com/triggered02) on 2026-11-24T05:59:34Z. --- The pull-request Windows job ran it: [run 45336851507](https://github.com/R0Y00/Xbox2Windows/actions/runs/45336851507/job/138250852226) built `startup_launch_probe` ([158/169] linking) and ran `7/23 Test #217: startup_launch ... Passed 1.63 sec`. The whole `pr` suite passed, so the `pr` preset wiring does put the test in front of every pull request. AI-assisted (Claude Code).
chatgpt-codex-connector[bot commented 2026-11-24 06:50:29 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T05:57:02Z.


Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-24T06:00:20.131661Z 7b9d561 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7123428393 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1261#issuecomment-7123428393). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-24T05:57:02Z. --- <!-- codex-pull-request-review-summary --> <!-- codex-review-state:v1 {"code_review":{"commit_sha":"7b9d561c8abafed512974f1caac25e99fd603e5b","has_any_findings":true,"has_unresolved_findings":true,"status":"completed"},"security_review":{"commit_sha":null,"has_any_findings":null,"has_unresolved_findings":null,"status":null}} --> <details> <summary><strong>Codex Review Summary</strong>: ✅ Completed</summary> This comment shows the latest Codex review activity on this pull request. | Review | Status | Commit | Review trigger | | --- | --- | --- | --- | | 📝 **Code Review** | ✅ **Completed** <relative-time datetime="2026-11-24T06:00:20.131661Z">2026-11-24T06:00:20.131661Z</relative-time> | `7b9d561` | PR opened | <details> <summary>ℹ️ About Codex in GitHub</summary> <br/> [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@codex review" or "@codex security review". Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. </details> </details>
triggered02 commented 2026-11-24 06:50:30 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-11-24T06:04:55Z.


The Codex P2 finding is addressed in 9d05702e and the thread is resolved: the probe now reads X2W_TRAP_LOG with _wgetenv, opens it with _wfopen, takes its module path with GetModuleFileNameW and starts the helper with CreateProcessW on a UTF-16 command line, with the printed lines unchanged. Only ests/startup_launch_probe.cpp changed.

Local release run after the change: 1/1 Test #217: startup_launch ... Passed 1.89 sec. The pull-request Windows job rebuilt the probe at this head and ran 7/23 Test #222: startup_launch ... Passed 1.45 sec (run 45337467187); the whole job passed.

AI-assisted (Claude Code).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7123562299 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1261#issuecomment-7123562299). Originally posted by [triggered02](https://github.com/triggered02) on 2026-11-24T06:04:55Z. --- The Codex P2 finding is addressed in 9d05702e and the thread is resolved: the probe now reads X2W_TRAP_LOG with _wgetenv, opens it with _wfopen, takes its module path with GetModuleFileNameW and starts the helper with CreateProcessW on a UTF-16 command line, with the printed lines unchanged. Only ests/startup_launch_probe.cpp changed. Local release run after the change: 1/1 Test #217: startup_launch ... Passed 1.89 sec. The pull-request Windows job rebuilt the probe at this head and ran 7/23 Test #222: startup_launch ... Passed 1.45 sec ([run 45337467187](https://github.com/R0Y00/Xbox2Windows/actions/runs/45337467187/job/138252834530)); the whole job passed. AI-assisted (Claude Code).
chatgpt-codex-connector[bot commented 2026-11-24 06:50:45 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T06:00:17Z.

Code review location: tests/startup_launch_probe.cpp; line 22

@@ -0,0 +1,81 @@
+// Input for the launch tool's containment check (docs/startup-runtime.md). The launcher runs one
+// executable in a kill-on-close job with a timeout, a commit cap and captured stdout/stderr, and
+// this fixture is the only executable the check needs: it writes known bytes to both streams and
+// the trap log, reports a known exit code, or holds memory, spawns a child or stays alive so the
+// job limits have to stop it.
+#include <windows.h>
+
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
+
+namespace {
+void stream(FILE* out, const char* text)
+{
+    std::fputs(text, out);
+    std::fflush(out);
+}
+
+void write_trap_log(const char* text)
+{
+    char path[MAX_PATH]{};
+    if (!GetEnvironmentVariableA("X2W_TRAP_LOG", path, MAX_PATH)) return;

P2 Badge Preserve Unicode paths in the launcher probe

On a Windows host whose temp or build path contains characters outside the active ANSI code page, launch.py passes a Unicode X2W_TRAP_LOG path, but this ANSI API and the following fopen can turn it into an unusable path, causing the trap-log assertion in startup_launch_check.py to fail; GetModuleFileNameA/CreateProcessA can likewise break the spawn control for a Unicode build path. Use wide-character path APIs throughout the fixture.

Useful? React with 👍 / 👎.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review-comment:4676108743 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1261#discussion_r4676108743). Originally posted by [chatgpt-codex-connector[bot]](https://github.com/chatgpt-codex-connector%5Bbot%5D) on 2026-11-24T06:00:17Z. **Code review location:** `tests/startup_launch_probe.cpp`; line 22 ~~~~diff @@ -0,0 +1,81 @@ +// Input for the launch tool's containment check (docs/startup-runtime.md). The launcher runs one +// executable in a kill-on-close job with a timeout, a commit cap and captured stdout/stderr, and +// this fixture is the only executable the check needs: it writes known bytes to both streams and +// the trap log, reports a known exit code, or holds memory, spawns a child or stays alive so the +// job limits have to stop it. +#include <windows.h> + +#include <cstdio> +#include <cstdlib> +#include <cstring> + +namespace { +void stream(FILE* out, const char* text) +{ + std::fputs(text, out); + std::fflush(out); +} + +void write_trap_log(const char* text) +{ + char path[MAX_PATH]{}; + if (!GetEnvironmentVariableA("X2W_TRAP_LOG", path, MAX_PATH)) return; ~~~~ --- **<sub><sub>![P2 Badge](https://img.shields.io/badge/P2-yellow?style=flat)</sub></sub> Preserve Unicode paths in the launcher probe** On a Windows host whose temp or build path contains characters outside the active ANSI code page, `launch.py` passes a Unicode `X2W_TRAP_LOG` path, but this ANSI API and the following `fopen` can turn it into an unusable path, causing the trap-log assertion in `startup_launch_check.py` to fail; `GetModuleFileNameA`/`CreateProcessA` can likewise break the spawn control for a Unicode build path. Use wide-character path APIs throughout the fixture. Useful? React with 👍 / 👎. <!-- codex-code-review-finding:v1 -->
triggered02 commented 2026-11-24 06:50:45 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-11-24T06:02:15Z.

Code review location: tests/startup_launch_probe.cpp; line 22

@@ -0,0 +1,81 @@
+// Input for the launch tool's containment check (docs/startup-runtime.md). The launcher runs one
+// executable in a kill-on-close job with a timeout, a commit cap and captured stdout/stderr, and
+// this fixture is the only executable the check needs: it writes known bytes to both streams and
+// the trap log, reports a known exit code, or holds memory, spawns a child or stays alive so the
+// job limits have to stop it.
+#include <windows.h>
+
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
+
+namespace {
+void stream(FILE* out, const char* text)
+{
+    std::fputs(text, out);
+    std::fflush(out);
+}
+
+void write_trap_log(const char* text)
+{
+    char path[MAX_PATH]{};
+    if (!GetEnvironmentVariableA("X2W_TRAP_LOG", path, MAX_PATH)) return;

Fixed in 9d05702e. The fixture now reads X2W_TRAP_LOG with _wgetenv and opens it with _wfopen, takes its module path with GetModuleFileNameW, and starts the helper with CreateProcessW on a UTF-16 command line. The printed lines are unchanged, so startup_launch_check.py reads the same output.

Measured on Windows 11 with ANSI code page 1252, TEMP under an out folder whose name contains characters outside that code page:

  • before: AssertionError: None at the trap-log assertion;
  • after: the whole check passes, including the spawn control run from a probe copied to a path with those characters;
  • ctest --preset release --no-tests=error -R '^startup_launch$' -V: 1/1 Test #217: startup_launch ... Passed 1.89 sec.

Only tests/startup_launch_probe.cpp changed; tools/startup/launch.py and the other launcher files are untouched.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review-comment:4676121433 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1261#discussion_r4676121433). Originally posted by [triggered02](https://github.com/triggered02) on 2026-11-24T06:02:15Z. **Code review location:** `tests/startup_launch_probe.cpp`; line 22 ~~~~diff @@ -0,0 +1,81 @@ +// Input for the launch tool's containment check (docs/startup-runtime.md). The launcher runs one +// executable in a kill-on-close job with a timeout, a commit cap and captured stdout/stderr, and +// this fixture is the only executable the check needs: it writes known bytes to both streams and +// the trap log, reports a known exit code, or holds memory, spawns a child or stays alive so the +// job limits have to stop it. +#include <windows.h> + +#include <cstdio> +#include <cstdlib> +#include <cstring> + +namespace { +void stream(FILE* out, const char* text) +{ + std::fputs(text, out); + std::fflush(out); +} + +void write_trap_log(const char* text) +{ + char path[MAX_PATH]{}; + if (!GetEnvironmentVariableA("X2W_TRAP_LOG", path, MAX_PATH)) return; ~~~~ --- Fixed in 9d05702e. The fixture now reads `X2W_TRAP_LOG` with `_wgetenv` and opens it with `_wfopen`, takes its module path with `GetModuleFileNameW`, and starts the helper with `CreateProcessW` on a UTF-16 command line. The printed lines are unchanged, so `startup_launch_check.py` reads the same output. Measured on Windows 11 with ANSI code page 1252, `TEMP` under an `out` folder whose name contains characters outside that code page: - before: `AssertionError: None` at the trap-log assertion; - after: the whole check passes, including the spawn control run from a probe copied to a path with those characters; - `ctest --preset release --no-tests=error -R '^startup_launch$' -V`: `1/1 Test #217: startup_launch ... Passed 1.89 sec`. Only `tests/startup_launch_probe.cpp` changed; `tools/startup/launch.py` and the other launcher files are untouched.
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!1254
No description provided.