Documented tree replacement (the history has no git-subtree metadata): 3-way merge of the old subtree (570201a:engine/strata) against upstream 41cf05a06a25dd29103b7b27a2279a3f60c21876 (2026-10-25), merge base = the old pin d9ab8435 (tree-identical to upstream 5b734e42; d9ab8435 is not an ancestor of upstream main). Local patches re-applied by hand where they conflicted (15 files): STRATA_CUDA_STATIC profile, experimental KAR experts and KAR PLE arms, keyless V-only arm (now beside upstream's K8V4 hybrid KV and fused norm+rope). Details, conflict table and left-out files are in docs/upstream.md. Left out (weights, captures, logs, media): new bench/results (2022 files), binary media and app assets (61), docs/work/evidence (24), *.bin / *.gguf data files, and the 7 files the first import already left out. scripts/build-cpu.sh: build the 11 CPU tests upstream registered since the old pin (they ran as "Not Run"). Checked: build-cpu.sh 16/16 ctest in WSL; sm_86 CUDA objects of the patched files compile, also with the KAR macros on. No GPU run, no quality gate. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
66 lines
2.8 KiB
Python
66 lines
2.8 KiB
Python
"""setup.find_tool takes the virtualenv's own cmake before a PATH one and skips a cmake older than CMakeLists.txt needs (#3822).
|
|
|
|
python -m unittest tools.test_setup_find_tool
|
|
"""
|
|
from __future__ import annotations
|
|
|
|
import sys
|
|
import tempfile
|
|
import unittest
|
|
from pathlib import Path
|
|
from unittest import mock
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
sys.path.insert(0, str(ROOT))
|
|
import setup # noqa: E402
|
|
|
|
|
|
class FindTool(unittest.TestCase):
|
|
def setUp(self):
|
|
self.tmp = tempfile.TemporaryDirectory()
|
|
self.addCleanup(self.tmp.cleanup)
|
|
self.bin = Path(self.tmp.name) / "venv" / "bin"
|
|
self.bin.mkdir(parents=True)
|
|
self.venv_python = self.bin / "python"
|
|
|
|
def versions(self, table):
|
|
return lambda path, name: table.get(str(path), (False, ()))
|
|
|
|
def venv_tool(self, name="cmake"):
|
|
return str(self.bin / (name + (".exe" if setup.WIN else "")))
|
|
|
|
def find(self, table, on_path, name="cmake", venv_copy=True):
|
|
if venv_copy:
|
|
Path(self.venv_tool(name)).write_text("x")
|
|
with mock.patch.object(setup.sys, "executable", str(self.venv_python)), \
|
|
mock.patch.object(setup.shutil, "which", return_value=on_path), \
|
|
mock.patch.object(setup, "_tool_version", side_effect=self.versions(table)), \
|
|
mock.patch.object(setup.Path, "home", return_value=Path(self.tmp.name) / "home"):
|
|
return setup.find_tool(name), setup.tool_usable(name)
|
|
|
|
def test_the_virtualenv_copy_wins_over_an_old_system_cmake(self):
|
|
got, usable = self.find({"/usr/bin/cmake": (True, (3, 22, 1)), self.venv_tool(): (True, (4, 1, 0))}, "/usr/bin/cmake")
|
|
self.assertEqual(got, self.venv_tool())
|
|
self.assertTrue(usable)
|
|
|
|
def test_an_old_cmake_on_its_own_is_returned_but_not_usable(self):
|
|
got, usable = self.find({"/usr/bin/cmake": (True, (3, 22, 1))}, "/usr/bin/cmake", venv_copy=False)
|
|
self.assertEqual(got, "/usr/bin/cmake") # the build would say "CMake 3.24 or higher is required"
|
|
self.assertFalse(usable) # so setup installs the pip cmake first
|
|
|
|
def test_a_new_enough_system_cmake_is_fine_without_a_venv_one(self):
|
|
got, usable = self.find({"/usr/bin/cmake": (True, (3, 28, 3))}, "/usr/bin/cmake", venv_copy=False)
|
|
self.assertEqual((got, usable), ("/usr/bin/cmake", True))
|
|
|
|
def test_ninja_has_no_version_floor(self):
|
|
got, usable = self.find({"/usr/bin/ninja": (True, (1, 10))}, "/usr/bin/ninja", "ninja", venv_copy=False)
|
|
self.assertTrue(usable)
|
|
|
|
def test_a_launcher_that_does_not_run_is_skipped(self):
|
|
got, _ = self.find({self.venv_tool(): (False, ()), "/usr/bin/cmake": (True, (3, 30, 0))}, "/usr/bin/cmake")
|
|
self.assertEqual(got, "/usr/bin/cmake")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|