Skip to content

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

Open
KernelSmoker wants to merge 1 commit into
ProjectLeonida:mainfrom
KernelSmoker:kernelsmoker/test-semantic-isolated-workers
Open

KernelSmoker wants to merge 1 commit into
ProjectLeonida:mainfrom
KernelSmoker:kernelsmoker/test-semantic-isolated-workers

Conversation

@KernelSmoker

Copy link
Copy Markdown
Contributor

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

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 qhukz13 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked 1f76d4a 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs rebase Conflicts with the base branch: rebase it on main

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants