Build Guest Tools images in the macOS driver after all start hooks pass, through a host callback rather than a new macOS-to-guesttools dependency. Add driver.OptimizationAdvisor, keep generic hardware evaluation in host, and move WHPX recommendations and tests into macosdriver for both the UI and diagnostics.
57 lines
2.4 KiB
Go
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 := EvaluateOptimizations(win10, []string{"qemu-whpx-win10-compat.patch"})
|
|
if o := findOpt(t, opts, "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 = EvaluateOptimizations(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 = EvaluateOptimizations(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 = EvaluateOptimizations(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 = EvaluateOptimizations(win11, nil)
|
|
if o := findOpt(t, opts, "kernel_irqchip"); o.Status != "recommended" || !o.Supported {
|
|
t.Fatalf("win11 full support = %+v", o)
|
|
}
|
|
}
|