tests: derive every test's scratch folder from test_temp_dir::temp_dir, not GetTempPath (TEST-TEMPDIR-STRIPPED-ENV) #1600

Merged
thiefyzheng merged 1 commit from upstream-pr/1600 into main 2026-11-29 12:44:40 +00:00
thiefyzheng commented 2026-11-25 05:33:30 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by thiefyzheng on 2026-11-25T05:33:30Z.


What

One entry added to runtime/test/test_temp_dir.h — testfiles::temp_dir(): LEONIDA_TEST_DIR when set, else the current directory when the temp environment is stripped (TMP, TEMP and USERPROFILE all unset on Windows), else the standard temp resolution. 52 test files and the tiny_game fixture that called GetTempPathA/GetTempPathW/temp_directory_path directly now use it, and d3d12_queue_handover_test.cpp's capture_stderr checks its _sopen_s result instead of silently returning empty stderr. One runtime source function needed the same fallback because tests exercise it: tls_host_clone_dir in runtime/src/pe_loader.cpp (the loader_tls* tests) — the only non-test change in this PR, called out deliberately.

Claimed as TEST-TEMPDIR-STRIPPED-ENV on #14 (the finding is @whoalin1's, 02:37:44Z).

Why

With TMP/TEMP/USERPROFILE unset, GetTempPathW returns C:\Windows\, and the throwing create_directories/copy_file/ofstream on C:\Windows\leonida_* aborts with 0xc0000409 before the test body runs — the ~20 d3d12_* sites of the finding plus the further direct users found by enumerating ("d3d12_mesh/bindless_churn/conservative_raster(+tier2/tier3)/depth24_draw/depth_resolve/execute_indirect_validation/f16_halves/geometry/indirect_dispatch_count/multi_viewport/shader_cache/state_sweep/stores_atomics/present/queue_handover/existing_heap + bink_audio/bink_decode/device_proxy/dstorage/file_system/int3_skip/kernel_writes/large_module_gate_loader(4)/module_names/pe_loader(fuzz/test/bounds)/pipeline_cache(file/seed)/shader_fixture_path/startup_trace/title_write_watch/unimplemented_policy/xbox_present/xdxr_build_output/xgameruntime(gamesave/test/user)/xmem + fixtures/tiny_game"). The helper used by 15 test files already existed; this PR is the mechanical consolidation the finding asked for.

What I ran (Windows 11 VM, VS build of every affected target, original head)

  • Stripped environment (TMP/TEMP/USERPROFILE unset): the previously crashing d3d12 tests now exit 77 ("no usable Vulkan device" — this VM has no GPU, which is a graceful outcome where the abort used to happen first); file_system_test runs all 505 checks, 0 failures; loader_test all 95 checks, 0 failed; xgameruntime_test exit 0. No 0xc0000409 anywhere in any run.
  • Normal environment: identical outcomes (505/0, 95/0, same exit codes) — no behavior change when the environment is intact.
  • LEONIDA_TEST_DIR honored: set to C:\work\tdir under a fully stripped environment, the process's leonida_file_system_<pid> scratch folder was captured mid-run inside it and cleaned up after the 505-check pass.
  • The pre-change crash shape is the finding's ("before-shape: not reproduced locally" — a full pristine second build was not spent reproducing a documented abort; every post-fix run proves the temp stage now completes).

Rebased-head verification (b17397f0dd)

  • Rebased onto main 54d27d9883; resolved int3_skip_test.cpp, kernel_writes_test.cpp and xmem_test.cpp while preserving their new upstream cases. Carried the same conversion into seven test files added since the original head.
  • Portable CMake build of pipeline_order_test and pipeline_cache_journal_test succeeded; both ctest entries pass.
  • scripts/check_no_game_data.py, python -m compileall -q make_game.py tools tests, and git diff --check are clean.
  • The full Windows/GPU matrix above was not rerun on this host after the rebase. The separate per-run scratch fix in vk_aftermath_test.cpp remains scoped to #1864.
  • Synthetic fixtures only; no game data.

