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

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

@⁠KernelSmoker on GitHub · 2026-11-24 14:47 UTC · original
KernelSmoker:kernelsmoker/test-semantic-isolated-workers → main · +59 −13 · 4 files · 1 commits · open

Claimed in the coordination issue as: TEST-SEMANTIC-ISOLATED-WORKERS — #14

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

**@⁠KernelSmoker** on GitHub · 2026-11-24 14:47 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/863) `KernelSmoker:kernelsmoker/test-semantic-isolated-workers` → `main` · +59 −13 · 4 files · 1 commits · open Claimed in the coordination issue as: TEST-SEMANTIC-ISOLATED-WORKERS — https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14 ### 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
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:25:13 +00:00
Author
Owner

@⁠qhukz13 on GitHub · 2026-11-24 15:20 UTC · original · reviewed

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.

**@⁠qhukz13** on GitHub · 2026-11-24 15:20 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/863#pullrequestreview-6042050507) · **reviewed** 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.
This pull request has changes conflicting with the target branch.
  • scripts/run_semantic_tests.py
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/863/head:github-bot/gh-863'
git switch 'github-bot/gh-863'

Merge

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