Files
NwflowerandClaude Opus 5.5 c639682a88 refactor: remove unused functions and keep the codebase free of them
Delete functions that no product code calls, and fold "simple plus
WithOptions" pairs into the one signature callers actually use. Rename
the live macOS lifecycle functions that were labelled Legacy.

The architecture tests now share one source loader and reject functions
without a product caller and catalog messages nobody reads.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 20:55:03 -07:00

57 lines
2.4 KiB
Go

package macosdriver
import (
"github.com/Nwflower/reims-go/internal/host"
"testing"
)
func findOpt(t *testing.T, opts []host.Optimization, id string) host.Optimization {
t.Helper()
for _, o := range opts {
if o.ID == id {
return o
}
}
t.Fatalf("optimization %q not found", id)
return host.Optimization{}
}
func TestEvaluateOptimizationsWin10AndWin11(t *testing.T) {
win10 := host.Report{WHPX: host.WHPXReady, HasHybridCores: true, PCoreCount: 8, ECoreCount: 4, NeedsColdRebootWorkaround: true,
WHPXCaps: host.WHPXCapabilities{APICEmulation: true, KernelIrqchipAvailable: true},
RecommendedGPU: &host.GPUInfo{Name: "NVIDIA GeForce RTX 4070 Ti", Kind: host.GPUDiscrete, VulkanICD: "nv-vk64.json"}}
opts := DriverOptimizations(win10, []string{"qemu-whpx-win10-compat.patch"})
if o := findOpt(t, host.EvaluateCoreOptimizations(win10), "pcore_pin"); o.Status != "recommended" || !o.Supported {
t.Fatalf("pcore_pin = %+v", o)
}
if o := findOpt(t, opts, "kernel_irqchip"); o.Status != "unavailable" || o.Detail != "win10-needs-patch" {
t.Fatalf("kernel_irqchip = %+v", o)
}
if o := findOpt(t, opts, "cold_reboot"); o.Status != "auto" {
t.Fatalf("cold_reboot = %+v", o)
}
opts = DriverOptimizations(win10, []string{"qemu-whpx-win10-compat.patch", "qemu-whpx-win10-startup-ipis.patch"})
if o := findOpt(t, opts, "kernel_irqchip"); o.Status != "experimental" || !o.Supported {
t.Fatalf("patched kernel_irqchip = %+v", o)
}
win11 := host.Report{WHPX: host.WHPXReady, WHPXCaps: host.WHPXCapabilities{ModernOS: true, APICEmulation: true, KernelIrqchipAvailable: true, NestedVirtProperty: false, NestedVirtProbeError: "0x80370302"}}
opts = DriverOptimizations(win11, nil)
if o := findOpt(t, opts, "kernel_irqchip"); o.Status != "unavailable" || o.Detail != "0x80370302" {
t.Fatalf("win11 broken nested = %+v", o)
}
if o := findOpt(t, opts, "cold_reboot"); o.Status != "unavailable" {
t.Fatalf("win11 cold_reboot = %+v", o)
}
opts = DriverOptimizations(win11, []string{"qemu-whpx-nested-virt-nonfatal.patch"})
if o := findOpt(t, opts, "kernel_irqchip"); o.Status != "recommended" || !o.Supported {
t.Fatalf("win11 patched = %+v", o)
}
win11.WHPXCaps.NestedVirtProperty = true
win11.WHPXCaps.NestedVirtProbeError = ""
opts = DriverOptimizations(win11, nil)
if o := findOpt(t, opts, "kernel_irqchip"); o.Status != "recommended" || !o.Supported {
t.Fatalf("win11 full support = %+v", o)
}
}