Skip to content

armgit / ODS

Public Imported from GitHub
0

ODS V3 Pre-Release: Public testing and refinement ahead of the official V3 launch. Turn your PC, Mac, or Linux box into a private AI server.

4.4 KB
Raw Blame
#!/usr/bin/env bash
# ============================================================================
# ODS Windows installer flag parity tests
# ============================================================================

set -euo pipefail

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
ROOT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
REPO_ROOT="$(cd "$ROOT_DIR/.." && pwd)"
ROOT_INSTALLER="$REPO_ROOT/install.ps1"
WINDOWS_INSTALLER="$ROOT_DIR/installers/windows/install-windows.ps1"
WINDOWS_QUICKSTART="$ROOT_DIR/docs/WINDOWS-QUICKSTART.md"
WINDOWS_WALKTHROUGH="$ROOT_DIR/docs/WINDOWS-INSTALL-WALKTHROUGH.md"

GREEN='\033[0;32m'
RED='\033[0;31m'
NC='\033[0m'
PASS=0
FAIL=0

pass() { echo -e "  ${GREEN}PASS${NC} $1"; PASS=$((PASS + 1)); }
fail() { echo -e "  ${RED}FAIL${NC} $1"; FAIL=$((FAIL + 1)); }

check() {
    local pattern="$1" file="$2" label="$3"
    if grep -Fq -- "$pattern" "$file"; then
        pass "$label"
    else
        fail "$label"
    fi
}

echo ""
echo "=== Windows installer flag parity tests ==="
echo ""

[[ -f "$ROOT_INSTALLER" ]] && pass "root Windows installer wrapper exists" || fail "root Windows installer wrapper missing"
[[ -f "$WINDOWS_INSTALLER" ]] && pass "Windows installer orchestrator exists" || fail "Windows installer orchestrator missing"

for flag in Hermes NoHermes Langfuse NoLangfuse NoBootstrap; do
    check "[switch]\$$flag" "$ROOT_INSTALLER" "root wrapper forwards -$flag"
done

check "[switch]\$NoBootstrap" "$WINDOWS_INSTALLER" "Windows installer exposes -NoBootstrap"
check '$noBootstrapFlag = $NoBootstrap.IsPresent' "$WINDOWS_INSTALLER" "Windows installer captures -NoBootstrap"
check '-NoBootstrap $noBootstrapFlag' "$WINDOWS_INSTALLER" "Windows bootstrap decision receives -NoBootstrap"
check '[string]$InstallDir = ""' "$ROOT_INSTALLER" "root wrapper exposes -InstallDir"
check '[string]$InstallDir = ""' "$WINDOWS_INSTALLER" "Windows installer exposes -InstallDir"
check '$env:ODS_HOME = [System.IO.Path]::GetFullPath($InstallDir)' "$WINDOWS_INSTALLER" "Windows installer maps -InstallDir to ODS_HOME before constants"
check 'Write-InfoBox "Install target:" "$installDir"' "$ROOT_DIR/installers/windows/phases/01-preflight.ps1" "Windows preflight prints install target"
check 'Install target checked: $installDir' "$ROOT_DIR/installers/windows/phases/01-preflight.ps1" "Windows initial disk gate prints install target"
check 'Install target checked: $installDir' "$ROOT_DIR/installers/windows/phases/02-detection.ps1" "Windows tier disk gate prints install target"
check '.\ods\installers\windows\install-windows.ps1 -InstallDir $_installDirHint' "$ROOT_DIR/installers/windows/phases/01-preflight.ps1" "Windows initial disk gate prints install-dir rerun hint"
check '.\ods\installers\windows\install-windows.ps1 -InstallDir $_installDirHint' "$ROOT_DIR/installers/windows/phases/02-detection.ps1" "Windows tier disk gate prints install-dir rerun hint"
check '.\ods\installers\windows\install-windows.ps1 -InstallDir $_installDirHint' "$ROOT_DIR/installers/windows/phases/04-requirements.ps1" "Windows requirements disk gate prints install-dir rerun hint"
check '$_installDirHint = "<path-with-enough-space>\ods"' "$ROOT_DIR/installers/windows/phases/04-requirements.ps1" "Windows disk warning uses a generic install-dir hint"
check 'if ($continueChoice -notmatch "^[yY]")' "$ROOT_DIR/installers/windows/phases/04-requirements.ps1" "Windows requirements default prompt rejects Enter"
check 'throw "ODS_INSTALL_ABORTED"' "$ROOT_DIR/installers/windows/phases/04-requirements.ps1" "Windows requirements prompt aborts on default No"

check '-NoHermes' "$WINDOWS_QUICKSTART" "Windows quickstart documents mandatory Hermes disable"
check '-NoBootstrap' "$WINDOWS_QUICKSTART" "Windows quickstart documents bootstrap option"
check '.\install.ps1 -InstallDir /home/youruser/ods' "$WINDOWS_QUICKSTART" "Windows quickstart uses Linux install path"
check '--pixel --no-hermes' "$WINDOWS_QUICKSTART" "Windows quickstart requires Pixel"
if grep -Fq -- '--no-openclaw' "$WINDOWS_QUICKSTART"; then
    fail "Windows quickstart still passes the removed --no-openclaw flag"
else
    pass "Windows quickstart no longer passes the removed --no-openclaw flag"
fi
check '[switch]$OpenClaw' "$ROOT_INSTALLER" "root wrapper still accepts the ignored -OpenClaw switch"
check '.\ods\installers\windows\install-windows.ps1' "$WINDOWS_WALKTHROUGH" "Legacy walkthrough invokes native implementation explicitly"

echo ""
echo "Result: $PASS passed, $FAIL failed"
[[ $FAIL -eq 0 ]]