mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-06-17 02:05:22 -04:00
[Bash] Fix Windows cookbook background tasks (#676)
* Fix Windows cookbook background tasks * Add Windows Cookbook reliability follow-ups
This commit is contained in:
@@ -28,6 +28,15 @@ def test_background_status_poll_reconciles_into_local_tasks():
|
||||
assert "completedDeps.forEach(t => _refreshDepsAfterInstall(t));" in source
|
||||
|
||||
|
||||
def test_local_windows_session_commands_use_local_powershell_log_dir():
|
||||
source = _read("static/js/cookbookRunning.js")
|
||||
|
||||
assert "const host = task.remoteHost;" in source
|
||||
assert "host ? '$env:TEMP\\\\odysseus-sessions' : '$env:TEMP\\\\odysseus-tmux'" in source
|
||||
assert "return host ? `ssh ${pf}${host}" in source
|
||||
assert ": `powershell -Command \"${ps}\"`;" in source
|
||||
|
||||
|
||||
def test_dependency_install_payload_keeps_env_path_for_refresh():
|
||||
source = _read("static/js/cookbook.js")
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ from routes.cookbook_helpers import (
|
||||
_pip_install_fallback_chain,
|
||||
_ollama_bind_from_cmd,
|
||||
_safe_env_prefix,
|
||||
_user_shell_path_bootstrap,
|
||||
_venv_safe_local_pip_install_cmd,
|
||||
_validate_gpus,
|
||||
_validate_repo_id,
|
||||
@@ -258,6 +259,17 @@ def test_pip_install_attempt_surfaces_stderr_on_failure():
|
||||
assert "nonexistent" in combined.lower() or result.returncode != 0
|
||||
|
||||
|
||||
def test_local_tooling_path_export_converts_windows_paths_for_bash():
|
||||
line = _local_tooling_path_export(r"C:\Users\Jane Dev\.venv\Scripts\python.exe")
|
||||
assert line == 'export PATH="/c/Users/Jane Dev/.venv/Scripts:$PATH"'
|
||||
assert "C:" not in line
|
||||
|
||||
|
||||
def test_user_shell_path_bootstrap_falls_back_to_python_on_windows_bash():
|
||||
script = "\n".join(_user_shell_path_bootstrap())
|
||||
assert 'command -v python3 >/dev/null 2>&1 || python3() { python "$@"; }' in script
|
||||
|
||||
|
||||
def test_serve_preflight_failure_keeps_tmux_pane_visible():
|
||||
"""Dependency preflight failures should remain visible in tmux output.
|
||||
|
||||
@@ -290,6 +302,17 @@ def test_serve_runner_preserves_command_exit_code():
|
||||
assert 'echo "=== Process exited with code $? ==="' not in script
|
||||
|
||||
|
||||
def test_pip_serve_runner_emits_download_ok_before_exit_marker():
|
||||
"""Dependency installs run through the serve wrapper need the download marker."""
|
||||
runner_lines = ["python3 -m pip install llama-cpp-python"]
|
||||
_append_serve_exit_code_lines(runner_lines, keep_shell_open=False, is_pip_install=True)
|
||||
script = "\n".join(runner_lines)
|
||||
|
||||
assert 'echo "DOWNLOAD_OK"' in script
|
||||
assert script.index('echo "DOWNLOAD_OK"') < script.index("=== Process exited with code")
|
||||
assert 'exit "$ODYSSEUS_CMD_EXIT"' in script
|
||||
|
||||
|
||||
def test_validate_serve_cmd_accepts_vllm_kv_cache_dtype():
|
||||
cmd = (
|
||||
"CUDA_VISIBLE_DEVICES=0,1 vllm serve nvidia/Qwen3.6-35B-A3B-NVFP4 "
|
||||
@@ -410,6 +433,13 @@ def test_llama_cpp_linux_bootstrap_nvcc_without_cudart_warns_and_falls_back():
|
||||
assert script.index(cpu_cmake) < script.index(no_toolchain_warn)
|
||||
|
||||
|
||||
def test_llama_cpp_linux_bootstrap_uses_single_shell_continuations():
|
||||
runner_lines = []
|
||||
_append_llama_cpp_linux_accel_build_lines(runner_lines)
|
||||
|
||||
assert not any(line.endswith("\\\\") for line in runner_lines)
|
||||
|
||||
|
||||
def test_llama_cpp_linux_bootstrap_keeps_cpu_fallback_when_no_gpu_toolchain():
|
||||
runner_lines = []
|
||||
_append_llama_cpp_linux_accel_build_lines(runner_lines)
|
||||
|
||||
@@ -1,6 +1,14 @@
|
||||
"""Regression tests for cross-platform helper behavior."""
|
||||
|
||||
from core import platform_compat
|
||||
import importlib.util
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
_MODULE_PATH = Path(__file__).resolve().parents[1] / "core" / "platform_compat.py"
|
||||
_SPEC = importlib.util.spec_from_file_location("platform_compat_under_test", _MODULE_PATH)
|
||||
platform_compat = importlib.util.module_from_spec(_SPEC)
|
||||
assert _SPEC and _SPEC.loader
|
||||
_SPEC.loader.exec_module(platform_compat)
|
||||
|
||||
|
||||
def _reset_bash_cache(monkeypatch):
|
||||
@@ -35,3 +43,19 @@ def test_find_bash_checks_local_app_data_git_install(monkeypatch):
|
||||
monkeypatch.setattr(platform_compat.os.path, "exists", lambda path: path == expected)
|
||||
|
||||
assert platform_compat.find_bash() == expected
|
||||
|
||||
|
||||
def test_find_bash_skips_windows_wsl_stub(monkeypatch):
|
||||
_reset_bash_cache(monkeypatch)
|
||||
monkeypatch.setattr(platform_compat, "IS_WINDOWS", True)
|
||||
|
||||
stub = r"C:\WINDOWS\system32\bash.exe"
|
||||
expected = r"C:\Program Files\Git\bin\bash.exe"
|
||||
monkeypatch.setattr(
|
||||
platform_compat.shutil,
|
||||
"which",
|
||||
lambda name: stub if name == "bash" else None,
|
||||
)
|
||||
monkeypatch.setattr(platform_compat.os.path, "exists", lambda path: path == expected)
|
||||
|
||||
assert platform_compat.find_bash() == expected
|
||||
|
||||
Reference in New Issue
Block a user