- Distinguish hypervisor launch disabled (hypervisor_off) from BIOS/UEFI virtualization disabled (no_hypervisor) via unprivileged Win32 & DeviceGuard probes without spawning background PowerShell/BCD processes - Add default-off `enable_hypervisor_switch` preference in Settings -> General with confirmation modal, active VM/task guards, HVCI notice, same-boot undo, and single-UAC System32 execution without auto-restarting Windows - Update Engine page, first-run Setup, `reims-go doctor`, and VM startprep diagnostics for `hypervisor_off` and pending boot states
38 lines
1.5 KiB
Go
38 lines
1.5 KiB
Go
package startprep
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
|
|
"github.com/Nwflower/reims-go/internal/config"
|
|
"github.com/Nwflower/reims-go/internal/host"
|
|
"github.com/Nwflower/reims-go/internal/i18n"
|
|
)
|
|
|
|
func TestCheckWHPX(t *testing.T) {
|
|
pZh := &Prep{cfg: config.Config{Locale: i18n.ZhCN}}
|
|
pEn := &Prep{cfg: config.Config{Locale: i18n.EnUS}}
|
|
|
|
if err := pZh.CheckWHPX(host.Report{WHPX: host.WHPXReady}); err != nil {
|
|
t.Fatalf("WHPXReady should pass, got %v", err)
|
|
}
|
|
if err := pZh.CheckWHPX(host.Report{WHPX: host.WHPXHypervisorOff}); err == nil || !strings.Contains(err.Error(), "VMware") {
|
|
t.Fatalf("WHPXHypervisorOff (zh-CN) = %v", err)
|
|
}
|
|
if err := pEn.CheckWHPX(host.Report{WHPX: host.WHPXHypervisorOff}); err == nil || !strings.Contains(err.Error(), "VMware") {
|
|
t.Fatalf("WHPXHypervisorOff (en-US) = %v", err)
|
|
}
|
|
if err := pZh.CheckWHPX(host.Report{WHPX: host.WHPXNoHypervisor}); err == nil || !strings.Contains(err.Error(), "hypervisorlaunchtype") {
|
|
t.Fatalf("WHPXNoHypervisor (zh-CN) = %v", err)
|
|
}
|
|
if err := pEn.CheckWHPX(host.Report{WHPX: host.WHPXNoHypervisor}); err == nil || !strings.Contains(err.Error(), "unrelated to disk space") {
|
|
t.Fatalf("WHPXNoHypervisor (en-US) = %v", err)
|
|
}
|
|
if err := pZh.CheckWHPX(host.Report{WHPX: host.WHPXMissing}); err == nil || !strings.Contains(err.Error(), "WHPX") {
|
|
t.Fatalf("WHPXMissing (zh-CN) = %v", err)
|
|
}
|
|
if err := pEn.CheckWHPX(host.Report{WHPX: host.WHPXUnsupported}); err == nil || !strings.Contains(err.Error(), "1803") {
|
|
t.Fatalf("WHPXUnsupported (en-US) = %v", err)
|
|
}
|
|
}
|