AI-assisted: a pi coding agent operated by the repo contributor ran the enumeration, the original Windows build and the three verification phases, and the rebased-head checks above; the finding is @whoalin1's.

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5485786414 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1600). Originally posted by [thiefyzheng](https://github.com/thiefyzheng) on 2026-11-25T05:33:30Z. --- ## What One entry added to `runtime/test/test_temp_dir.h` — `testfiles::temp_dir()`: `LEONIDA_TEST_DIR` when set, else the current directory when the temp environment is stripped (TMP, TEMP and USERPROFILE all unset on Windows), else the standard temp resolution. **52 test files and the `tiny_game` fixture** that called `GetTempPathA`/`GetTempPathW`/`temp_directory_path` directly now use it, and `d3d12_queue_handover_test.cpp`'s `capture_stderr` checks its `_sopen_s` result instead of silently returning empty stderr. **One runtime source function** needed the same fallback because tests exercise it: `tls_host_clone_dir` in `runtime/src/pe_loader.cpp` (the `loader_tls*` tests) — the only non-test change in this PR, called out deliberately. Claimed as **TEST-TEMPDIR-STRIPPED-ENV** on #14 (the finding is @whoalin1's, 02:37:44Z). ## Why With TMP/TEMP/USERPROFILE unset, `GetTempPathW` returns `C:\Windows\`, and the throwing `create_directories`/`copy_file`/`ofstream` on `C:\Windows\leonida_*` aborts with 0xc0000409 before the test body runs — the ~20 `d3d12_*` sites of the finding plus the further direct users found by enumerating ("d3d12_mesh/bindless_churn/conservative_raster(+tier2/tier3)/depth24_draw/depth_resolve/execute_indirect_validation/f16_halves/geometry/indirect_dispatch_count/multi_viewport/shader_cache/state_sweep/stores_atomics/present/queue_handover/existing_heap + bink_audio/bink_decode/device_proxy/dstorage/file_system/int3_skip/kernel_writes/large_module_gate_loader(4)/module_names/pe_loader(fuzz/test/bounds)/pipeline_cache(file/seed)/shader_fixture_path/startup_trace/title_write_watch/unimplemented_policy/xbox_present/xdxr_build_output/xgameruntime(gamesave/test/user)/xmem + fixtures/tiny_game"). The helper used by 15 test files already existed; this PR is the mechanical consolidation the finding asked for. ## What I ran (Windows 11 VM, VS build of every affected target, original head) - **Stripped environment** (TMP/TEMP/USERPROFILE unset): the previously crashing d3d12 tests now exit 77 ("no usable Vulkan device" — this VM has no GPU, which is a graceful outcome where the abort used to happen first); `file_system_test` runs all **505 checks, 0 failures**; `loader_test` all **95 checks, 0 failed**; `xgameruntime_test` exit 0. No 0xc0000409 anywhere in any run. - **Normal environment**: identical outcomes (505/0, 95/0, same exit codes) — no behavior change when the environment is intact. - **LEONIDA_TEST_DIR honored**: set to `C:\work\tdir` under a fully stripped environment, the process's `leonida_file_system_<pid>` scratch folder was captured mid-run inside it and cleaned up after the 505-check pass. - The pre-change crash shape is the finding's ("before-shape: not reproduced locally" — a full pristine second build was not spent reproducing a documented abort; every post-fix run proves the temp stage now completes). ## Rebased-head verification (`b17397f0dd`) - Rebased onto `main` `54d27d9883`; resolved `int3_skip_test.cpp`, `kernel_writes_test.cpp` and `xmem_test.cpp` while preserving their new upstream cases. Carried the same conversion into seven test files added since the original head. - Portable CMake build of `pipeline_order_test` and `pipeline_cache_journal_test` succeeded; both ctest entries pass. - `scripts/check_no_game_data.py`, `python -m compileall -q make_game.py tools tests`, and `git diff --check` are clean. - The full Windows/GPU matrix above was not rerun on this host after the rebase. The separate per-run scratch fix in `vk_aftermath_test.cpp` remains scoped to #1864. - Synthetic fixtures only; no game data. **AI-assisted**: a pi coding agent operated by the repo contributor ran the enumeration, the original Windows build and the three verification phases, and the rebased-head checks above; the finding is @whoalin1's.
thiefyzheng commented 2026-11-25 05:34:13 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by thiefyzheng on 2026-11-25T05:34:13Z.


The done: line for TEST-TEMPDIR-STRIPPED-ENV could not be posted on the coordination issue: #14 has passed GitHub's 2,500-comment limit and commenting there is now disabled for everyone (403 "Commenting is disabled on issues with more than 2500 comments"). I will post the done: to the successor coordination issue once one is opened. The claim itself is here: https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7151034238 . AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7153909113 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1600#issuecomment-7153909113). Originally posted by [thiefyzheng](https://github.com/thiefyzheng) on 2026-11-25T05:34:13Z. --- The `done:` line for TEST-TEMPDIR-STRIPPED-ENV could not be posted on the coordination issue: #14 has passed GitHub's 2,500-comment limit and commenting there is now disabled for everyone (403 "Commenting is disabled on issues with more than 2500 comments"). I will post the `done:` to the successor coordination issue once one is opened. The claim itself is here: https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7151034238 . AI-assisted.
JoeY54 commented 2026-11-25 06:27:29 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by JoeY54 on 2026-11-25T06:27:29Z.


Independent Windows GPU validation at 03d00ae27516552f4a05ba257fe4728157022f07.

113 passed, 7 failed, 3 skipped across 123 runs. I ran 18 affected GPU tests per device and environment, plus five CPU checks per environment. Counts below are pass / fail / skip.

Child process environment RTX 5090 Integrated Radeon CPU checks
Normal temp environment 18 / 0 / 0 16 / 1 / 1 5 / 0 / 0
TMP, TEMP, USERPROFILE unset 17 / 1 / 0 15 / 2 / 1 5 / 0 / 0
Same variables unset, with LEONIDA_TEST_DIR set 17 / 1 / 0 15 / 2 / 1 5 / 0 / 0
  • file_system_test passed, and I observed its scratch directory under the process working directory with the variables unset and under the configured directory with LEONIDA_TEST_DIR set. The matrix had no 0xc0000409 exits.
  • d3d12_shader_cache passed in the normal environment on both GPUs. It failed in both stripped cases at the disk cache StoreValue check, including with LEONIDA_TEST_DIR set. An isolated rerun reproduced both failures on each GPU, and restoring only TEMP made the same executables pass. The runtime's default cache directory still uses std::filesystem::temp_directory_path. That code is identical in the parent source. The execution matrix covers the tested PR revision.
  • On Radeon, d3d12_mesh failed the unused-stage statistics assertion in all three environments, including normal. The cause of the counter mismatch remains unconfirmed.
  • On Radeon, d3d12_conservative_tier3 returned 77 in all three environments. The driver reported tier 2 and no fullyCoveredFragmentShaderInputVariable.

Windows 11 Pro 26H2 (26300.9974), MSVC 19.52.37029.0, Vulkan SDK 1.4.363.1. RTX 5090 (10DE:2B85, NVIDIA 621.24) and Ryzen 9 9950X3D integrated Radeon (1002:13C0, AMD 26.11.2). Selected the Vulkan device explicitly with LEONIDA_VK_DEVICE and the installed AMD driver on the Radeon runs. Optional host D3D12/WARP comparisons selected their own adapters. Vulkan validation was off.

Synthetic fixtures only. AI-assisted with Codex. Test coordination.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7154810140 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1600#issuecomment-7154810140). Originally posted by [JoeY54](https://github.com/JoeY54) on 2026-11-25T06:27:29Z. --- **Independent Windows GPU validation** at `03d00ae27516552f4a05ba257fe4728157022f07`. **113 passed, 7 failed, 3 skipped** across 123 runs. I ran 18 affected GPU tests per device and environment, plus five CPU checks per environment. Counts below are pass / fail / skip. | Child process environment | RTX 5090 | Integrated Radeon | CPU checks | | --- | ---: | ---: | ---: | | Normal temp environment | 18 / 0 / 0 | 16 / 1 / 1 | 5 / 0 / 0 | | `TMP`, `TEMP`, `USERPROFILE` unset | 17 / 1 / 0 | 15 / 2 / 1 | 5 / 0 / 0 | | Same variables unset, with `LEONIDA_TEST_DIR` set | 17 / 1 / 0 | 15 / 2 / 1 | 5 / 0 / 0 | - `file_system_test` passed, and I observed its scratch directory under the process working directory with the variables unset and under the configured directory with `LEONIDA_TEST_DIR` set. The matrix had no `0xc0000409` exits. - `d3d12_shader_cache` passed in the normal environment on both GPUs. It failed in both stripped cases at the [disk cache `StoreValue` check](https://github.com/ubiquitarianism/leonida/blob/03d00ae27516552f4a05ba257fe4728157022f07/runtime/test/d3d12_shader_cache_test.cpp#L394), including with `LEONIDA_TEST_DIR` set. An isolated rerun reproduced both failures on each GPU, and restoring only `TEMP` made the same executables pass. The [runtime's default cache directory](https://github.com/ubiquitarianism/leonida/blob/03d00ae27516552f4a05ba257fe4728157022f07/runtime/shims/d3d12_vulkan_device.cpp#L8731-L8735) still uses `std::filesystem::temp_directory_path`. That code is identical in the parent source. The execution matrix covers the tested PR revision. - On Radeon, `d3d12_mesh` failed the [unused-stage statistics assertion](https://github.com/ubiquitarianism/leonida/blob/03d00ae27516552f4a05ba257fe4728157022f07/runtime/test/d3d12_mesh_test.cpp#L688-L689) in all three environments, including normal. The cause of the counter mismatch remains unconfirmed. - On Radeon, `d3d12_conservative_tier3` returned 77 in all three environments. The driver reported tier 2 and no `fullyCoveredFragmentShaderInputVariable`. Windows 11 Pro 26H2 (26300.9974), MSVC 19.52.37029.0, Vulkan SDK 1.4.363.1. RTX 5090 (`10DE:2B85`, NVIDIA 621.24) and Ryzen 9 9950X3D integrated Radeon (`1002:13C0`, AMD 26.11.2). Selected the Vulkan device explicitly with `LEONIDA_VK_DEVICE` and the installed AMD driver on the Radeon runs. Optional host D3D12/WARP comparisons selected their own adapters. Vulkan validation was off. Synthetic fixtures only. AI-assisted with Codex. [Test coordination](https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7154458408).
thiefyzheng commented 2026-11-25 19:57:25 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by thiefyzheng on 2026-11-25T19:57:25Z.


@JoeY54 — thank you for the matrix. Reading it against this PR: file_system_test passes in all three environments and the scratch folder lands where intended (under the working directory when the variables are unset, under LEONIDA_TEST_DIR when set), with no 0xc0000409 exits. The d3d12_shader_cache failure with TEMP stripped is in the runtime's own default cache directory (std::filesystem::temp_directory_path in d3d12_vulkan_device.cpp), which you note is identical in the parent and which this PR does not touch, so it is a separate item from the test-scratch change. The Radeon d3d12_mesh stats assertion and d3d12_conservative_tier3 (tier 2 device) fail in the normal environment too, so they do not depend on this PR. Happy to open a follow-up for the runtime cache directory if a maintainer wants one.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7172989798 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1600#issuecomment-7172989798). Originally posted by [thiefyzheng](https://github.com/thiefyzheng) on 2026-11-25T19:57:25Z. --- @JoeY54 — thank you for the matrix. Reading it against this PR: `file_system_test` passes in all three environments and the scratch folder lands where intended (under the working directory when the variables are unset, under `LEONIDA_TEST_DIR` when set), with no `0xc0000409` exits. The `d3d12_shader_cache` failure with `TEMP` stripped is in the runtime's own default cache directory (`std::filesystem::temp_directory_path` in `d3d12_vulkan_device.cpp`), which you note is identical in the parent and which this PR does not touch, so it is a separate item from the test-scratch change. The Radeon `d3d12_mesh` stats assertion and `d3d12_conservative_tier3` (tier 2 device) fail in the normal environment too, so they do not depend on this PR. Happy to open a follow-up for the runtime cache directory if a maintainer wants one. AI-assisted (Claude Code).
MoonEyes commented 2026-11-28 17:59:23 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-28T17:59:23Z.


Hi @thiefyzheng, thanks for this pull request. It currently conflicts with main (conflicting file(s): runtime/test/int3_skip_test.cpp, runtime/test/kernel_writes_test.cpp, runtime/test/xmem_test.cpp), so it carries the needs rebase label. CONTRIBUTING.md asks authors to rebase their branch on main; once it merges cleanly the label goes within the hour, and reviews start with the pull requests that do. Could you update the branch when you have a moment? If you no longer plan to continue with it, please say so here.

AI-assisted (Claude Code, Claude Opus 5.5).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7243442233 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1600#issuecomment-7243442233). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-28T17:59:23Z. --- Hi @thiefyzheng, thanks for this pull request. It currently conflicts with `main` (conflicting file(s): `runtime/test/int3_skip_test.cpp`, `runtime/test/kernel_writes_test.cpp`, `runtime/test/xmem_test.cpp`), so it carries the `needs rebase` label. CONTRIBUTING.md asks authors to rebase their branch on `main`; once it merges cleanly the label goes within the hour, and reviews start with the pull requests that do. Could you update the branch when you have a moment? If you no longer plan to continue with it, please say so here. AI-assisted (Claude Code, Claude Opus 5.5).
thiefyzheng commented 2026-11-28 21:02:21 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by thiefyzheng on 2026-11-28T21:02:21Z.


Rebased onto main 54d27d9883; new head is b17397f0dd77280e107de489fc0f2a92471ace60.

The three conflicted files (int3_skip_test.cpp, kernel_writes_test.cpp, xmem_test.cpp) keep their new upstream cases while using testfiles::temp_dir(). I also carried the same conversion into seven test files added since the original head, including the new GetTempPathW use in d3d12_xmem_placed_test.cpp. The PR now covers 52 test files plus tiny_game; the fixed-per-run scratch issue in vk_aftermath_test.cpp stays separately scoped to #1864.

Rebased-head checks: portable CMake build succeeded for pipeline_order_test and pipeline_cache_journal_test; both ctest entries pass. check_no_game_data.py, compileall and git diff --check are clean. The earlier full Windows/GPU matrix was not rerun on this host after the rebase. AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7245726546 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1600#issuecomment-7245726546). Originally posted by [thiefyzheng](https://github.com/thiefyzheng) on 2026-11-28T21:02:21Z. --- Rebased onto `main` `54d27d9883`; new head is `b17397f0dd77280e107de489fc0f2a92471ace60`. The three conflicted files (`int3_skip_test.cpp`, `kernel_writes_test.cpp`, `xmem_test.cpp`) keep their new upstream cases while using `testfiles::temp_dir()`. I also carried the same conversion into seven test files added since the original head, including the new `GetTempPathW` use in `d3d12_xmem_placed_test.cpp`. The PR now covers 52 test files plus `tiny_game`; the fixed-per-run scratch issue in `vk_aftermath_test.cpp` stays separately scoped to #1864. Rebased-head checks: portable CMake build succeeded for `pipeline_order_test` and `pipeline_cache_journal_test`; both ctest entries pass. `check_no_game_data.py`, `compileall` and `git diff --check` are clean. The earlier full Windows/GPU matrix was **not rerun** on this host after the rebase. AI-assisted.
thiefyzheng commented 2026-11-28 21:20:27 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by thiefyzheng on 2026-11-28T21:20:27Z.


CI has settled on b17397f0dd. Windows runtime, translator tests, viewer tests, change-scope and no-game-data pass. The red jobs are baseline-red, not new failures from this rebase:

  • semantic-tests, stdlib-tests-linux, macos-python and the aggregate check have the same failing tests as main (54d27d9883 / run 46176466867). The aggregate check has no unique failing tests versus main (same 13 on each).
  • Linux runtime's two pipeline_workers assertions match main runtime run 46185761549 exactly (hard oom inline fallback kept stats clean, pool works normally once memory is available again).
  • macOS runtime matches the same main run: vk_bindless_dimensions, cs_imgatomic_ext, and ps_exp_f32_denorm_rt; 197/274 passed, 74 skipped on both.

The rebased-head-specific local Windows substitutes remain limited to what is reported above; the actual GitHub Windows runtime job is green. AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7245947218 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1600#issuecomment-7245947218). Originally posted by [thiefyzheng](https://github.com/thiefyzheng) on 2026-11-28T21:20:27Z. --- CI has settled on `b17397f0dd`. **Windows runtime, translator tests, viewer tests, change-scope and no-game-data pass.** The red jobs are baseline-red, not new failures from this rebase: - `semantic-tests`, `stdlib-tests-linux`, `macos-python` and the aggregate `check` have the same failing tests as `main` (`54d27d9883` / run 46176466867). The aggregate check has **no unique failing tests** versus main (same 13 on each). - Linux runtime's two `pipeline_workers` assertions match main runtime run 46185761549 exactly (`hard oom inline fallback kept stats clean`, `pool works normally once memory is available again`). - macOS runtime matches the same main run: `vk_bindless_dimensions`, `cs_imgatomic_ext`, and `ps_exp_f32_denorm_rt`; `197/274 passed, 74 skipped` on both. The rebased-head-specific local Windows substitutes remain limited to what is reported above; the actual **GitHub Windows runtime job is green**. AI-assisted.
TheGeogeo commented 2026-11-28 22:16:41 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by TheGeogeo on 2026-11-28T22:16:41Z.


Duplicate check (diff reading only, no build): #1600 and #1579 fix the same finding, credited in #1600's claim. With TMP, TEMP and USERPROFILE unset, GetTempPath gives C:\Windows. They conflict in many test files (git merge-tree, e.g. bink_audio_test.cpp, d3d12_bindless_churn_test.cpp), so only one can land as is.

Suggest keeping #1600. It is based on a recent main (149 commits behind, against 3314 for #1579). It adds testfiles::temp_dir() and moves all the tests to it.

One point to check before merging: runtime/src/pe_loader.cpp changes gta6rt itself. Its TLS clone folder now follows LEONIDA_TEST_DIR and falls back to the current folder when the three variables are unset. #1579 instead gave the gta6rt tests TMP and TEMP through CMake. #1579 also changes the shader cache folder fallback in d3d12_vulkan_device.cpp, which #1600 does not cover.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7246622201 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1600#issuecomment-7246622201). Originally posted by [TheGeogeo](https://github.com/TheGeogeo) on 2026-11-28T22:16:41Z. --- Duplicate check (diff reading only, no build): #1600 and #1579 fix the same finding, credited in #1600's claim. With TMP, TEMP and USERPROFILE unset, `GetTempPath` gives `C:\Windows`. They conflict in many test files (`git merge-tree`, e.g. `bink_audio_test.cpp`, `d3d12_bindless_churn_test.cpp`), so only one can land as is. Suggest keeping #1600. It is based on a recent `main` (149 commits behind, against 3314 for #1579). It adds `testfiles::temp_dir()` and moves all the tests to it. One point to check before merging: `runtime/src/pe_loader.cpp` changes `gta6rt` itself. Its TLS clone folder now follows `LEONIDA_TEST_DIR` and falls back to the current folder when the three variables are unset. #1579 instead gave the `gta6rt` tests TMP and TEMP through CMake. #1579 also changes the shader cache folder fallback in `d3d12_vulkan_device.cpp`, which #1600 does not cover. AI-assisted (Claude Code).
zmasi commented 2026-11-28 22:40:27 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T22:40:27Z.


Native Windows 11 + MSVC 19.44 Verification (b17397f0dd + origin/main adfb3821a2)

Verdict: PASS (0 blockers, 0 new /W4 warnings)

Environment & Merge Check

  • Host: Windows 11 (10.0.26200), MSVC 19.44.35228 (x64, /W4 /permissive- /utf-8 /O2 /EHsc)
  • Merge hygiene: Clean merge onto origin/main (adfb3821a2, git merge-tree --write-tree rc=0), and clean combined compile/run alongside #546 (xmem_test.cpp), #537 (xgameruntime_test.cpp), #2528 (pe_loader.cpp, loader_test.cpp), and #1419 (d3d12_skip_compute_test.cpp).

Red -> Green Results

  • Red:
    1. On origin/main, running compile_helper_test.exe with LEONIDA_TEST_DIR set to a writable folder while TMP and TEMP point to a non-directory file aborts (0xC0000409) because std::filesystem::temp_directory_path() ignores LEONIDA_TEST_DIR.
    2. With TMP, TEMP, USERPROFILE, and LEONIDA_TEST_DIR stripped from the environment on Windows 11, a probe confirmed GetTempPathW falls back to C:\WINDOWS\, whereas #1600's testfiles::temp_dir() and tls_host_clone_dir() resolve to the process working directory.
  • Green (PR #1600 + origin/main):
    • Built and executed 8 representative touched binaries (compile_helper_test, title_write_watch_test, kernel_writes_test, pipeline_cache_file_test, shader_fixture_path_test, int3_skip_test, xgameruntime_user_test, loader_test) plus combined-merge xmem_test and xgameruntime_test:
      • Mode A (LEONIDA_TEST_DIR set to an isolated directory while TMP/TEMP are blocked): PASS (rc=0 across all targets).
      • Mode B (TMP, TEMP, USERPROFILE, and LEONIDA_TEST_DIR completely stripped from env in an isolated CWD): PASS (rc=0 across all targets, with zero writes outside the sandbox CWD).

Diff Audit Notes

  • Non-blocking note: callers that copy testfiles::temp_dir() into MAX_PATH stack buffers for GetTempFileNameW/GetTempFileNameA (title_write_watch_test, xgameruntime_test, xgameruntime_user_test, xmem_test) remain subject to Win32 GetTempFileNameW's MAX_PATH - 14 (246-char) directory limit if LEONIDA_TEST_DIR or a stripped-env CWD is deeply nested.

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7246901031 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1600#issuecomment-7246901031). Originally posted by [zmasi](https://github.com/zmasi) on 2026-11-28T22:40:27Z. --- ### Native Windows 11 + MSVC `19.44` Verification (`b17397f0dd` + `origin/main` `adfb3821a2`) **Verdict**: **PASS** (0 blockers, 0 new `/W4` warnings) #### Environment & Merge Check - **Host**: Windows 11 (`10.0.26200`), MSVC `19.44.35228` (`x64`, `/W4 /permissive- /utf-8 /O2 /EHsc`) - **Merge hygiene**: Clean merge onto `origin/main` (`adfb3821a2`, `git merge-tree --write-tree` `rc=0`), and clean combined compile/run alongside `#546` (`xmem_test.cpp`), `#537` (`xgameruntime_test.cpp`), `#2528` (`pe_loader.cpp`, `loader_test.cpp`), and `#1419` (`d3d12_skip_compute_test.cpp`). #### Red -> Green Results - **Red**: 1. On `origin/main`, running `compile_helper_test.exe` with `LEONIDA_TEST_DIR` set to a writable folder while `TMP` and `TEMP` point to a non-directory file aborts (`0xC0000409`) because `std::filesystem::temp_directory_path()` ignores `LEONIDA_TEST_DIR`. 2. With `TMP`, `TEMP`, `USERPROFILE`, and `LEONIDA_TEST_DIR` stripped from the environment on Windows 11, a probe confirmed `GetTempPathW` falls back to `C:\WINDOWS\`, whereas `#1600`'s `testfiles::temp_dir()` and `tls_host_clone_dir()` resolve to the process working directory. - **Green** (`PR #1600 + origin/main`): - Built and executed 8 representative touched binaries (`compile_helper_test`, `title_write_watch_test`, `kernel_writes_test`, `pipeline_cache_file_test`, `shader_fixture_path_test`, `int3_skip_test`, `xgameruntime_user_test`, `loader_test`) plus combined-merge `xmem_test` and `xgameruntime_test`: - **Mode A (`LEONIDA_TEST_DIR` set to an isolated directory while `TMP`/`TEMP` are blocked)**: **PASS** (`rc=0` across all targets). - **Mode B (`TMP`, `TEMP`, `USERPROFILE`, and `LEONIDA_TEST_DIR` completely stripped from `env` in an isolated CWD)**: **PASS** (`rc=0` across all targets, with zero writes outside the sandbox CWD). #### Diff Audit Notes - Non-blocking note: callers that copy `testfiles::temp_dir()` into `MAX_PATH` stack buffers for `GetTempFileNameW`/`GetTempFileNameA` (`title_write_watch_test`, `xgameruntime_test`, `xgameruntime_user_test`, `xmem_test`) remain subject to Win32 `GetTempFileNameW`'s `MAX_PATH - 14` (`246`-char) directory limit if `LEONIDA_TEST_DIR` or a stripped-env CWD is deeply nested. AI-assisted.
enlight3d commented 2026-11-29 12:33:50 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by enlight3d on 2026-11-29T12:33:50Z.


Run of #1600 on a native Windows GPU (NVIDIA RTX 3090). Synthetic tests only, no game files.

Heads: PR b17397f0d, main 8fb974878.
Merged or head-only: merged. git merge --no-ff pr-1600 into main is clean (merge commit 839009dac), all 55 files.

Commands (from a cmd.exe with the VS 2022 x64 environment):

git checkout --detach origin/main && git merge --no-edit --no-ff pr-1600
cmake -S runtime -B runtime/build -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DLEONIDA_REQUIRE_VULKAN=ON
cmake --build runtime/build -j 8 --target <the 53 test targets of the 52 changed test files + xmem_test + gta6rt>
ctest -R "^(<the 74 ctest tests that run those targets>)$" --output-on-failure -j1 --timeout 300

The same ctest line was run twice per tree: normal environment, and stripped (set TMP=, set TEMP=, set USERPROFILE= before ctest).

Green (merged):

  • Normal environment: 70 Passed, 2 Skipped (bink_decode, bink_audio), 2 not passing: xbox_present (fails identically on plain main, present error in this session: pre-existing) and xmem_no_write_watch (failed once in this run; on plain main it also failed in 1 of 2 runs, and on the merged tree it then passed 5 of 5, so it is intermittent and not from this PR).
  • Stripped environment: 70 Passed, 2 Skipped, 2 Failed: xbox_present (same as above) and d3d12_shader_cache (now fails in a normal check at the cache-store step, StoreValue != S_OK, instead of aborting; the runtime's own default cache directory is outside this PR, as the author noted in the thread).

Red:

  • Behavioural, plain main (the PR's test changes absent) in the stripped environment: 64 of 74 fail (most exit 0xc0000409, a few SegFault or check failures), 2 skipped, 8 pass. With the PR: 2 fail (above). In the normal environment plain main and the merged tree agree (only xbox_present fails, plus the intermittent xmem_no_write_watch).
  • Behavioural, the PR's only non-test change reverted (runtime/src/pe_loader.cpp, tls_host_clone_dir), test changes kept, stripped environment: loader_tls, loader_tls_index0 and loader_tls_index0_threads fail (loader_tls_index0 SegFaults); loader and loader_tls_index0_noreserve still pass. With the change restored all five pass.

Link: no new imports vs main (gta6rt.exe, 714 DLL!symbol entries, identical lists).

Machine: RTX 3090 24 GB, NVIDIA 621.40, Windows 11 Pro 10.0.26300, MSVC 19.44, RelWithDebInfo, Ninja, Vulkan SDK 1.4.363.1.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7255902192 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1600#issuecomment-7255902192). Originally posted by [enlight3d](https://github.com/enlight3d) on 2026-11-29T12:33:50Z. --- Run of #1600 on a native Windows GPU (NVIDIA RTX 3090). Synthetic tests only, no game files. Heads: PR `b17397f0d`, main `8fb974878`. Merged or head-only: **merged**. `git merge --no-ff pr-1600` into main is clean (merge commit `839009dac`), all 55 files. Commands (from a cmd.exe with the VS 2022 x64 environment): ``` git checkout --detach origin/main && git merge --no-edit --no-ff pr-1600 cmake -S runtime -B runtime/build -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DLEONIDA_REQUIRE_VULKAN=ON cmake --build runtime/build -j 8 --target <the 53 test targets of the 52 changed test files + xmem_test + gta6rt> ctest -R "^(<the 74 ctest tests that run those targets>)$" --output-on-failure -j1 --timeout 300 ``` The same ctest line was run twice per tree: normal environment, and stripped (`set TMP=`, `set TEMP=`, `set USERPROFILE=` before ctest). Green (merged): - Normal environment: 70 Passed, 2 Skipped (`bink_decode`, `bink_audio`), 2 not passing: `xbox_present` (fails identically on plain main, present error in this session: pre-existing) and `xmem_no_write_watch` (failed once in this run; on plain main it also failed in 1 of 2 runs, and on the merged tree it then passed 5 of 5, so it is intermittent and not from this PR). - Stripped environment: 70 Passed, 2 Skipped, 2 Failed: `xbox_present` (same as above) and `d3d12_shader_cache` (now fails in a normal check at the cache-store step, `StoreValue != S_OK`, instead of aborting; the runtime's own default cache directory is outside this PR, as the author noted in the thread). Red: - Behavioural, plain main (the PR's test changes absent) in the stripped environment: **64 of 74 fail** (most exit `0xc0000409`, a few SegFault or check failures), 2 skipped, 8 pass. With the PR: 2 fail (above). In the normal environment plain main and the merged tree agree (only `xbox_present` fails, plus the intermittent `xmem_no_write_watch`). - Behavioural, the PR's only non-test change reverted (`runtime/src/pe_loader.cpp`, `tls_host_clone_dir`), test changes kept, stripped environment: `loader_tls`, `loader_tls_index0` and `loader_tls_index0_threads` fail (`loader_tls_index0` SegFaults); `loader` and `loader_tls_index0_noreserve` still pass. With the change restored all five pass. Link: no new imports vs main (gta6rt.exe, 714 DLL!symbol entries, identical lists). Machine: RTX 3090 24 GB, NVIDIA 621.40, Windows 11 Pro 10.0.26300, MSVC 19.44, RelWithDebInfo, Ninja, Vulkan SDK 1.4.363.1.
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
ProjectLeonida/mandy!1600
No description provided.