[PR #1952] Isolate the game-save and Bink test scratch directories #1959

Open
opened 2026-11-26 21:19:32 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/1952
Author: @lgr123
Created: 11/25/2026
Status: 🔄 Open

Base: main ← Head: runtime-scratch-isolation


📝 Commits (2)

  • 9c73fc1 Isolate the game-save and Bink test scratch directories
  • 78249ac Clean up Bink diagnostics unless retention is requested

📊 Changes

7 files changed (+56 additions, -20 deletions)

View changed files

📝 docs/movies.md (+4 -0)
📝 runtime/test/bink_audio_test.cpp (+14 -4)
📝 runtime/test/bink_audio_test.md (+5 -2)
📝 runtime/test/bink_decode_test.cpp (+20 -8)
📝 runtime/test/bink_decode_test.md (+5 -2)
📝 runtime/test/test_temp_dir.h (+5 -1)
📝 runtime/test/xgameruntime_gamesave_test.cpp (+3 -3)

📄 Description

Claimed as RT-ISOLATE-GAMESAVE-AND-BINK-SCRATCH in #1608, following the report's three residual sites.

Four concurrent game-save test processes sharing one temporary base exposed the race on Windows x64. Over three batches, public main failed 12 of 12 runs. This patch passed 12 of 12, with 76 checks per run and no leftover game-save scratch directories.

Two invocations using the same temporary base can delete or overwrite one another’s files. Game-save now uses the existing per-process RAII scratch directory, including on early returns. Bink audio and decode use per-process paths and clean them up on normal or handled-failure exit. Set LEONIDA_KEEP_BINK_OUTPUT=1 to retain diagnostics and print their folder. This patch stays scoped to the three remaining fixed names.

Reviewer check

Build the xgameruntime_gamesave_test CMake target, then start four copies at once with TEMP and TMP pointing to the same disposable folder. Let each process use an independent output log. Repeat on main and this branch. This test uses synthetic saves and needs no retail files.

Independent Windows verification passed 12 of 12 concurrent runs alongside #1579 after resolving the three overlapping lines. It also identified that Bink diagnostic folders would accumulate. The follow-up addresses retention with scoped cleanup and an explicit opt-in.

Tested

  • Windows x64, MSVC, public main 9e7720c. Built the actual synthetic game-save executable. Ran three batches of four simultaneously active processes sharing one disposable temporary base.
  • Public main failed 12 of 12 processes. The patched test passed 12 of 12, with 76 checks and zero failures in every process and no remaining scratch directories.
  • Both Bink test translation units compiled. Movie-dependent test paths were not run. Both Bink test files compiled again after the retention change. Synthetic cleanup and opt-in retention passed with default temp, an explicit LEONIDA_TEST_DIR, and cwd fallback with #1579's temp helper.
  • git diff --check and the source-only check passed. No game files were used.

GPUs tested: n/a.

AI-assisted: yes.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/1952 **Author:** [@lgr123](https://github.com/lgr123) **Created:** 11/25/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `runtime-scratch-isolation` --- ### 📝 Commits (2) - [`9c73fc1`](https://github.com/ubiquitarianism/leonida/commit/9c73fc17e7399ff1ec1af17b163ce0766e51c08f) Isolate the game-save and Bink test scratch directories - [`78249ac`](https://github.com/ubiquitarianism/leonida/commit/78249ac07b2084023c74221fb518df1a8de0d837) Clean up Bink diagnostics unless retention is requested ### 📊 Changes **7 files changed** (+56 additions, -20 deletions) <details> <summary>View changed files</summary> 📝 `docs/movies.md` (+4 -0) 📝 `runtime/test/bink_audio_test.cpp` (+14 -4) 📝 `runtime/test/bink_audio_test.md` (+5 -2) 📝 `runtime/test/bink_decode_test.cpp` (+20 -8) 📝 `runtime/test/bink_decode_test.md` (+5 -2) 📝 `runtime/test/test_temp_dir.h` (+5 -1) 📝 `runtime/test/xgameruntime_gamesave_test.cpp` (+3 -3) </details> ### 📄 Description Claimed as `RT-ISOLATE-GAMESAVE-AND-BINK-SCRATCH` in [#1608](https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7168028667), following the report's [three residual sites](https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7164348116). Four concurrent game-save test processes sharing one temporary base exposed the race on Windows x64. Over three batches, public main failed **12 of 12** runs. This patch passed **12 of 12**, with 76 checks per run and no leftover game-save scratch directories. Two invocations using the same temporary base can delete or overwrite one another’s files. Game-save now uses the existing per-process RAII scratch directory, including on early returns. Bink audio and decode use per-process paths and clean them up on normal or handled-failure exit. Set `LEONIDA_KEEP_BINK_OUTPUT=1` to retain diagnostics and print their folder. This patch stays scoped to the three remaining fixed names. ### Reviewer check Build the `xgameruntime_gamesave_test` CMake target, then start four copies at once with `TEMP` and `TMP` pointing to the same disposable folder. Let each process use an independent output log. Repeat on main and this branch. This test uses synthetic saves and needs no retail files. [Independent Windows verification](https://github.com/ubiquitarianism/leonida/pull/1952#issuecomment-7169998697) passed 12 of 12 concurrent runs alongside #1579 after resolving the three overlapping lines. It also identified that Bink diagnostic folders would accumulate. The follow-up addresses retention with scoped cleanup and an explicit opt-in. ### Tested - Windows x64, MSVC, public main `9e7720c`. Built the actual synthetic game-save executable. Ran three batches of four simultaneously active processes sharing one disposable temporary base. - Public main failed 12 of 12 processes. The patched test passed 12 of 12, with 76 checks and zero failures in every process and no remaining scratch directories. - Both Bink test translation units compiled. Movie-dependent test paths were not run. Both Bink test files compiled again after the retention change. Synthetic cleanup and opt-in retention passed with default temp, an explicit LEONIDA_TEST_DIR, and cwd fallback with #1579's temp helper. - `git diff --check` and the source-only check passed. No game files were used. GPUs tested: n/a. AI-assisted: yes. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
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.

Dependencies

No dependencies set

Reference
starred/leonida#1959
No description provided.