test(build): give the CPM discovery check's toolchain stand-in find and need #561

Merged
HumanBean merged 1 commit from zeldaootr/Longshot:cpm-discovery-test-toolchain-find into main 2026-11-15 17:58:51 +00:00
Contributor

Type: test · Risk: low · Tested on: Linux, no GPU (game-free check); Windows 11 (a reviewer's run of the check) · Needs: none

Why

tests/test_cpm_discovery.py has failed on main since #524 merged, and still fails on main aa95d35f: nx2/build.py now asks toolchain.find("clang") when it is imported, and the check's stand-in for toolchain has no find, so all six tests that import the build stop with an AttributeError before checking anything.

How to reproduce

Seen on: Linux (Ubuntu 24.04), no GPU; Windows 11 (the reviewer's run)
Settings and switches: none
Steps: on main aa95d35f, run python -I -B tests/test_cpm_discovery.py
Expected: 7 tests, OK (one skipped where there are no system Vulkan or SPIR-V headers)
Actual: FAILED (errors=6, skipped=1): AttributeError: 'types.SimpleNamespace' object has no attribute 'find' at _CLANG = toolchain.find("clang") in nx2/build.py

What changed

Test-only: the check's stand-in for toolchain gets the find and need that nx2/build.py now calls at import, so the check runs again and checks the same package discovery as before. No product file changes.

  • tests: tests/test_cpm_discovery.py, the toolchain stand-in in build() gains find and need, behaving as the real ones in third_party/a64-kit/tools/toolchain.py do on a PC without clang: find returns a path that is not a file, and need stops on a missing file. With no clang file, #524's -march=native query is skipped at import, so the check still runs no compiler and no process (the subprocess guards are unchanged).
  • #524's build code is right for the real toolchain, whose find always returns a path; the check's stub predates it (the two changes crossed).

Measurements

Verdict: passes: the check fails on main (6 errors) and passes on this branch, in two interleaved rounds on Linux; a reviewer saw the same on Windows 11.

Hardware: Linux x86-64 PC (Ubuntu 24.04), no GPU used; Python 3.15
Scene: no game: the game-free check
Method: python3 -I -B tests/test_cpm_discovery.py on main and on this branch, twice each, alternating (nx2/build.py is the same in both); its unittest result per run
How to reproduce: python -I -B tests/test_cpm_discovery.py on each commit

Before: main @ aa95d35f After: this PR @ 8bc176f7
tests/test_cpm_discovery.py, round 1 FAILED (errors=6, skipped=1) OK (skipped=1)
tests/test_cpm_discovery.py, round 2 FAILED (errors=6, skipped=1) OK (skipped=1)
aa95d35f r1: FAILED (errors=6, skipped=1)
8bc176f7 r1: OK (skipped=1)
aa95d35f r2: FAILED (errors=6, skipped=1)
8bc176f7 r2: OK (skipped=1)
aa95d35f: nx2/build.py: _CLANG = toolchain.find("clang")
aa95d35f: AttributeError: 'types.SimpleNamespace' object has no attribute 'find'

The skip is test_system_usr_without_cpm (no system Vulkan or SPIR-V headers on this PC), skipped on both.

Flags and settings

None

Testing

Tested: Linux, game-free: the check fails on main aa95d35f and passes on this branch (8bc176f7, rebased onto aa95d35f), twice each, alternating; it passes at the tip under tests/run_all.py with g++ 13.3 and with clang 23.1.5 as CXX (the check runs no compiler). Before the rebase (7d9e4d69 on main 7ff5256e) it did the same, and the other checks that import nx2/build.py with a stand-in toolchain or read the native-CPU code passed: test_cpu_target, test_appimage_player_build, test_linux_tools, test_kept_translation, test_missing_nup, test_mark_groups, test_msvc_oldnames, test_build_log, test_link_path_comma. Windows: futondestroyer reviewed the diff at 7d9e4d69 and ran the check natively on Windows 11 with Python 3.14.7 (python -I -B tests/test_cpm_discovery.py -v): on main 5d3ecc78 six import errors (toolchain.find missing) and one system-header skip; at 7d9e4d69 six passed, the same skip; and this PR's fixture against that newer main's build module, six passed, the same skip (#561, the approving review).

Not tested: nothing the check depends on; the game is not involved.

Must be tested: None

Risks

What could break: only this check.

Turning it off: revert the commit

Compatibility: Nothing changes

Checklist

Everyone

  • One topic.
  • The title is a Conventional Commit (type(scope): description) of the status line's type.
  • Why gives the reason plainly and links the issues that fit (the tracker searched).
  • Measurements has a verdict, or one line saying why there is nothing to measure.
  • Testing names what was tested, what wasn't, and what must still be tested, where and how.
  • Rebased on current main. Onto main aa95d35f, no conflict; the commit is the same change as 7d9e4d69 (git patch-id).
  • python -I -B tests/run_all.py passes (any failure that also fails on main is named). The full suite on main aa95d35f (Linux, g++ 13.3, the Vulkan headers set): 528 passed, 15 failed, 50 skipped, tests/test_cpm_discovery.py among the 15; this PR changes only that check, which passes here. The other 14 fail on main alike: test_appimage_player_build, test_bake_portability, test_crash_dialog, test_env_on, test_lift_cache, test_lift_cleanup_error, test_make_game_cache, test_mods_size_table, test_options_budget_once, test_pipeline_tour, test_readback_late, test_vk_pgo, test_walk_key and nx2/test_texture_init_barrier.py.
  • No game files, dumps, build output or generated files.
  • third_party/ untouched (a new folder with a PROVENANCE.md instead).
  • The license is OK: GPL-3.0-or-later, nothing incompatible and nothing decompiled.

When it applies

  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.
  • Numbers from the same PC, scene and settings, at least 2 interleaved runs each, the median reported.
**Type:** test · **Risk:** low · **Tested on:** Linux, no GPU (game-free check); Windows 11 (a reviewer's run of the check) · **Needs:** none ## Why `tests/test_cpm_discovery.py` has failed on `main` since https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/524 merged, and still fails on `main` aa95d35f: `nx2/build.py` now asks `toolchain.find("clang")` when it is imported, and the check's stand-in for `toolchain` has no `find`, so all six tests that import the build stop with an `AttributeError` before checking anything. ## How to reproduce **Seen on:** Linux (Ubuntu 24.04), no GPU; Windows 11 (the reviewer's run) **Settings and switches:** none **Steps:** on `main` aa95d35f, run `python -I -B tests/test_cpm_discovery.py` **Expected:** 7 tests, OK (one skipped where there are no system Vulkan or SPIR-V headers) **Actual:** `FAILED (errors=6, skipped=1)`: `AttributeError: 'types.SimpleNamespace' object has no attribute 'find'` at `_CLANG = toolchain.find("clang")` in `nx2/build.py` ## What changed Test-only: the check's stand-in for `toolchain` gets the `find` and `need` that `nx2/build.py` now calls at import, so the check runs again and checks the same package discovery as before. No product file changes. - tests: `tests/test_cpm_discovery.py`, the `toolchain` stand-in in `build()` gains `find` and `need`, behaving as the real ones in `third_party/a64-kit/tools/toolchain.py` do on a PC without clang: `find` returns a path that is not a file, and `need` stops on a missing file. With no clang file, #524's `-march=native` query is skipped at import, so the check still runs no compiler and no process (the `subprocess` guards are unchanged). - #524's build code is right for the real `toolchain`, whose `find` always returns a path; the check's stub predates it (the two changes crossed). ## Measurements **Verdict:** passes: the check fails on `main` (6 errors) and passes on this branch, in two interleaved rounds on Linux; a reviewer saw the same on Windows 11. Hardware: Linux x86-64 PC (Ubuntu 24.04), no GPU used; Python 3.15 Scene: no game: the game-free check Method: `python3 -I -B tests/test_cpm_discovery.py` on `main` and on this branch, twice each, alternating (`nx2/build.py` is the same in both); its unittest result per run How to reproduce: `python -I -B tests/test_cpm_discovery.py` on each commit | | Before: main @ aa95d35f | After: this PR @ 8bc176f7 | |---|---|---| | `tests/test_cpm_discovery.py`, round 1 | FAILED (errors=6, skipped=1) | OK (skipped=1) | | `tests/test_cpm_discovery.py`, round 2 | FAILED (errors=6, skipped=1) | OK (skipped=1) | ``` aa95d35f r1: FAILED (errors=6, skipped=1) 8bc176f7 r1: OK (skipped=1) aa95d35f r2: FAILED (errors=6, skipped=1) 8bc176f7 r2: OK (skipped=1) aa95d35f: nx2/build.py: _CLANG = toolchain.find("clang") aa95d35f: AttributeError: 'types.SimpleNamespace' object has no attribute 'find' ``` The skip is `test_system_usr_without_cpm` (no system Vulkan or SPIR-V headers on this PC), skipped on both. ### Flags and settings None ## Testing **Tested:** Linux, game-free: the check fails on `main` aa95d35f and passes on this branch (8bc176f7, rebased onto aa95d35f), twice each, alternating; it passes at the tip under `tests/run_all.py` with g++ 13.3 and with clang 23.1.5 as `CXX` (the check runs no compiler). Before the rebase (7d9e4d69 on main 7ff5256e) it did the same, and the other checks that import `nx2/build.py` with a stand-in `toolchain` or read the native-CPU code passed: `test_cpu_target`, `test_appimage_player_build`, `test_linux_tools`, `test_kept_translation`, `test_missing_nup`, `test_mark_groups`, `test_msvc_oldnames`, `test_build_log`, `test_link_path_comma`. Windows: futondestroyer reviewed the diff at 7d9e4d69 and ran the check natively on Windows 11 with Python 3.14.7 (`python -I -B tests/test_cpm_discovery.py -v`): on main 5d3ecc78 six import errors (`toolchain.find` missing) and one system-header skip; at 7d9e4d69 six passed, the same skip; and this PR's fixture against that newer main's build module, six passed, the same skip (https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/561, the approving review). **Not tested:** nothing the check depends on; the game is not involved. **Must be tested:** None ## Risks **What could break:** only this check. **Turning it off:** revert the commit **Compatibility:** Nothing changes ## Checklist ### Everyone - [x] One topic. - [x] The title is a Conventional Commit (`type(scope): description`) of the status line's type. - [x] Why gives the reason plainly and links the issues that fit (the tracker searched). - [x] Measurements has a verdict, or one line saying why there is nothing to measure. - [x] Testing names what was tested, what wasn't, and what must still be tested, where and how. - [x] Rebased on current `main`. Onto main aa95d35f, no conflict; the commit is the same change as 7d9e4d69 (`git patch-id`). - [x] `python -I -B tests/run_all.py` passes (any failure that also fails on `main` is named). The full suite on main aa95d35f (Linux, g++ 13.3, the Vulkan headers set): 528 passed, 15 failed, 50 skipped, `tests/test_cpm_discovery.py` among the 15; this PR changes only that check, which passes here. The other 14 fail on main alike: `test_appimage_player_build`, `test_bake_portability`, `test_crash_dialog`, `test_env_on`, `test_lift_cache`, `test_lift_cleanup_error`, `test_make_game_cache`, `test_mods_size_table`, `test_options_budget_once`, `test_pipeline_tour`, `test_readback_late`, `test_vk_pgo`, `test_walk_key` and `nx2/test_texture_init_barrier.py`. - [x] No game files, dumps, build output or generated files. - [x] `third_party/` untouched (a new folder with a `PROVENANCE.md` instead). - [x] The license is OK: GPL-3.0-or-later, nothing incompatible and nothing decompiled. ### When it applies - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. - [x] Numbers from the same PC, scene and settings, at least 2 interleaved runs each, the median reported.
give test_cpm_discovery's toolchain stand-in find and need
Some checks failed
beanstalk/approval Test farm not requested
Website / Website on Cloudflare (pull_request_target) Has been skipped
PR description / Description follows the template (pull_request_target) Successful in 6s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
7d9e4d69fd
Assisted-by: Claude
futondestroyer left a comment

Reviewed the complete one-file diff at 7d9e4d69fd and checked the stand-in against the real toolchain.find/need contract. The nonexistent compiler path correctly skips the import-time CPU query; the existing subprocess guards and package-discovery assertions remain intact. No production changes or blocking findings.

Independent native Windows 11 / Python 3.14.7 verification, using python -I -B tests/test_cpm_discovery.py -v:

  • Main control at 5d3ecc7854: six import errors (toolchain.find missing), one existing system-header skip.
  • Exact PR head: six passed, the same one skip.
  • The PR fixture against that newer main's actual build module: six passed, the same one skip. Restored the owned control file after the comparison.

This independently covers the Windows gap in the description. I did not repeat the full suite or run the game for this fixture-only change; the author's full-suite results and limitations remain as documented.

Reviewed the complete one-file diff at 7d9e4d69fd2a0c023c3f9e812ff36e51fd0e1ae5 and checked the stand-in against the real toolchain.find/need contract. The nonexistent compiler path correctly skips the import-time CPU query; the existing subprocess guards and package-discovery assertions remain intact. No production changes or blocking findings. Independent native Windows 11 / Python 3.14.7 verification, using `python -I -B tests/test_cpm_discovery.py -v`: - Main control at 5d3ecc78540534f4efd055b4fc432a3bed9f0459: six import errors (`toolchain.find` missing), one existing system-header skip. - Exact PR head: six passed, the same one skip. - The PR fixture against that newer main's actual build module: six passed, the same one skip. Restored the owned control file after the comparison. This independently covers the Windows gap in the description. I did not repeat the full suite or run the game for this fixture-only change; the author's full-suite results and limitations remain as documented.
Author
Contributor

Rebased onto main aa95d35f (8bc176f7, the same change as 7d9e4d69, no conflict) and the description moved to the current template, with futondestroyer's Windows 11 run from the review in Testing (thank you). The check still fails on main aa95d35f (6 errors) and passes here, two interleaved rounds, so the numbers are measured again on the new base rather than carried over.

Rebased onto `main` aa95d35f (8bc176f7, the same change as 7d9e4d69, no conflict) and the description moved to the current template, with futondestroyer's Windows 11 run from the review in Testing (thank you). The check still fails on `main` aa95d35f (6 errors) and passes here, two interleaved rounds, so the numbers are measured again on the new base rather than carried over.
zeldaootr force-pushed cpm-discovery-test-toolchain-find from 7d9e4d69fd
Some checks failed
beanstalk/approval Test farm not requested
Website / Website on Cloudflare (pull_request_target) Has been skipped
PR description / Description follows the template (pull_request_target) Successful in 6s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
to 8bc176f7de
Some checks are pending
CI / Conventional Commit title (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Blocked by required conditions
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Blocked by required conditions
CI / Workflow lint (actionlint) (pull_request) Blocked by required conditions
Guide screenshots / Guide images and local UI source review (pull_request) Blocked by required conditions
Third-party parts / As their notes say (pull_request) Blocked by required conditions
Third-party parts / The same as upstream (pull_request) Blocked by required conditions
Website / Website on Cloudflare (pull_request) Blocked by required conditions
PR description / Description follows the template (pull_request_target) Successful in 4s
2026-11-15 16:44:00 +00:00
Compare
HumanBean deleted branch cpm-discovery-test-toolchain-find 2026-11-15 17:58:53 +00:00
Some checks are pending
CI / Conventional Commit title (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Blocked by required conditions
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Blocked by required conditions
CI / Workflow lint (actionlint) (pull_request) Blocked by required conditions
Guide screenshots / Guide images and local UI source review (pull_request) Blocked by required conditions
Third-party parts / As their notes say (pull_request) Blocked by required conditions
Third-party parts / The same as upstream (pull_request) Blocked by required conditions
Website / Website on Cloudflare (pull_request) Blocked by required conditions
PR description / Description follows the template (pull_request_target) Successful in 4s
Some workflows are waiting to be reviewed.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
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
MagicBeanDev/Longshot!561
No description provided.