Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
Run the llama.cpp keep-install back-compat tests on Windows (#10106)
Daniel Hand983613b5424
diff --git a/.github/workflows/cross-platform-parity-ci.yml b/.github/workflows/cross-platform-parity-ci.ymlindex 74739851e8a..d865a680743 100644--- a/.github/workflows/cross-platform-parity-ci.yml+++ b/.github/workflows/cross-platform-parity-ci.yml@@ -67,6 +67,12 @@ on:- 'tests/python/test_cross_platform_parity.py'- 'tests/python/test_windows_python_venv_hardening.py'- 'tests/python/test_windows_setup_output_encoding.py'+ # studio-backend-ci runs tests/studio/install on ubuntu only, so the windows+ # row here is the sole place the keep path meets a real loader. install_*.py+ # above is only the entrypoint; these two are the rest of what it loads.+ - 'tests/studio/install/test_keep_install_backcompat_9979.py'+ - 'studio/prebuilt_core.py'+ - 'studio/backend/utils/prebuilt/llama_backend.py'- 'tests/sh/test_install_rollback_lifecycle.sh'- 'tests/studio/test_install_rollback_lifecycle.ps1'- 'tests/studio/test_intel_registry_fallback.ps1'@@ -124,6 +130,12 @@ on:- 'tests/python/test_cross_platform_parity.py'- 'tests/python/test_windows_python_venv_hardening.py'- 'tests/python/test_windows_setup_output_encoding.py'+ # studio-backend-ci runs tests/studio/install on ubuntu only, so the windows+ # row here is the sole place the keep path meets a real loader. install_*.py+ # above is only the entrypoint; these two are the rest of what it loads.+ - 'tests/studio/install/test_keep_install_backcompat_9979.py'+ - 'studio/prebuilt_core.py'+ - 'studio/backend/utils/prebuilt/llama_backend.py'- 'tests/sh/test_install_rollback_lifecycle.sh'- 'tests/studio/test_install_rollback_lifecycle.ps1'- 'tests/studio/test_intel_registry_fallback.ps1'@@ -212,6 +224,7 @@ jobs:tests/test_installer_system32_guard.pytests/test_installer_interactive_prompts.pytests/test_installer_profile_hardening.py+ tests/studio/install/test_keep_install_backcompat_9979.py-q -rs- name: PowerShell rollback lifecycle testsif: runner.os == 'Windows'diff --git a/tests/studio/install/test_keep_install_backcompat_9979.py b/tests/studio/install/test_keep_install_backcompat_9979.pyindex fce4f84c711..22481189c55 100644--- a/tests/studio/install/test_keep_install_backcompat_9979.py+++ b/tests/studio/install/test_keep_install_backcompat_9979.py@@ -10,19 +10,72 @@ hand-built two-key marker; these call the deciders directly with the shapes realcarry.Platforms are simulated through ``HostInfo`` as the rest of this suite does. That covers-the path decisions and payload tables, not the Windows loader or macOS dyld.+the path decisions and payload tables, not macOS dyld.++Run natively on Windows too (the parity workflow's windows-latest row), where the loader+answers for real: ``_binary_image_runs`` sees an actual ``ERROR_BAD_EXE_FORMAT`` instead of+a stubbed ``run_capture``. Two things stay POSIX-only there and are skipped rather than+weakened: ``os.chmod`` cannot clear an execute bit Windows does not have, and+``os.access(X_OK)`` is true for any file that exists."""import importlib.utilimport jsonimport os+import shutilimport signalimport subprocessimport sys+import tempfilefrom pathlib import Pathimport pytest+WINDOWS_HOST = os.name == "nt"+# os.access(path, os.X_OK) answers "does this exist" on Windows, so the executable=False+# trees below are indistinguishable from healthy ones there.+SKIP_X_OK = pytest.mark.skipif(+ WINDOWS_HOST,+ reason = "os.access(X_OK) is always true on Windows, so the guard is POSIX only",+)+++def _windows_runnable_stub() -> bytes | None:+ """Bytes of a real .exe that still starts after being copied somewhere else.++ The keep path execs what it finds, so a Windows row needs a genuine PE. Copying+ python.exe alone loses python3xx.dll and dies 0xC0000135, hence a System32 tool+ whose imports are all KnownDLLs. Verified by running the copy, not assumed: an+ unverifiable stub skips the module instead of reporting the loader's refusal as+ a back-compat failure.+ """+ for name in ("where.exe", "hostname.exe"):+ source = Path(os.environ.get("SystemRoot", r"C:\Windows")) / "System32" / name+ if not source.is_file():+ continue+ with tempfile.TemporaryDirectory() as probe_dir:+ copy = Path(probe_dir) / "llama-server.exe"+ try:+ shutil.copyfile(source, copy)+ probe = subprocess.run([str(copy)], capture_output = True, timeout = 30)+ except Exception:+ continue+ # A loader failure returns rather than raises, so an unchecked run would+ # accept the very missing-DLL image this is picking a candidate to avoid,+ # and every healthy fixture after it would inherit it.+ if probe.returncode >= 0xC0000000:+ continue+ return source.read_bytes()+ return None+++RUNNABLE_STUB = _windows_runnable_stub() if WINDOWS_HOST else None+if WINDOWS_HOST and RUNNABLE_STUB is None:+ pytest.skip(+ "no self-contained System32 .exe to stand in for llama-server",+ allow_module_level = True,+ )+PACKAGE_ROOT = Path(__file__).resolve().parents[3]MODULE_PATH = PACKAGE_ROOT / "studio" / "install_llama_prebuilt.py"@@ -141,9 +194,13 @@ def build_install(if path.parent != install_direlse (runnable if runnable_root is None else runnable_root))- # A real runnable stub: the keep path execs these, and an empty file that kept- # its mode bits is the ENOEXEC case.- path.write_text("#!/bin/sh\nexit 0\n" if ok else "", encoding = "utf-8")+ # A real runnable stub: the keep path execs these. The not-ok file is the bad+ # image case, ENOEXEC on POSIX and a genuine ERROR_BAD_EXE_FORMAT on Windows,+ # where an empty file is instead a valid do-nothing program.+ if WINDOWS_HOST:+ path.write_bytes(RUNNABLE_STUB if ok else b"not a PE image\n")+ else:+ path.write_text("#!/bin/sh\nexit 0\n" if ok else "", encoding = "utf-8")os.chmod(path, 0o755 if executable else 0o644)(install_dir / "convert_hf_to_gguf.py").write_text("", encoding = "utf-8")(install_dir / "gguf-py").mkdir()@@ -461,6 +518,7 @@ def test_a_windows_loader_failure_is_rejected_even_though_it_exits_zero_ish(tmp_assert ILP._existing_install_runs(install_dir, WINDOWS) is False+@SKIP_X_OKdef test_a_non_executable_tree_fails_the_same_gate_setup_sh_uses(tmp_path):"""setup.sh reuses on ``[ -x build/bin/llama-server ]``; the keep path must agree."""install_dir = build_install(