Files
wehub-resource-sync 9e8f1bbeed
Dashboard / frontend (push) Failing after 0s
Dashboard / api (push) Failing after 0s
Lint PowerShell / powershell-lint (ubuntu-latest) (push) Failing after 1s
Python Lint / Lint Python with Ruff (push) Failing after 1s
ShellCheck / Lint shell scripts (push) Failing after 1s
Matrix Smoke / linux-smoke (push) Failing after 1s
Matrix Smoke / distro: cachyos (push) Failing after 15s
Matrix Smoke / distro: linux-mint-21.3 (push) Failing after 15s
Matrix Smoke / distro: debian-12 (push) Failing after 5m21s
Matrix Smoke / distro: fedora-41 (push) Failing after 4m56s
Matrix Smoke / distro: ubuntu-24.04 (push) Failing after 2m13s
Matrix Smoke / distro: rocky-9 (push) Failing after 10m39s
Matrix Smoke / distro: manjaro (push) Failing after 12m11s
Matrix Smoke / distro: opensuse-tw (push) Failing after 11m53s
Matrix Smoke / distro: archlinux (push) Failing after 20m3s
Matrix Smoke / distro: ubuntu-22.04 (push) Failing after 13m49s
Validate .env Schema / tier-1-env-validation (push) Successful in 52s
Validate .env Schema / tier-2-env-validation (push) Successful in 44s
Validate .env Schema / tier-3-env-validation (push) Successful in 52s
Validate .env Schema / tier-4-env-validation (push) Successful in 51s
Validate Extensions Catalog / Check catalog is up-to-date (push) Failing after 9m47s
Secret Scan / Scan for secrets (push) Failing after 21m4s
Validate Docker Compose / Validate Docker Compose files (push) Has been cancelled
Python Type Check / Type check with mypy (push) Has been cancelled
Validate .env Schema / tier-0-env-validation (push) Has been cancelled
Test Linux / integration-smoke (push) Has been cancelled
Lint PowerShell / powershell-lint (windows-latest) (push) Has been cancelled
Matrix Smoke / macos-smoke (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:31:33 +08:00

85 lines
2.8 KiB
Bash
Executable File

#!/bin/bash
# ============================================================================
# ODS CLI enable GPU backend validation test
# ============================================================================
# Tests that ods-cli enable command validates GPU backend compatibility
# before enabling extensions.
#
# Usage: ./tests/test-enable-gpu-validation.sh
# ============================================================================
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
ROOT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
GREEN='\033[0;32m'
RED='\033[0;31m'
YELLOW='\033[1;33m'
NC='\033[0m'
PASSED=0
FAILED=0
pass() { echo -e " ${GREEN}✓ PASS${NC} $1"; PASSED=$((PASSED + 1)); }
fail() { echo -e " ${RED}✗ FAIL${NC} $1"; FAILED=$((FAILED + 1)); }
echo ""
echo "╔═══════════════════════════════════════════════╗"
echo "║ GPU Backend Validation Test ║"
echo "╚═══════════════════════════════════════════════╝"
echo ""
# 1. SERVICE_GPU_BACKENDS array is declared in service-registry.sh
if grep -q "declare -A SERVICE_GPU_BACKENDS" "$ROOT_DIR/lib/service-registry.sh"; then
pass "SERVICE_GPU_BACKENDS array declared"
else
fail "SERVICE_GPU_BACKENDS array not declared"
fi
# 2. GPU backends are parsed from manifests
if grep -q "gpu_backends.*get.*gpu_backends" "$ROOT_DIR/lib/service-registry.sh"; then
pass "GPU backends parsing logic present"
else
fail "GPU backends parsing logic missing"
fi
# 3. GPU backends are emitted to bash
if grep -q 'SERVICE_GPU_BACKENDS.*_esc' "$ROOT_DIR/lib/service-registry.sh"; then
pass "GPU backends emitted to bash registry"
else
fail "GPU backends emission missing"
fi
# 4. cmd_enable checks GPU backend compatibility
if grep -q "SERVICE_GPU_BACKENDS.*service_id" "$ROOT_DIR/ods-cli"; then
pass "cmd_enable reads GPU backends from registry"
else
fail "cmd_enable missing GPU backend check"
fi
# 5. cmd_enable warns about incompatible backends
if grep -q "may not work with GPU backend" "$ROOT_DIR/ods-cli"; then
pass "GPU backend warning message present"
else
fail "GPU backend warning message missing"
fi
# 6. cmd_enable shows supported backends list
if grep -q "Supported backends" "$ROOT_DIR/ods-cli"; then
pass "Supported backends message present"
else
fail "Supported backends message missing"
fi
# 7. User can cancel if backend incompatible
if grep -A5 "may not work with GPU backend" "$ROOT_DIR/ods-cli" | grep -q "Continue anyway"; then
pass "User confirmation prompt present"
else
fail "User confirmation prompt missing"
fi
echo ""
echo "Result: $PASSED passed, $FAILED failed"
[[ $FAILED -eq 0 ]]