Repository navigation
tests: nine runtime tests use a temp folder of their own process, and a two-copy test checks it - #8213
tests: nine runtime tests use a temp folder of their own process, and a two-copy test checks it#8213myokex wants to merge 2 commits into
Conversation
d3d12_depth24_draw, d3d12_depth_resolve, d3d12_f16_halves, d3d12_geometry, d3d12_mesh, d3d12_state_sweep and d3d12_stores_atomics wrote their shader library under one fixed %TEMP% name. Two copies at once (ctest -j with two checkouts, or two suites sharing one TMPDIR or Wine prefix) then removed or overwrote each other's modules, the race test_temp_dir.h describes. - depth24_draw, geometry, mesh (they already remove the folder at the end): testfiles::process_temp_dir(<same name>). - depth_resolve, f16_halves, state_sweep, stores_atomics (they never removed it, so a per-process name alone would leave one folder per run): testfiles::ScratchDir, which creates the folder and removes it on return. In depth_resolve it lives outside the block, because the device reads the library through info.shader_dir afterwards. Measured on Windows 11, RX 7800 XT, 4 copies at once, 3 rounds (12 runs) each, on main dde82f2 vs this change: depth24_draw 9 -> 0 failed, geometry 5 -> 0, mesh 4 -> 0 (at PSO creation / h.run); f16_halves, state_sweep, stores_atomics 0 -> 0; no folder left in %TEMP%. depth_resolve fails alone on both sides with the same AMD host differences, unrelated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tupacfan04
left a comment
There was a problem hiding this comment.
The seven changed tests are correct, but two other synthetic runtime tests still share one fixed temp folder — and one copy's cleanup deletes another copy's files.
-
d3d12_shader_cache_teststill usesleonida_shader_cache_disk_test.runtime/test/d3d12_shader_cache_test.cpp:289-302removes and recreates that fixed folder, thencurrent_path(temp_dir); theRestoreCwddestructor (:296-300) removes the same fixed folder. Two copies at once (parallel CTest from two checkouts, or a sharedTMPDIR/Wine prefix) race: one startup/teardownremove_alldeletes the other's cache and working directory. The PR body excludes onlybink_audio/bink_decode, so this one is unmentioned. -
xgameruntime_gamesave_teststill usesleonida_gamesave_test.runtime/test/xgameruntime_gamesave_test.cpp:125-128removes that fixed root and setsLEONIDA_SAVE_DIRto it;:371removes it at the end. Two copies share saves and one cleanup deletes the other's. The same per-processScratchDir/process_temp_dirfix applies.
The bink_audio/bink_decode exclusions are reasonable (inspection output/movie input), but these two are synthetic and unconstrained.
Test gap: no committed two-copy test. The PR body's manual table is useful, but three of the seven (d3d12_f16_halves, d3d12_state_sweep, d3d12_stores_atomics) were 0/12 on main as well, so their two-copy case was never reproduced, and d3d12_depth_resolve fails on the author's card on both sides. Add a two-copy test (shared temp dir, both must pass) to catch a future fixed-path regression.
Minor: the three process_temp_dir tests rely on remove_all(library) at the end, so an early return/crash leaves a per-PID folder; d3d12_mesh handles its early skip, the other two may not. ScratchDir for all seven would make cleanup uniform. Correct: per-PID paths, no cross-process deletion in the changed tests, no path escape. Synthetic/code-read only; no game files. AI-assisted (OpenCode).
…y test d3d12_shader_cache_test (leonida_shader_cache_disk_test) and xgameruntime_gamesave_test (leonida_gamesave_test) still used one fixed folder under the temp directory, so one copy's remove_all deleted the other copy's cache or saves. Both now use testfiles::process_temp_dir. d3d12_depth24_draw, d3d12_geometry and d3d12_mesh use ScratchDir instead of process_temp_dir plus a final remove_all, so an early return no longer leaves a per-process folder behind. test/run_two_copies.cmake starts two copies of a test at once (the commands of one execute_process run concurrently) and fails unless both exit 0. Registered for xgameruntime_gamesave, d3d12_shader_cache and d3d12_geometry. With the game save folder put back to the fixed name, xgameruntime_gamesave_two_copies failed 19 of 20 runs; with this change it passed 20 of 20 (RX 7800 XT, Windows 11). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks @tupacfan04, all four points are in
Tested on Windows 11 Pro 10.0.26300, RX 7800 XT (32.0.32029.2010), MSVC 19.44 RelWithDebInfo: the 9 touched tests plus the 3 new AI-assisted (Claude Code). |
|
Independent build + test: PASS (one already-failing test unchanged) AI-assisted (Claude Code). Windows 11 x64, MSVC 19.44.35220, Ninja RelWithDebInfo, NVIDIA GeForce RTX 3080 driver 621.24 / 32.0.16.2124 (Vulkan layer). Head
Notes:
|
|
✅ Automated security review: CLEAN (commit
Scope: static analysis of added diff lines only; no code was executed. Please review findings manually. |
|
Windows check of Both new two-copy tests pass on this machine, so the per-process folders work for the gamesave and shader-cache paths at least (the ones that build here). I did not run four copies in three rounds; this is one ctest pass, not a stress run. |
|
Tested For this change. On the GPU under Wine the tests it moves to a temp folder of their own process pass: #9370 could not be put in the same tree: it conflicts with this PR in Setup. Built with MSVC 14.52 (Visual Studio 18), Windows SDK 10.0.26100, Vulkan SDK 1.4.363.1, Ninja RelWithDebInfo on Windows Server 2025 (no Vulkan driver there), then the same binaries run through
Against This was a combined run: the six PRs were built into one tree, so it is weaker evidence than a run of this PR alone, and there is no per-PR negative control. A regression would have shown as a difference from |
Claim: new item in #8047 (comment).
Seven runtime tests wrote their shader library under one fixed
%TEMP%name. Two copies at once (ctest -jfrom two checkouts, or two suites sharing one TMPDIR / Wine prefix) remove or overwrite each other's modules: the raceruntime/test/test_temp_dir.hdescribes, and the one #6221 / #6184 fix ford3d12_bindless_churn(left out here so this doesn't overlap them).d3d12_depth24_draw,d3d12_geometry,d3d12_mesh: they alreadyremove_allthe folder at the end, so only the name changes:testfiles::process_temp_dir(<same name>).d3d12_depth_resolve,d3d12_f16_halves,d3d12_state_sweep,d3d12_stores_atomics: they never removed the folder, so a per-process name alone would leave one folder per run. They usetestfiles::ScratchDir, which creates it and removes it whenmainreturns. Ind3d12_depth_resolveit is declared before the block, because the device reads the library throughinfo.shader_dirafter it.bink_audio/bink_decodealso use fixed names, but for output files a person may want to look at, and they need a movie from the game; not touched.Tested on Windows 11, AMD Radeon RX 7800 XT (driver 32.0.32029.2010), MSVC 2022 RelWithDebInfo, Vulkan SDK 1.4.363.0, synthetic only, no game files. 4 copies of each test started at once, 3 rounds (12 runs),
maindde82f27evs this branch:mainfailedmainfailured3d12_depth24_drawh.run(...)at lines 348/364/378/413d3d12_geometryCreateGraphicsPipelineStateat lines 129/131d3d12_meshcreate(...)at lines 207/212d3d12_f16_halves,d3d12_state_sweep,d3d12_stores_atomicsEvery test passes run alone on both sides, and no
leonida_*folder is left in%TEMP%after the branch's runs.d3d12_depth_resolvefails on this card on both sides, alone too, with the same AMD host stencil-resolve differences (63 of 97 match, 18 host quirksagainst the AMD host,71 of 71against WARP): not this change.🤖 Generated with Claude Code