tests: a locked recorder.exe no longer hides the cmake batch case's result (TEST-CMAKE-BATCH-CLEANUP) #1439

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

@⁠Anonymous78e on GitHub · 2026-11-25 00:16 UTC · original
Anonymous78e:test/cmake-batch-cleanup → main · +4 −2 · 1 files · 1 commits · open

Claimed in the coordination issue as: TEST-CMAKE-BATCH-CLEANUP (#14)

What and why

Part (3) of @⁠GTAVIB4GTAVI's parallel-load finding (#14). Parts (1) and (2) are #1410 and #1002.

tests/test_build_runtime_cmake.py builds each case in tempfile.TemporaryDirectory(dir=self.base) and copies a recorder.exe into it, which a child process runs. When Windows still holds that image at cleanup (antivirus, a late handle close), shutil.rmtree raises PermissionError: [WinError 5] and that error replaces the case's own result, as reported:

PermissionError: [WinError 5] Access is denied: ...\caret^dir\tools ^ & 東京\recorder.exe

Both temp folders, the per-case one and the class one that holds the compiled recorder, now pass ignore_cleanup_errors=True (Python 3.10+; the project needs 3.12+), so the assertion stays in charge. Nothing else changes.

Tested

Windows 11 Pro 26H2, CPython 3.13.15, on main 1154976d4:

  • The mechanism, deterministically: a file held open inside a TemporaryDirectory whose body fails an assertion.

    exception that surfaces
    no flag (as on main) PermissionError: [WinError 32] ...
    ignore_cleanup_errors=True AssertionError: the case's own assertion
  • python -I tests/test_build_runtime_cmake.py: 1 test (27 subtests) OK in 11 s with this change.

  • scripts/check_no_game_data.py on the file: clean.

GPUs tested: n/a

AI-assisted: yes (Claude Code, Claude Opus 5.5)

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a: no translator change)

🤖 Generated with Claude Code

https://claude.ai/code/session_014sDZDAAcsauTL6d8ie67Qo

**@⁠Anonymous78e** on GitHub · 2026-11-25 00:16 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1439) `Anonymous78e:test/cmake-batch-cleanup` → `main` · +4 −2 · 1 files · 1 commits · open Claimed in the coordination issue as: TEST-CMAKE-BATCH-CLEANUP (https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14) ### What and why Part (3) of @⁠GTAVIB4GTAVI's parallel-load finding ([#14](https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14)). Parts (1) and (2) are #1410 and #1002. `tests/test_build_runtime_cmake.py` builds each case in `tempfile.TemporaryDirectory(dir=self.base)` and copies a `recorder.exe` into it, which a child process runs. When Windows still holds that image at cleanup (antivirus, a late handle close), `shutil.rmtree` raises `PermissionError: [WinError 5]` and that error replaces the case's own result, as reported: ``` PermissionError: [WinError 5] Access is denied: ...\caret^dir\tools ^ & 東京\recorder.exe ``` Both temp folders, the per-case one and the class one that holds the compiled recorder, now pass `ignore_cleanup_errors=True` (Python 3.10+; the project needs 3.12+), so the assertion stays in charge. Nothing else changes. ### Tested Windows 11 Pro 26H2, CPython 3.13.15, on `main` 1154976d4: - The mechanism, deterministically: a file held open inside a `TemporaryDirectory` whose body fails an assertion. | | exception that surfaces | |---|---| | no flag (as on `main`) | `PermissionError: [WinError 32] ...` | | `ignore_cleanup_errors=True` | `AssertionError: the case's own assertion` | - `python -I tests/test_build_runtime_cmake.py`: 1 test (27 subtests) OK in 11 s with this change. - `scripts/check_no_game_data.py` on the file: clean. GPUs tested: n/a AI-assisted: yes (Claude Code, Claude Opus 5.5) ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [x] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (n/a: no translator change) 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_014sDZDAAcsauTL6d8ie67Qo
test_build_runtime_cmake builds each case in a TemporaryDirectory and runs a
recorder.exe from it. When Windows still holds that image at cleanup,
rmtree's PermissionError replaced the case's own result. Both temp folders
now pass ignore_cleanup_errors=True, so the assertion stays in charge.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014sDZDAAcsauTL6d8ie67Qo
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:51:29 +00:00
Author
Owner

@⁠PierreEbele on GitHub · 2026-11-25 15:28 UTC · original

Reviewed 751de4d16: both TemporaryDirectory calls in test_build_runtime_cmake.py now pass ignore_cleanup_errors=True, so a still-locked recorder.exe at cleanup can no longer replace (or masquerade as) a case's result: both the class-level folder and each subTest's copied recorder. Could not run the suite here (Windows-only: csc.exe and powershell.exe; on this Linux box it exits OK (skipped=1) and compiles clean); fault injection also cannot reproduce the lock here, so this is a code-reading review: I verified the mechanism by reading tempfile's routing: cleanup() forwards the flag and every raise site in rmtree's onexc, including the locked-file PermissionError branch, is behind if not ignore_errors; README pins Python 3.12+ and the ci check job runs this file on windows-latest. Leaked leonida_cmake* folders when cleanup does fail are the accepted trade-off. No findings.

AI-assisted review.

Recommendation: Merge

**@⁠PierreEbele** on GitHub · 2026-11-25 15:28 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1439#issuecomment-7166890656) Reviewed 751de4d16: both TemporaryDirectory calls in test_build_runtime_cmake.py now pass ignore_cleanup_errors=True, so a still-locked recorder.exe at cleanup can no longer replace (or masquerade as) a case's result: both the class-level folder and each subTest's copied recorder. Could not run the suite here (Windows-only: csc.exe and powershell.exe; on this Linux box it exits `OK (skipped=1)` and compiles clean); fault injection also cannot reproduce the lock here, so this is a code-reading review: I verified the mechanism by reading tempfile's routing: cleanup() forwards the flag and every raise site in _rmtree's onexc, including the locked-file PermissionError branch, is behind `if not ignore_errors`; README pins Python 3.12+ and the ci check job runs this file on windows-latest. Leaked leonida_cmake_* folders when cleanup does fail are the accepted trade-off. No findings. AI-assisted review. **Recommendation:** Merge
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/1439/head:github-bot/gh-1439'
git switch 'github-bot/gh-1439'

Merge

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