test: spawn pipeline library host steps without a command shell #1466

Open
github-bot wants to merge 1 commit from github-bot/gh-1466 into main AGit
Owner

@⁠whoalin1 on GitHub · 2026-11-25 00:49 UTC · original
whoalin1:plh-crash-fix → main · +87 −9 · 1 files · 1 commits · open

Claimed in the coordination issue: #14

What

d3d12_pipeline_library_host_test ran each host step through _popen, which resolves the command shell via COMSPEC and a PATH search for cmd.exe — and the UCRT fast-fails the calling process (0xc0000409) when neither finds one. Shells with a stripped environment (agent shells, or ctest inheriting one without System32 on PATH) crashed the whole test at the first host step in ~0.7 s, while cmd.exe passed. GPU-independent; reproduced identically on RTX 4070 SUPER and AMD iGPU paths.

Repro: a 15-line _popen("whoami.exe","r") program crashes with 0xc0000409 under the stripped env; adding only ComSpec or only System32 to PATH each make it pass.

Fix: spawn the --host-step child with CreateProcessA + anonymous pipe (CreatePipe, STARTF_USESTDHANDLES, drain ReadFile until EOF, then WaitForSingleObject — correct order, no pipe deadlock). No shell is involved, so no environment can fast-fail the test. CREATE_NO_WINDOW included.

Spawn/infrastructure failures (CreatePipe/CreateProcessA/ReadFile/WaitForSingleObject) now return a kNoChild sentinel — the same pattern as d3d12_residency_test.cpp — that fails the comparison with GetLastError diagnostics, instead of the old kFaulted path that could have produced a vacuous 0 steps compared, 0 mismatches pass.

Tested

  • ctest -R d3d12_pipeline_library_host under the previously-crashing stripped env (no COMSPEC, PATH without System32): Passed, 10.85 s (was 0.74 s crash).
  • Normal env: Passed — 72 steps compared with the host (22 more not compared), 0 mismatches, identical to the cmd.exe baseline.
  • AMD Radeon iGPU env: Passed, 0 mismatches.
  • Forced spawn failure (exe renamed mid-run → CreateProcessA ERROR_FILE_NOT_FOUND): test correctly fails with GetLastError 2 diagnostics — not a vacuous pass.
  • Full build clean (Ninja, RelWithDebInfo).

AI-assisted (Devin).

**@⁠whoalin1** on GitHub · 2026-11-25 00:49 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1466) `whoalin1:plh-crash-fix` → `main` · +87 −9 · 1 files · 1 commits · open Claimed in the coordination issue: https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14 ## What `d3d12_pipeline_library_host_test` ran each host step through `_popen`, which resolves the command shell via `COMSPEC` and a PATH search for `cmd.exe` — and the UCRT **fast-fails the calling process (0xc0000409)** when neither finds one. Shells with a stripped environment (agent shells, or ctest inheriting one without `System32` on PATH) crashed the whole test at the first host step in ~0.7 s, while `cmd.exe` passed. GPU-independent; reproduced identically on RTX 4070 SUPER and AMD iGPU paths. Repro: a 15-line `_popen("whoami.exe","r")` program crashes with 0xc0000409 under the stripped env; adding only `ComSpec` **or** only `System32` to PATH each make it pass. Fix: spawn the `--host-step` child with `CreateProcessA` + anonymous pipe (`CreatePipe`, `STARTF_USESTDHANDLES`, drain `ReadFile` until EOF, then `WaitForSingleObject` — correct order, no pipe deadlock). No shell is involved, so no environment can fast-fail the test. `CREATE_NO_WINDOW` included. Spawn/infrastructure failures (CreatePipe/CreateProcessA/ReadFile/WaitForSingleObject) now return a `kNoChild` sentinel — the same pattern as `d3d12_residency_test.cpp` — that **fails** the comparison with `GetLastError` diagnostics, instead of the old `kFaulted` path that could have produced a vacuous `0 steps compared, 0 mismatches` pass. ## Tested - `ctest -R d3d12_pipeline_library_host` under the previously-crashing stripped env (no COMSPEC, PATH without System32): **Passed, 10.85 s** (was 0.74 s crash). - Normal env: Passed — `72 steps compared with the host (22 more not compared), 0 mismatches`, identical to the cmd.exe baseline. - AMD Radeon iGPU env: Passed, 0 mismatches. - Forced spawn failure (exe renamed mid-run → CreateProcessA ERROR_FILE_NOT_FOUND): test correctly **fails** with `GetLastError 2` diagnostics — not a vacuous pass. - Full build clean (Ninja, RelWithDebInfo). AI-assisted (Devin).
d3d12_pipeline_library_host_test ran each host step through _popen, which
resolves the command shell via COMSPEC and a PATH search for cmd.exe and
fast-fails the process (0xc0000409) when neither finds one. Shells with a
stripped environment (agent shells, ctest inheriting them) crashed the
whole test at the first host step while cmd.exe passed.

