2584940016
release / setup-environment (push) Has been cancelled
release / windows-depends (amd64, , https://sdk.lunarg.com/sdk/download/1.4.321.1/windows/vulkansdk-windows-X64-1.4.321.1.exe, windows, Vulkan, vulkan) (push) Has been cancelled
release / windows-depends (amd64, -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_FLAGS="-parallel-jobs=4 -Wno-ignored-attributes -Wno-deprecated-pragma" -DCMAKE_CXX_FLAGS="-parallel-jobs=4 -Wno-ignored-attributes -Wno-deprecated-pragma", https:/… (push) Has been cancelled
release / windows-depends (amd64, ["cudart" "nvcc" "cublas" "cublas_dev" "crt" "nvvm" "nvptxcompiler"], 13.0, , https://developer.download.nvidia.com/compute/cuda/13.0.0/local_installers/cuda_13.0.0_windows.exe, windows, CUDA 13) (push) Has been cancelled
release / windows-depends (amd64, ["cudart" "nvcc" "cublas" "cublas_dev"], 12.8, , https://developer.download.nvidia.com/compute/cuda/12.8.0/local_installers/cuda_12.8.0_571.96_windows.exe, windows, CUDA 12) (push) Has been cancelled
release / windows-depends (amd64, windows, CPU) (push) Has been cancelled
release / darwin-build (push) Has been cancelled
release / windows-build (amd64, x86_64, windows) (push) Has been cancelled
release / windows-build (arm64, aarch64, windows) (push) Has been cancelled
release / windows-app (push) Has been cancelled
release / linux-build (amd64, linux, archive) (push) Has been cancelled
release / linux-build (amd64, linux, rocm) (push) Has been cancelled
release / linux-build (arm64, linux, archive) (push) Has been cancelled
release / docker-build-push (amd64, CGO_CFLAGS
CGO_CXXFLAGS
GOFLAGS
, linux) (push) Has been cancelled
release / docker-build-push (amd64, CGO_CFLAGS
CGO_CXXFLAGS
GOFLAGS
FLAVOR=rocm
, linux, -rocm) (push) Has been cancelled
release / docker-build-push (arm64, CGO_CFLAGS
CGO_CXXFLAGS
GOFLAGS
, linux) (push) Has been cancelled
release / docker-merge-push () (push) Has been cancelled
release / docker-merge-push (-rocm) (push) Has been cancelled
release / release (push) Has been cancelled
83 lines
2.5 KiB
Go
83 lines
2.5 KiB
Go
package imagegen
|
|
|
|
import (
|
|
"runtime"
|
|
"testing"
|
|
)
|
|
|
|
// TestPlatformSupport verifies platform validation works correctly.
|
|
func TestPlatformSupport(t *testing.T) {
|
|
err := CheckPlatformSupport()
|
|
|
|
switch runtime.GOOS {
|
|
case "darwin":
|
|
if runtime.GOARCH == "arm64" {
|
|
// Apple Silicon should be supported
|
|
if err != nil {
|
|
t.Errorf("Expected nil error on darwin/arm64, got: %v", err)
|
|
}
|
|
} else {
|
|
// Intel Mac should fail
|
|
if err == nil {
|
|
t.Error("Expected error on darwin/amd64 (Intel), got nil")
|
|
}
|
|
if err != nil && err.Error() == "" {
|
|
t.Error("Expected meaningful error message for unsupported platform")
|
|
}
|
|
}
|
|
case "linux", "windows":
|
|
// Linux/Windows are allowed (CUDA support checked at runtime)
|
|
if err != nil {
|
|
t.Errorf("Expected nil error on %s, got: %v", runtime.GOOS, err)
|
|
}
|
|
default:
|
|
// Other platforms should fail
|
|
if err == nil {
|
|
t.Errorf("Expected error on unsupported platform %s, got nil", runtime.GOOS)
|
|
}
|
|
}
|
|
}
|
|
|
|
// TestMemoryRequirementsError verifies memory check returns clear error.
|
|
func TestMemoryRequirementsError(t *testing.T) {
|
|
// Test with insufficient memory
|
|
err := CheckMemoryRequirements("test-model", 8*GB)
|
|
if err == nil {
|
|
t.Error("Expected error for insufficient memory (8GB < 21GB default)")
|
|
}
|
|
|
|
// Test with sufficient memory
|
|
err = CheckMemoryRequirements("test-model", 32*GB)
|
|
if err != nil {
|
|
t.Errorf("Expected no error for sufficient memory (32GB), got: %v", err)
|
|
}
|
|
}
|
|
|
|
// TestEstimateVRAMReturnsReasonableDefaults verifies VRAM estimates are sensible.
|
|
func TestEstimateVRAMReturnsReasonableDefaults(t *testing.T) {
|
|
// Unknown model should return default (21GB)
|
|
vram := EstimateVRAM("unknown-model")
|
|
if vram < 10*GB || vram > 100*GB {
|
|
t.Errorf("VRAM estimate %d GB is outside reasonable range (10-100 GB)", vram/GB)
|
|
}
|
|
|
|
// Verify known pipeline estimates exist and are reasonable
|
|
for name, estimate := range modelVRAMEstimates {
|
|
if estimate < 10*GB {
|
|
t.Errorf("VRAM estimate for %s (%d GB) is suspiciously low", name, estimate/GB)
|
|
}
|
|
if estimate > 200*GB {
|
|
t.Errorf("VRAM estimate for %s (%d GB) is suspiciously high", name, estimate/GB)
|
|
}
|
|
}
|
|
}
|
|
|
|
// TestServerInterfaceCompliance verifies Server implements llm.LlamaServer.
|
|
// This is a compile-time check but we document it as a test.
|
|
func TestServerInterfaceCompliance(t *testing.T) {
|
|
// The var _ llm.LlamaServer = (*Server)(nil) line in server.go
|
|
// ensures compile-time interface compliance.
|
|
// This test documents that requirement.
|
|
t.Log("Server implements llm.LlamaServer interface (compile-time checked)")
|
|
}
|