Files
AetherForge/agent/miner/tier_gpu_compute_test.go

62 lines
1.4 KiB
Go

package miner
import (
"context"
"runtime"
"testing"
"crypto-miner-agent/config"
)
func TestRunGPUComputeTierMockProbe(t *testing.T) {
if runtime.GOOS != "windows" {
t.Skip("gpu_compute tier requires windows")
}
SetGPUComputeProbe(func(cfg config.RuntimeConfig) GPUComputeProbe {
return GPUComputeProbe{
CUDAAvailable: true,
StratumReady: true,
KernelPath: "cuda_reflective_dll",
ReflectiveDLL: true,
DiagnosticOnly: true,
}
})
defer SetGPUComputeProbe(nil)
attempt := RunGPUComputeTier(context.Background(), config.RuntimeConfig{
BuiltinConfig: config.BuiltinConfig{
GPUEnabled: true,
RVNWallet: "wallet",
PoolHost: "pool.example.com",
Wallet: "cmr-wallet",
},
})
if !attempt.OK {
t.Fatalf("attempt=%+v", attempt)
}
if attempt.Details["cuda"] != true {
t.Fatalf("details=%v", attempt.Details)
}
}
func TestRunGPUComputeTierNoKernelGracefulSkip(t *testing.T) {
if runtime.GOOS != "windows" {
t.Skip("gpu_compute tier requires windows")
}
SetGPUComputeProbe(func(cfg config.RuntimeConfig) GPUComputeProbe {
return GPUComputeProbe{StratumReady: true}
})
defer SetGPUComputeProbe(nil)
attempt := RunGPUComputeTier(context.Background(), config.RuntimeConfig{
BuiltinConfig: config.BuiltinConfig{
GPUEnabled: true,
RVNWallet: "wallet",
PoolHost: "pool.example.com",
},
})
if attempt.OK {
t.Fatal("expected failure without CUDA/HLSL")
}
}