Spawn the --host-step child with CreateProcessA and a pipe instead, so no
shell is involved. Spawn and I/O failures return a kNoChild sentinel (as
in d3d12_residency_test.cpp) that fails the comparison instead of being
skipped as a host fault, and print the GetLastError diagnostic.

Co-Authored-By: Devin <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:52:30 +00:00
Author
Owner

@⁠Gefik23 on GitHub · 2026-11-25 07:04 UTC · original

Tested 22b5ca682 on NVIDIA GeForce RTX 4060, driver 617.42, AMD Ryzen 5 7500F, Windows 11 Pro build 26200, native Windows: pass.

Built at this head with scripts\build_runtime.ps1 (MSVC 19.44, VS 2022 Build Tools, Ninja, RelWithDebInfo, Windows SDK 10.0.26100, Vulkan SDK 1.4.363.0).

  • ctest -R pipeline_library_host -V: passed in 10.48 s, "72 steps compared with the host (22 more not compared), 0 mismatches". Normal environment only; the stripped-environment case (no COMSPEC, PATH without System32) was not reproduced here.
  • Full ctest -C RelWithDebInfo: 308/308 passed (game-data tests skipped, LEONIDA_GAME_DIR unset).

AI-assisted (Claude Code ran the build and tests). No game files.

**@⁠Gefik23** on GitHub · 2026-11-25 07:04 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1466#issuecomment-7155455974) Tested 22b5ca682 on NVIDIA GeForce RTX 4060, driver 617.42, AMD Ryzen 5 7500F, Windows 11 Pro build 26200, native Windows: pass. Built at this head with `scripts\build_runtime.ps1` (MSVC 19.44, VS 2022 Build Tools, Ninja, RelWithDebInfo, Windows SDK 10.0.26100, Vulkan SDK 1.4.363.0). - `ctest -R pipeline_library_host -V`: passed in 10.48 s, "72 steps compared with the host (22 more not compared), 0 mismatches". Normal environment only; the stripped-environment case (no COMSPEC, PATH without System32) was not reproduced here. - Full `ctest -C RelWithDebInfo`: 308/308 passed (game-data tests skipped, LEONIDA_GAME_DIR unset). AI-assisted (Claude Code ran the build and tests). No game files.
Author
Owner

@⁠whoalin1 on GitHub · 2026-11-25 20:07 UTC · original

Rebased cleanly onto current main (db1a22d29) as cf728055f to refresh the stale CI baseline; no conflicts. The branch remains the pipeline-library-host CreateProcess fix. AI-assisted with Devin.

**@⁠whoalin1** on GitHub · 2026-11-25 20:07 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1466#issuecomment-7173224004) Rebased cleanly onto current main (`db1a22d29`) as `cf728055f` to refresh the stale CI baseline; no conflicts. The branch remains the pipeline-library-host CreateProcess fix. AI-assisted with Devin.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1466/head:github-bot/gh-1466'
git switch 'github-bot/gh-1466'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1466'
git switch 'github-bot/gh-1466'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1466'
git switch 'github-bot/gh-1466'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1466'
git switch 'main'
git merge --squash 'github-bot/gh-1466'
git switch 'main'
git merge --ff-only 'github-bot/gh-1466'
git switch 'main'
git merge 'github-bot/gh-1466'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.