tests: isolate semantic worker Python processes (TEST-SEMANTIC-ISOLATED-WORKERS) #863

Closed
KernelSmoker wants to merge 1 commit from upstream-pr/863 into main
KernelSmoker commented 2026-11-24 14:47:57 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by KernelSmoker on 2026-11-24T14:47:57Z.


Claimed in the coordination issue as: TEST-SEMANTIC-ISOLATED-WORKERS — https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7134674247

What and why

Run semantic test workers under Python isolated mode so host PYTHONPATH and user site-packages cannot inject imports. The runner explicitly adds its suite directory before importing each module, and the mutant tester adds only its test directory and the semantic suite directory. Add poisoned-PYTHONPATH regressions for serial and parallel runner paths and for semantic mutation tests.

Tested

  • python3 -I tests/test_run_semantic_tests.py: passed (20 tests; its intentional failing-fixture subprocess is expected).
  • python3 -I tests/test_semantic_mutants.py: 13/13 passed.
  • python3 -I scripts/run_semantic_tests.py tests/semantic -j 16 in the Fedora 45 tool container (Python 3.15.2, SPIRV-Tools installed): 465 files, 6,108 tests, 0 failures.
  • python3 -I -m py_compile scripts/run_semantic_tests.py tools/semantic_mutants.py tests/test_run_semantic_tests.py tests/test_semantic_mutants.py: passed.
  • git diff --check: passed. Synthetic tests only; no game files.

GPUs tested: n/a (CPU-only test tooling)

AI-assisted: yes

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5474431232 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/863). Originally posted by [KernelSmoker](https://github.com/KernelSmoker) on 2026-11-24T14:47:57Z. --- Claimed in the coordination issue as: TEST-SEMANTIC-ISOLATED-WORKERS — https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7134674247 ### What and why Run semantic test workers under Python isolated mode so host `PYTHONPATH` and user site-packages cannot inject imports. The runner explicitly adds its suite directory before importing each module, and the mutant tester adds only its test directory and the semantic suite directory. Add poisoned-`PYTHONPATH` regressions for serial and parallel runner paths and for semantic mutation tests. ### Tested - `python3 -I tests/test_run_semantic_tests.py`: passed (20 tests; its intentional failing-fixture subprocess is expected). - `python3 -I tests/test_semantic_mutants.py`: 13/13 passed. - `python3 -I scripts/run_semantic_tests.py tests/semantic -j 16` in the Fedora 45 tool container (Python 3.15.2, SPIRV-Tools installed): **465 files, 6,108 tests, 0 failures**. - `python3 -I -m py_compile scripts/run_semantic_tests.py tools/semantic_mutants.py tests/test_run_semantic_tests.py tests/test_semantic_mutants.py`: passed. - `git diff --check`: passed. Synthetic tests only; no game files. GPUs tested: n/a (CPU-only test tooling) AI-assisted: yes
qhukz13 commented 2026-11-24 15:20:11 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by qhukz13 on 2026-11-24T15:20:11Z.

Review: COMMENTED


Checked 1f76d4a79 as the author of tools/semantic_mutants.py (Linux, CPU only):

  • Plain -I would break the tool: python -I -m unittest <module> from the test's folder cannot import the module (-I drops both PYTHONPATH and the working directory). The bootstrap here puts exactly the test's folder and tests/semantic back on sys.path, so that is handled.
  • tests/test_semantic_mutants.py and tests/test_run_semantic_tests.py: OK.
  • A real run, --lines 11766-11776 tests/semantic/test_alu_div_fixup_f32.py: 5 of 6 mutants caught, the same as before this change on main; --op v_rcp_f64 with test_valu_rcp_f64.py (a file that sets up no sys.path itself) lists its mutants fine.
  • Merges cleanly with #660 and #734, which touch the same file.

LGTM.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6042050507 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/863#pullrequestreview-6042050507). Originally posted by [qhukz13](https://github.com/qhukz13) on 2026-11-24T15:20:11Z. **Review:** COMMENTED --- Checked 1f76d4a79 as the author of `tools/semantic_mutants.py` (Linux, CPU only): - Plain `-I` would break the tool: `python -I -m unittest <module>` from the test's folder cannot import the module (`-I` drops both `PYTHONPATH` and the working directory). The bootstrap here puts exactly the test's folder and `tests/semantic` back on `sys.path`, so that is handled. - `tests/test_semantic_mutants.py` and `tests/test_run_semantic_tests.py`: OK. - A real run, `--lines 11766-11776 tests/semantic/test_alu_div_fixup_f32.py`: 5 of 6 mutants caught, the same as before this change on `main`; `--op v_rcp_f64` with `test_valu_rcp_f64.py` (a file that sets up no `sys.path` itself) lists its mutants fine. - Merges cleanly with #660 and #734, which touch the same file. LGTM.
MoonEyes commented 2026-11-27 23:20:20 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-27T23:20:20Z.


Hi @KernelSmoker, thanks for this pull request. It currently conflicts with main (conflicting file(s): scripts/run_semantic_tests.py), so it carries the needs rebase label. CONTRIBUTING.md asks authors to rebase their branch on main; 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).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7230063103 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/863#issuecomment-7230063103). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-27T23:20:20Z. --- Hi @KernelSmoker, thanks for this pull request. It currently conflicts with `main` (conflicting file(s): `scripts/run_semantic_tests.py`), so it carries the `needs rebase` label. CONTRIBUTING.md asks authors to rebase their branch on `main`; 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).
aslan2142 commented 2026-12-01 11:35:22 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T11:35:22Z.

Review: CHANGES_REQUESTED


Conflicts with main in scripts/run_semantic_tests.py. The worker isolation change (-I) is still not on main (scripts/run_semantic_tests.py:205,250), so please rebase onto current main and trigger a fresh green CI run.

(AI-assisted review.)

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6130415323 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/863#pullrequestreview-6130415323). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T11:35:22Z. **Review:** CHANGES_REQUESTED --- Conflicts with `main` in `scripts/run_semantic_tests.py`. The worker isolation change (`-I`) is still not on `main` (`scripts/run_semantic_tests.py:205,250`), so please rebase onto current `main` and trigger a fresh green CI run. *(AI-assisted review.)*
aslan2142 commented 2026-12-01 17:21:28 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T17:21:28Z.


Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (d3d12/) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools, d3d12/, or general docs), please feel free to reopen it.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7319169767 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/863#issuecomment-7319169767). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T17:21:28Z. --- Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (`d3d12/`) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools, `d3d12/`, or general docs), please feel free to reopen it.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
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.

Reference
ProjectLeonida/mandy!863
No description provided.