[PR #1966] Prevent false GPU passes from shared test work directories #1972

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

📋 Pull Request Information

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

Base: main ← Head: lgr123/gpu-test-work-ownership


📝 Commits (2)

  • e97e979 Prevent false GPU passes from shared test work directories
  • 99228f1 Document separate GPU work folders for concurrent runs

📊 Changes

3 files changed (+64 additions, -2 deletions)

View changed files

📝 docs/testing.md (+1 -0)
📝 scripts/run_gpu_tests.py (+28 -2)
📝 tests/test_run_gpu_tests_paths.py (+35 -0)

📄 Description

Claimed as GPU-TEST-WORK-OWNERSHIP.

Two GPU test runs sharing explicit --work can produce a false PASS. In the reproduction, a failing synthetic cs_lds test reported 0/1 passed when run alone and 1/1 passed when a second process replaced its module before it was checked. This reproduced on native Windows and Linux.

The patched CLI reserves an explicit work directory until validation finishes. A second patched run targeting that directory exits before changing any artifacts. Give simultaneous runs separate work directories when mixing versions. An older runner can still overwrite artifacts because it does not acquire the lock. Sequential replay keeps the same artifact paths. The empty lock file stays in the directory so contenders lock the same file, and the OS releases the lock when its handle closes. The testing guide now documents separate directories for simultaneous runs.

Independent Radeon 780M verification reproduced the false PASS with real shaders, checked that two patched runners cannot race, and verified sequential reuse.

Reviewer check

python -I tests/test_run_gpu_tests_paths.py WorkDirectory.test_simultaneous_cli_runs_cannot_share_an_explicit_work_directory

The regression exercises the CLI with a second process, a separate work directory, and a retry after the owner exits with a failed result. It requires no GPU, Wine, or game files.

Tested

  • Linux x86-64, Python 3.11.17. 120 GPU-runner unit tests passed.
  • Windows x64, Python 3.12.16. 119 passed, with one platform skip.
  • Two-process baseline and patched comparisons on both systems used synthetic translator/GPU stand-ins. With the fix, the first run reports the intended failure and the second passes on retry.
  • git diff --check and the source-only policy check passed.

GPUs tested: n/a.

AI-assisted: yes.

Checklist

  • Based on current main.
  • One topic.
  • No game data, keys or decryption.

🔄 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/1966 **Author:** [@lgr123](https://github.com/lgr123) **Created:** 11/25/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `lgr123/gpu-test-work-ownership` --- ### 📝 Commits (2) - [`e97e979`](https://github.com/ubiquitarianism/leonida/commit/e97e9791ee76015d470958fa882eec239a62c6ac) Prevent false GPU passes from shared test work directories - [`99228f1`](https://github.com/ubiquitarianism/leonida/commit/99228f11fa8617597f1c4b98a7e5d5bd705fd2b9) Document separate GPU work folders for concurrent runs ### 📊 Changes **3 files changed** (+64 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `docs/testing.md` (+1 -0) 📝 `scripts/run_gpu_tests.py` (+28 -2) 📝 `tests/test_run_gpu_tests_paths.py` (+35 -0) </details> ### 📄 Description Claimed as [GPU-TEST-WORK-OWNERSHIP](https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7168627544). Two GPU test runs sharing explicit `--work` can produce a false PASS. In the reproduction, a failing synthetic `cs_lds` test reported `0/1 passed` when run alone and `1/1 passed` when a second process replaced its module before it was checked. This reproduced on native Windows and Linux. The patched CLI reserves an explicit work directory until validation finishes. A second patched run targeting that directory exits before changing any artifacts. Give simultaneous runs separate work directories when mixing versions. An older runner can still overwrite artifacts because it does not acquire the lock. Sequential replay keeps the same artifact paths. The empty lock file stays in the directory so contenders lock the same file, and the OS releases the lock when its handle closes. The testing guide now documents separate directories for simultaneous runs. [Independent Radeon 780M verification](https://github.com/ubiquitarianism/leonida/pull/1966#issuecomment-7169847627) reproduced the false PASS with real shaders, checked that two patched runners cannot race, and verified sequential reuse. ### Reviewer check `python -I tests/test_run_gpu_tests_paths.py WorkDirectory.test_simultaneous_cli_runs_cannot_share_an_explicit_work_directory` The regression exercises the CLI with a second process, a separate work directory, and a retry after the owner exits with a failed result. It requires no GPU, Wine, or game files. ### Tested - Linux x86-64, Python 3.11.17. 120 GPU-runner unit tests passed. - Windows x64, Python 3.12.16. 119 passed, with one platform skip. - Two-process baseline and patched comparisons on both systems used synthetic translator/GPU stand-ins. With the fix, the first run reports the intended failure and the second passes on retry. - git diff --check and the source-only policy check passed. GPUs tested: n/a. AI-assisted: yes. ### Checklist - [x] Based on current main. - [x] One topic. - [x] No game data, keys or decryption. --- <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#1972
No description provided.