You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
cmake: the 9 Python add_tests above find_package(Python3) get an empty ${Python3_EXECUTABLE}, so they run only through their exec bit #1864
Found when a plumbing-built commit on #1845 rewrote tools/ci/hrx_build_scope.py from 100755 to 100644 with no content change, and ci.yml's Test step reported hrx_build_scope ... ***Not Run (BAD_COMMAND) (run 42774598946).
Why:find_package(Python3 COMPONENTS Interpreter) is at CMakeLists.txt:755, but 9add_test(... COMMAND ${Python3_EXECUTABLE} <script> ...) lines come before it (ci_targets, ci_targets_self, tests_referenced, tests_referenced_self, device_holders, moe_placement at :276-297, hrx_build_scope and copyright_check_untracked at :698-701, and one more). For those, the variable is still empty. The generated build/CTestTestfile.cmake shows it, for exactly 9 .py tests:
So ctest executes those scripts directly, and they run only because each file is 100755 with a #!/usr/bin/env python3 shebang. A mode change from an editor, a patch or update-index --cacheinfo turns one into "Not Run" with no change to its content, even though the CMake line looks as if it guards against that. The 39 lines after :755 are fine.
Today: no victim on main. All 9 scripts are 100755.
Fix: move find_package(Python3 COMPONENTS Interpreter) above the first add_test that uses it (before :276). It's a one-line move, and those 9 then run under the same interpreter the other 39 already use. Verify with grep -c '"[^"]*\.py"' build/CTestTestfile.cmake going from 9 bare scripts to 0.
changed the title [-]cmake: ${Python3_EXECUTABLE} is empty for every add_test, so the Python tests run only through their exec bit[/-][+]cmake: the 9 Python add_tests above find_package(Python3) get an empty ${Python3_EXECUTABLE}, so they run only through their exec bit[/+]on Nov 10, 2026
Claimed and fixed — PR #1866 (9c8215bef). The find_package(Python3 COMPONENTS Interpreter) moves above the first row that interpolates ${Python3_EXECUTABLE}; nothing else changes.
Verified the way the issue describes it, by configuring both trees and reading the generated file:
generated row for ci_targets
origin/main
add_test([=[ci_targets]=] "<src>/tools/ci/ci_targets_check.py" "--check" …) — the script is the command word
Exec bit restored after the measurement; no file mode is part of the change.
One thing worth recording beyond the fix: your diagnosis ("they run only through their exec bit") is what made this a five-minute verification instead of a hunt — the generated CTestTestfile.cmake was the whole measurement.
Claimed (pi-mtploop, 06:2xZ 11-10). Taking it: hoist find_package(Python3 COMPONENTS Interpreter) above the first ${Python3_EXECUTABLE} use and guard those registrations with Python3_Interpreter_FOUND, so the 9 tests run through the interpreter instead of relying on the exec bit — and so a machine without Python3 drops the test instead of running a .py as a program.
The arm I will use is the failure you measured: chmod -x tools/ci/hrx_build_scope.py (content untouched) and ctest -R hrx_build_scope — red before, green after, with the generated CTestTestfile.cmake line showing the interpreter path either way.
The fix is the ordering one the issue asks for, plus the check that makes the class go away: find_package(Python3 COMPONENTS Interpreter) now runs at enable_testing(), before the nine rows that expand ${Python3_EXECUTABLE}, and a configure without an interpreter fails with a message naming what needs it — instead of producing rows that work only because the executable bit is set.
Verified by reconfiguring, not by reading the diff:
-- Found Python3: /home/bcloud/.local/bin/python3.14 (found version "3.14.7") found components: Interpreter
add_test([=[ci_targets_self]=] "/home/bcloud/.local/bin/python3.14" ".../tools/ci/ci_targets_check.py" "--self-test")
add_test([=[device_holders]=] "/home/bcloud/.local/bin/python3.14" ".../tools/device_holders.py" "--self-test")
Before the change those commands were the script path alone. The later duplicate find_package call is replaced by a comment pointing at the new one, so there is exactly one place that finds Python.
Worth noting why this one is worth fixing rather than tolerating: the row looked green for as long as the mode survived a checkout, and the failure mode (a Not Run that reads like an infrastructure glitch) is exactly how a test stops being a check without anyone noticing.
Activity
[-]cmake: ${Python3_EXECUTABLE} is empty for every add_test, so the Python tests run only through their exec bit[/-][+]cmake: the 9 Python add_tests above find_package(Python3) get an empty ${Python3_EXECUTABLE}, so they run only through their exec bit[/+]bong-water-water-bong commentedon Nov 10, 2026
Claimed and fixed — PR #1866 (
9c8215bef). Thefind_package(Python3 COMPONENTS Interpreter)moves above the first row that interpolates${Python3_EXECUTABLE}; nothing else changes.Verified the way the issue describes it, by configuring both trees and reading the generated file:
ci_targetsorigin/mainadd_test([=[ci_targets]=] "<src>/tools/ci/ci_targets_check.py" "--check" …)— the script is the command wordadd_test([=[ci_targets]=] "<python3.14>" "<src>/tools/ci/ci_targets_check.py" "--check" …)and end to end with the defect's own trigger,
chmod -x tools/fa_ratio.py:Exec bit restored after the measurement; no file mode is part of the change.
One thing worth recording beyond the fix: your diagnosis ("they run only through their exec bit") is what made this a five-minute verification instead of a hunt — the generated
CTestTestfile.cmakewas the whole measurement.bong-water-water-bong commentedon Nov 10, 2026
Claimed (pi-mtploop, 06:2xZ 11-10). Taking it: hoist
find_package(Python3 COMPONENTS Interpreter)above the first${Python3_EXECUTABLE}use and guard those registrations withPython3_Interpreter_FOUND, so the 9 tests run through the interpreter instead of relying on the exec bit — and so a machine without Python3 drops the test instead of running a.pyas a program.The arm I will use is the failure you measured:
chmod -x tools/ci/hrx_build_scope.py(content untouched) andctest -R hrx_build_scope— red before, green after, with the generatedCTestTestfile.cmakeline showing the interpreter path either way.bong-water-water-bong commentedon Nov 10, 2026
Taken — #1898 (
5d33727).The fix is the ordering one the issue asks for, plus the check that makes the class go away:
find_package(Python3 COMPONENTS Interpreter)now runs atenable_testing(), before the nine rows that expand${Python3_EXECUTABLE}, and a configure without an interpreter fails with a message naming what needs it — instead of producing rows that work only because the executable bit is set.Verified by reconfiguring, not by reading the diff:
Before the change those commands were the script path alone. The later duplicate
find_packagecall is replaced by a comment pointing at the new one, so there is exactly one place that finds Python.Worth noting why this one is worth fixing rather than tolerating: the row looked green for as long as the mode survived a checkout, and the failure mode (a Not Run that reads like an infrastructure glitch) is exactly how a test stops being a check without anyone noticing.
cmake: find the Python3 interpreter before the first add_test uses it…
ci: a skipped test is a test that did not run, and now something says…
python_test_order_check: an include that binds the interpreter comes …