tests: derive every test's scratch folder from test_temp_dir::temp_dir, not GetTempPath (TEST-TEMPDIR-STRIPPED-ENV) #1600
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1600"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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_DIRwhen 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 thetiny_gamefixture that calledGetTempPathA/GetTempPathW/temp_directory_pathdirectly now use it, andd3d12_queue_handover_test.cpp'scapture_stderrchecks its_sopen_sresult instead of silently returning empty stderr. One runtime source function needed the same fallback because tests exercise it:tls_host_clone_dirinruntime/src/pe_loader.cpp(theloader_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,
GetTempPathWreturnsC:\Windows\, and the throwingcreate_directories/copy_file/ofstreamonC:\Windows\leonida_*aborts with 0xc0000409 before the test body runs — the ~20d3d12_*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)
file_system_testruns all 505 checks, 0 failures;loader_testall 95 checks, 0 failed;xgameruntime_testexit 0. No 0xc0000409 anywhere in any run.C:\work\tdirunder a fully stripped environment, the process'sleonida_file_system_<pid>scratch folder was captured mid-run inside it and cleaned up after the 505-check pass.Rebased-head verification (
b17397f0dd)main54d27d9883; resolvedint3_skip_test.cpp,kernel_writes_test.cppandxmem_test.cppwhile preserving their new upstream cases. Carried the same conversion into seven test files added since the original head.pipeline_order_testandpipeline_cache_journal_testsucceeded; both ctest entries pass.scripts/check_no_game_data.py,python -m compileall -q make_game.py tools tests, andgit diff --checkare clean.vk_aftermath_test.cppremains scoped to #1864.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.
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 thedone: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.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.
TMP,TEMP,USERPROFILEunsetLEONIDA_TEST_DIRsetfile_system_testpassed, and I observed its scratch directory under the process working directory with the variables unset and under the configured directory withLEONIDA_TEST_DIRset. The matrix had no0xc0000409exits.d3d12_shader_cachepassed in the normal environment on both GPUs. It failed in both stripped cases at the disk cacheStoreValuecheck, including withLEONIDA_TEST_DIRset. An isolated rerun reproduced both failures on each GPU, and restoring onlyTEMPmade the same executables pass. The runtime's default cache directory still usesstd::filesystem::temp_directory_path. That code is identical in the parent source. The execution matrix covers the tested PR revision.d3d12_meshfailed the unused-stage statistics assertion in all three environments, including normal. The cause of the counter mismatch remains unconfirmed.d3d12_conservative_tier3returned 77 in all three environments. The driver reported tier 2 and nofullyCoveredFragmentShaderInputVariable.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 withLEONIDA_VK_DEVICEand 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.
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_testpasses in all three environments and the scratch folder lands where intended (under the working directory when the variables are unset, underLEONIDA_TEST_DIRwhen set), with no0xc0000409exits. Thed3d12_shader_cachefailure withTEMPstripped is in the runtime's own default cache directory (std::filesystem::temp_directory_pathind3d12_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 Radeond3d12_meshstats assertion andd3d12_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).
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 theneeds rebaselabel. CONTRIBUTING.md asks authors to rebase their branch onmain; 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).
Imported from ubiquitarianism/leonida. Originally posted by thiefyzheng on 2026-11-28T21:02:21Z.
Rebased onto
main54d27d9883; new head isb17397f0dd77280e107de489fc0f2a92471ace60.The three conflicted files (
int3_skip_test.cpp,kernel_writes_test.cpp,xmem_test.cpp) keep their new upstream cases while usingtestfiles::temp_dir(). I also carried the same conversion into seven test files added since the original head, including the newGetTempPathWuse ind3d12_xmem_placed_test.cpp. The PR now covers 52 test files plustiny_game; the fixed-per-run scratch issue invk_aftermath_test.cppstays separately scoped to #1864.Rebased-head checks: portable CMake build succeeded for
pipeline_order_testandpipeline_cache_journal_test; both ctest entries pass.check_no_game_data.py,compileallandgit diff --checkare clean. The earlier full Windows/GPU matrix was not rerun on this host after the rebase. AI-assisted.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-pythonand the aggregatecheckhave the same failing tests asmain(54d27d9883/ run 46176466867). The aggregate check has no unique failing tests versus main (same 13 on each).pipeline_workersassertions match main runtime run 46185761549 exactly (hard oom inline fallback kept stats clean,pool works normally once memory is available again).vk_bindless_dimensions,cs_imgatomic_ext, andps_exp_f32_denorm_rt;197/274 passed, 74 skippedon 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.
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,
GetTempPathgivesC:\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 addstestfiles::temp_dir()and moves all the tests to it.One point to check before merging:
runtime/src/pe_loader.cppchangesgta6rtitself. Its TLS clone folder now followsLEONIDA_TEST_DIRand falls back to the current folder when the three variables are unset. #1579 instead gave thegta6rttests TMP and TEMP through CMake. #1579 also changes the shader cache folder fallback ind3d12_vulkan_device.cpp, which #1600 does not cover.AI-assisted (Claude Code).
Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T22:40:27Z.
Native Windows 11 + MSVC
19.44Verification (b17397f0dd+origin/mainadfb3821a2)Verdict: PASS (0 blockers, 0 new
/W4warnings)Environment & Merge Check
10.0.26200), MSVC19.44.35228(x64,/W4 /permissive- /utf-8 /O2 /EHsc)origin/main(adfb3821a2,git merge-tree --write-treerc=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
origin/main, runningcompile_helper_test.exewithLEONIDA_TEST_DIRset to a writable folder whileTMPandTEMPpoint to a non-directory file aborts (0xC0000409) becausestd::filesystem::temp_directory_path()ignoresLEONIDA_TEST_DIR.TMP,TEMP,USERPROFILE, andLEONIDA_TEST_DIRstripped from the environment on Windows 11, a probe confirmedGetTempPathWfalls back toC:\WINDOWS\, whereas#1600'stestfiles::temp_dir()andtls_host_clone_dir()resolve to the process working directory.PR #1600 + origin/main):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-mergexmem_testandxgameruntime_test:LEONIDA_TEST_DIRset to an isolated directory whileTMP/TEMPare blocked): PASS (rc=0across all targets).TMP,TEMP,USERPROFILE, andLEONIDA_TEST_DIRcompletely stripped fromenvin an isolated CWD): PASS (rc=0across all targets, with zero writes outside the sandbox CWD).Diff Audit Notes
testfiles::temp_dir()intoMAX_PATHstack buffers forGetTempFileNameW/GetTempFileNameA(title_write_watch_test,xgameruntime_test,xgameruntime_user_test,xmem_test) remain subject to Win32GetTempFileNameW'sMAX_PATH - 14(246-char) directory limit ifLEONIDA_TEST_DIRor a stripped-env CWD is deeply nested.AI-assisted.
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, main8fb974878.Merged or head-only: merged.
git merge --no-ff pr-1600into main is clean (merge commit839009dac), all 55 files.Commands (from a cmd.exe with the VS 2022 x64 environment):
The same ctest line was run twice per tree: normal environment, and stripped (
set TMP=,set TEMP=,set USERPROFILE=before ctest).Green (merged):
bink_decode,bink_audio), 2 not passing:xbox_present(fails identically on plain main, present error in this session: pre-existing) andxmem_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).xbox_present(same as above) andd3d12_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:
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 (onlyxbox_presentfails, plus the intermittentxmem_no_write_watch).runtime/src/pe_loader.cpp,tls_host_clone_dir), test changes kept, stripped environment:loader_tls,loader_tls_index0andloader_tls_index0_threadsfail (loader_tls_index0SegFaults);loaderandloader_tls_index0_noreservestill 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.