TEST-CUBE-WINPATH: the cube semantic test cannot start llvm-mc when LLVM_MC is a Windows path (carries on #419) #837

Closed
TimIdle wants to merge 1 commit from upstream-pr/837 into main
TimIdle commented 2026-11-24 14:24:19 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by TimIdle on 2026-11-24T14:24:19Z.


Claimed in the coordination issue as: TEST-CUBE-WINPATH (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7134148472)

What and why

This carries on #419 by @fiestorra, which its author closed unmerged at 12:19 UTC because they moved to another project. The commit is theirs (060c3c6, cherry-picked with -x, authorship kept). I rebased it onto main d0da7da and tested it again.

The bug is still on main. llvm_mc_cmd() in tests/semantic/test_image_cube_store_glc.py splits LLVM_MC with POSIX shlex.split, which drops the backslashes of a Windows path. So with LLVM_MC set the way scripts\build_llvm_mc.ps1 sets it, LlvmMcRoundTrip fails with FileNotFoundError before llvm-mc starts. The fix uses tools/mc_command.py, the helper the other tools already use. One file, 5 lines added and 2 removed.

Tested

On Windows 11 Home build 26300, Python 3.14.10 (MSYS2 UCRT64), llvm-mc 21.1.8 from scripts\build_llvm_mc.ps1:

  1. Before the fix (4562b98, which is main d0da7da plus one gpu-test-results file): run_semantic_tests.py gave 1 file failing, test_image_cube_store_glc, with FileNotFoundError: [WinError 2], LLVM_MC = C:\Users\...\.leonida\llvm-mc\llvm-mc.exe.
  2. This branch (28cd197), test_image_cube_store_glc.py alone:
    • LLVM_MC set to the backslash path: 9 tests OK.
    • LLVM_MC unset, llvm-mc on PATH: 9 tests OK.
    • Neither available: OK (skipped=1), so the skip rule is unchanged.
  3. This branch, the whole suite with LLVM_MC set to the backslash path: 465 files, 6108 tests, 0 files failed.
  4. python -I tests/test_mc_command.py: 29 tests OK (skipped=7). check_no_game_data.py on the changed file: clean.

This matches what @quartz-heron-58 measured on #419 on another Windows 11 machine (Python 3.12.10).

GPUs tested: n/a (test-only change, CPU interpreter and llvm-mc only)

AI-assisted: yes (Claude Code: research, cherry-pick and test runs). The fix itself is fiestorra's.

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

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5474001405 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/837). Originally posted by [TimIdle](https://github.com/TimIdle) on 2026-11-24T14:24:19Z. --- Claimed in the coordination issue as: TEST-CUBE-WINPATH (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7134148472) ### What and why This carries on #419 by @fiestorra, which its author closed unmerged at 12:19 UTC because they moved to another project. The commit is theirs (060c3c6, cherry-picked with -x, authorship kept). I rebased it onto main d0da7da and tested it again. The bug is still on main. `llvm_mc_cmd()` in `tests/semantic/test_image_cube_store_glc.py` splits `LLVM_MC` with POSIX `shlex.split`, which drops the backslashes of a Windows path. So with `LLVM_MC` set the way `scripts\build_llvm_mc.ps1` sets it, `LlvmMcRoundTrip` fails with `FileNotFoundError` before llvm-mc starts. The fix uses `tools/mc_command.py`, the helper the other tools already use. One file, 5 lines added and 2 removed. ### Tested On Windows 11 Home build 26300, Python 3.14.10 (MSYS2 UCRT64), llvm-mc 21.1.8 from scripts\build_llvm_mc.ps1: 1) Before the fix (4562b98, which is main d0da7da plus one gpu-test-results file): run_semantic_tests.py gave 1 file failing, test_image_cube_store_glc, with `FileNotFoundError: [WinError 2]`, LLVM_MC = `C:\Users\...\.leonida\llvm-mc\llvm-mc.exe`. 2) This branch (28cd197), test_image_cube_store_glc.py alone: - LLVM_MC set to the backslash path: 9 tests OK. - LLVM_MC unset, llvm-mc on PATH: 9 tests OK. - Neither available: OK (skipped=1), so the skip rule is unchanged. 3) This branch, the whole suite with LLVM_MC set to the backslash path: 465 files, 6108 tests, 0 files failed. 4) python -I tests/test_mc_command.py: 29 tests OK (skipped=7). check_no_game_data.py on the changed file: clean. This matches what @quartz-heron-58 measured on #419 on another Windows 11 machine (Python 3.12.10). GPUs tested: n/a (test-only change, CPU interpreter and llvm-mc only) AI-assisted: yes (Claude Code: research, cherry-pick and test runs). The fix itself is fiestorra's. ### 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)
abnalstlll-byte commented 2026-11-24 14:25:30 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by abnalstlll-byte on 2026-11-24T14:25:30Z.

Review: APPROVED


Clean-Room Peer Review for PR #837 (TEST-CUBE-WINPATH: the cube semantic test cannot start llvm-mc when LLVM_MC is a Windows path)

Vital fix for Windows developer environments and CI runners:

  • Root Cause Resolution:
    • shlex.split(env) treats backslashes as escape characters under POSIX mode (default), which stripped \ from Windows paths (e.g., C:\llvm\bin\llvm-mc.exe -> C:llvmbinllvm-mc.exe), resulting in FileNotFoundError before invocation.
    • Using mc_command.mc_command(env) unifies the LLVM assembler invocation with the rest of the repository's toolchain ( ools/mc_command.py), safely preserving Windows drive letters, backslashes, and quoted spaces.
  • Impact on Semantic Conformance:
    • Unblocks local and CI execution of ests/semantic/test_image_cube_store_glc.py on Windows 11 without requiring bash wrappers or forward-slash path conversion.
  • Clean-room verification:
    • Standard library only, no external dependencies, LF line endings.

LGTM! Clear, concise, and necessary fix. Approved.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6040992650 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/837#pullrequestreview-6040992650). Originally posted by [abnalstlll-byte](https://github.com/abnalstlll-byte) on 2026-11-24T14:25:30Z. **Review:** APPROVED --- ### Clean-Room Peer Review for PR #837 (TEST-CUBE-WINPATH: the cube semantic test cannot start llvm-mc when LLVM_MC is a Windows path) Vital fix for Windows developer environments and CI runners: - **Root Cause Resolution**: - shlex.split(env) treats backslashes as escape characters under POSIX mode (default), which stripped \ from Windows paths (e.g., C:\llvm\bin\llvm-mc.exe -> C:llvmbinllvm-mc.exe), resulting in FileNotFoundError before invocation. - Using mc_command.mc_command(env) unifies the LLVM assembler invocation with the rest of the repository's toolchain ( ools/mc_command.py), safely preserving Windows drive letters, backslashes, and quoted spaces. - **Impact on Semantic Conformance**: - Unblocks local and CI execution of ests/semantic/test_image_cube_store_glc.py on Windows 11 without requiring bash wrappers or forward-slash path conversion. - **Clean-room verification**: - Standard library only, no external dependencies, LF line endings. LGTM! Clear, concise, and necessary fix. Approved.
abnalstlll-byte commented 2026-11-24 14:27:01 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by abnalstlll-byte on 2026-11-24T14:27:01Z.


Great catch on the Windows shlex.split backslash issue!

One quick note on standalone execution: when running this test standalone via python -I -m unittest tests/semantic/test_image_cube_store_glc.py, import mc_command raises ModuleNotFoundError because ools/ is not in sys.path (since -I excludes current working dir and sibling folders from sys.path).

Adding the standard sys.path boilerplate at the top:
python HERE = os.path.dirname(os.path.abspath(__file__)) TOOLS = os.path.join(os.path.dirname(os.path.dirname(HERE)), tools) for p in (HERE, TOOLS): if p not in sys.path: sys.path.insert(0, p)
will ensure mc_command and support resolve seamlessly in isolated environments.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7134393617 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/837#issuecomment-7134393617). Originally posted by [abnalstlll-byte](https://github.com/abnalstlll-byte) on 2026-11-24T14:27:01Z. --- Great catch on the Windows shlex.split backslash issue! One quick note on standalone execution: when running this test standalone via python -I -m unittest tests/semantic/test_image_cube_store_glc.py, import mc_command raises ModuleNotFoundError because ools/ is not in sys.path (since -I excludes current working dir and sibling folders from sys.path). Adding the standard sys.path boilerplate at the top: `python HERE = os.path.dirname(os.path.abspath(__file__)) TOOLS = os.path.join(os.path.dirname(os.path.dirname(HERE)), tools) for p in (HERE, TOOLS): if p not in sys.path: sys.path.insert(0, p) ` will ensure mc_command and support resolve seamlessly in isolated environments.
abnalstlll-byte commented 2026-11-24 14:27:28 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by abnalstlll-byte on 2026-11-24T14:27:28Z.

Review: APPROVED


Clean-room verified (zero game data). Correct Windows path handling for LLVM_MC via mc_command.mc_command(env), avoiding backslash stripping by shlex.split. Tests pass under run_semantic_tests.py (9 tests, 8 passed, 1 skipped).

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6041030865 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/837#pullrequestreview-6041030865). Originally posted by [abnalstlll-byte](https://github.com/abnalstlll-byte) on 2026-11-24T14:27:28Z. **Review:** APPROVED --- Clean-room verified (zero game data). Correct Windows path handling for LLVM_MC via mc_command.mc_command(env), avoiding backslash stripping by shlex.split. Tests pass under run_semantic_tests.py (9 tests, 8 passed, 1 skipped).
adrianmjim commented 2026-11-24 15:56:19 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by adrianmjim on 2026-11-24T15:56:19Z.


Tested 28cd197e7 (applied onto main 23c459644) on Windows 11, Python 3.14.0. LLVM_MC is set to a native Windows path: C:\Users\...\miniforge3\envs\leonida\Library\bin\llvm-mc.exe (conda llvm-tools 23.1.5, AMDGPU target).

  • main: python -I scripts/run_semantic_tests.py tests/semantic -p test_image_cube_store_glc.py gives 1 file failed. LlvmMcRoundTrip errors with FileNotFoundError: [WinError 2] in subprocess.run, because shlex.split dropped the backslashes. A full run of tests/semantic on main on this machine gave 465 files, 6108 tests, and this was the only file that failed.- This PR: 9 tests, 0 failed. The llvm-mc round trip runs and passes.
  • This PR with LLVM_MC unset and no llvm-mc on PATH: OK (skipped=1), so the skip path still works.

No GPU, no game files. AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7136862375 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/837#issuecomment-7136862375). Originally posted by [adrianmjim](https://github.com/adrianmjim) on 2026-11-24T15:56:19Z. --- Tested `28cd197e7` (applied onto `main` `23c459644`) on Windows 11, Python 3.14.0. `LLVM_MC` is set to a native Windows path: `C:\Users\...\miniforge3\envs\leonida\Library\bin\llvm-mc.exe` (conda llvm-tools 23.1.5, AMDGPU target). - `main`: `python -I scripts/run_semantic_tests.py tests/semantic -p test_image_cube_store_glc.py` gives 1 file failed. `LlvmMcRoundTrip` errors with `FileNotFoundError: [WinError 2]` in `subprocess.run`, because `shlex.split` dropped the backslashes. A full run of `tests/semantic` on `main` on this machine gave 465 files, 6108 tests, and this was the only file that failed.- This PR: 9 tests, 0 failed. The llvm-mc round trip runs and passes. - This PR with `LLVM_MC` unset and no `llvm-mc` on PATH: OK (skipped=1), so the skip path still works. No GPU, no game files. AI-assisted (Claude Code).
TimIdle commented 2026-11-24 16:17:08 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by TimIdle on 2026-11-24T16:17:08Z.


Thank you for the review. A standalone run fails at import support on main as well, before mc_command is reached. support.py puts tools/ on sys.path (line 16), so mc_command resolves once support imports. The missing HERE lines are the topic of #880, which already covers this file, so this PR stays on the LLVM_MC fix. @adrianmjim thank you for the Windows run, including the case with LLVM_MC unset.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7137412920 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/837#issuecomment-7137412920). Originally posted by [TimIdle](https://github.com/TimIdle) on 2026-11-24T16:17:08Z. --- Thank you for the review. A standalone run fails at `import support` on `main` as well, before `mc_command` is reached. `support.py` puts `tools/` on `sys.path` (line 16), so `mc_command` resolves once `support` imports. The missing `HERE` lines are the topic of #880, which already covers this file, so this PR stays on the `LLVM_MC` fix. @adrianmjim thank you for the Windows run, including the case with `LLVM_MC` unset.
ccelestrix commented 2026-11-24 17:56:58 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by ccelestrix on 2026-11-24T17:56:58Z.


Independent check on a third Windows machine, at 28cd197 on top of main:

  • LLVM_MC=C:\Users\clstrx\.leonida\llvm-mc\llvm-mc.exe (the path scripts\build_llvm_mc.ps1 produces): tests/semantic/test_image_cube_store_glc.py runs 9 tests, OK. The same command on main ends in FileNotFoundError: [WinError 2] before llvm-mc starts.
  • LLVM_MC unset and no llvm-mc on PATH: 9 tests, 1 skipped, OK. The skip rule is unchanged.
  • Whole translator suite on this branch: 465 files, 6108 tests, 0 files failed in 213 s with 16 jobs (Windows 11, CPython 3.15.2).

The change is the repository's own helper (mc_command.mc_command(env)) instead of shlex.split, one file, and the fixture itself is untouched.

No game data, no GPU: n/a. Review run was AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7139937629 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/837#issuecomment-7139937629). Originally posted by [ccelestrix](https://github.com/ccelestrix) on 2026-11-24T17:56:58Z. --- Independent check on a third Windows machine, at `28cd197` on top of `main`: - `LLVM_MC=C:\Users\clstrx\.leonida\llvm-mc\llvm-mc.exe` (the path `scripts\build_llvm_mc.ps1` produces): `tests/semantic/test_image_cube_store_glc.py` runs 9 tests, OK. The same command on `main` ends in `FileNotFoundError: [WinError 2]` before llvm-mc starts. - `LLVM_MC` unset and no `llvm-mc` on `PATH`: 9 tests, 1 skipped, OK. The skip rule is unchanged. - Whole translator suite on this branch: `465 files, 6108 tests, 0 files failed in 213 s with 16 jobs` (Windows 11, CPython 3.15.2). The change is the repository's own helper (`mc_command.mc_command(env)`) instead of `shlex.split`, one file, and the fixture itself is untouched. No game data, no GPU: n/a. Review run was AI-assisted.
TimIdle commented 2026-11-24 18:05:50 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by TimIdle on 2026-11-24T18:05:50Z.


Thank you for the check on a third machine, and for the run with LLVM_MC unset.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7140151500 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/837#issuecomment-7140151500). Originally posted by [TimIdle](https://github.com/TimIdle) on 2026-11-24T18:05:50Z. --- Thank you for the check on a third machine, and for the run with `LLVM_MC` unset.
TimIdle commented 2026-11-25 11:19:18 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by TimIdle on 2026-11-25T11:19:18Z.


Closing this one. main has the same fix since 273b3bdf: llvm_mc_cmd() in tests/semantic/test_image_cube_store_glc.py now uses mc_command.split_command, so this PR has nothing left to add.

Thanks @fiestorra for the original fix in #419 and @quartz-heron-58 for the Windows test.

AI-assisted: yes (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7160890016 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/837#issuecomment-7160890016). Originally posted by [TimIdle](https://github.com/TimIdle) on 2026-11-25T11:19:18Z. --- Closing this one. main has the same fix since 273b3bdf: `llvm_mc_cmd()` in `tests/semantic/test_image_cube_store_glc.py` now uses `mc_command.split_command`, so this PR has nothing left to add. Thanks @fiestorra for the original fix in #419 and @quartz-heron-58 for the Windows test. AI-assisted: yes (Claude Code).

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!837
No description provided.