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>
98 lines
4.6 KiB
Python
98 lines
4.6 KiB
Python
"""install.ps1 / install.sh: an ARM computer is refused with the reason and the way out; the Windows script survives the usual environment trouble."""
|
|
|
|
import os
|
|
import shutil
|
|
import subprocess
|
|
import unittest
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parents[2]
|
|
PS1 = ROOT / "packaging" / "install.ps1"
|
|
SH = ROOT / "packaging" / "install.sh"
|
|
|
|
|
|
class Text(unittest.TestCase):
|
|
def test_the_readme_one_liner_cannot_succeed_on_a_failed_download(self):
|
|
for name in ("README.md", "README.de.md", "docs/INSTALL.md", "docs/TERMINAL_LAUNCH.md"):
|
|
text = (ROOT / name).read_text(encoding="utf-8")
|
|
self.assertNotIn("install.sh | sh", text, name) # `curl ... | sh` runs nothing and exits 0 when curl fails
|
|
self.assertIn("install.sh -o install.sh && sh install.sh", text, name)
|
|
|
|
def setUp(self):
|
|
self.ps1 = PS1.read_text(encoding="utf-8")
|
|
self.sh = SH.read_text(encoding="utf-8")
|
|
|
|
def test_arm_is_refused_with_a_reason_and_a_next_step(self):
|
|
self.assertIn("Windows on ARM PC", self.ps1)
|
|
self.assertIn("no engine for ARM", self.ps1)
|
|
self.assertNotIn("has no Strata Terminal yet", self.ps1)
|
|
self.assertIn("ARM processor", self.sh)
|
|
self.assertIn("Apple silicon", self.sh)
|
|
|
|
def test_tls12_proxy_sign_in_and_the_real_error_text(self):
|
|
self.assertIn("Tls12", self.ps1)
|
|
self.assertIn("DefaultNetworkCredentials", self.ps1)
|
|
self.assertIn("$($_.Exception.Message)", self.ps1)
|
|
|
|
def test_long_paths_junction_and_running_version(self):
|
|
self.assertIn("tar.exe", self.ps1)
|
|
self.assertIn("STRATA_DATA_DIR to a short folder", self.ps1)
|
|
self.assertIn("$LASTEXITCODE -ne 0 -or -not (Test-Path (Join-Path $current", self.ps1)
|
|
self.assertIn("a program is using it", self.ps1)
|
|
self.assertIn("Windows did not say where your user folder is", self.ps1)
|
|
self.assertNotIn("is the disk full?", self.ps1)
|
|
|
|
|
|
@unittest.skipUnless(shutil.which("powershell"), "no PowerShell")
|
|
class Run(unittest.TestCase):
|
|
def test_native_arm_stops_before_any_download(self):
|
|
env = dict(os.environ, PROCESSOR_ARCHITECTURE="ARM64", STRATA_FEED="http://127.0.0.1:9")
|
|
env.pop("PROCESSOR_ARCHITEW6432", None)
|
|
done = subprocess.run(["powershell", "-NoProfile", "-ExecutionPolicy", "Bypass", "-File", str(PS1)],
|
|
capture_output=True, text=True, env=env, timeout=120)
|
|
self.assertNotEqual(done.returncode, 0)
|
|
self.assertIn("Windows on ARM PC", done.stderr + done.stdout)
|
|
self.assertNotIn("Downloading", done.stdout)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|
|
|
|
|
|
@unittest.skipUnless(shutil.which("sh") and os.uname().sysname in ("Linux", "Darwin") if hasattr(os, "uname") else False, "needs sh on Linux or macOS")
|
|
class InstallShFailsVisibly(unittest.TestCase):
|
|
"""A broken download of install.sh must not look like a finished install."""
|
|
|
|
def run_sh(self, text, **env):
|
|
import tempfile
|
|
with tempfile.TemporaryDirectory() as d:
|
|
f = Path(d) / "install.sh"
|
|
f.write_text(text, encoding="utf-8", newline="\n")
|
|
home = Path(d) / "home"
|
|
home.mkdir()
|
|
r = subprocess.run(["sh", str(f)], capture_output=True, text=True, timeout=120,
|
|
env={**os.environ, "HOME": str(home), "STRATA_DATA_DIR": str(home / "data"), "STRATA_BIN_DIR": str(home / "bin"), **env})
|
|
return r, home
|
|
|
|
def test_the_script_is_one_function_called_on_the_last_line(self):
|
|
text = SH.read_text(encoding="utf-8")
|
|
self.assertIn("\nmain() {", text)
|
|
self.assertEqual(text.rstrip().splitlines()[-1], 'main "$@"')
|
|
|
|
def test_syntax(self):
|
|
self.assertEqual(subprocess.run(["sh", "-n", str(SH)], capture_output=True).returncode, 0)
|
|
|
|
def test_a_half_downloaded_script_runs_nothing_and_fails(self):
|
|
lines = SH.read_text(encoding="utf-8").splitlines(True)
|
|
r, home = self.run_sh("".join(lines[:int(len(lines) * 0.8)]))
|
|
self.assertNotEqual(r.returncode, 0)
|
|
self.assertFalse((home / "data").exists() or (home / "bin").exists())
|
|
|
|
def test_an_unreachable_release_folder_stops_with_a_reason_and_a_failing_exit(self):
|
|
if not shutil.which("curl") and not shutil.which("wget"):
|
|
self.skipTest("no curl or wget")
|
|
r, home = self.run_sh(SH.read_text(encoding="utf-8"), STRATA_FEED="http://127.0.0.1:9")
|
|
self.assertEqual(r.returncode, 1)
|
|
self.assertIn("could not read", r.stderr)
|
|
self.assertFalse((home / "bin" / "strata").exists())
|