Files
Reims-Go/internal/macos/reims/compat_test.go
T
NwflowerandClaude Opus 5.5 b203bde650 refactor: merge duplicated helpers and the window event contract
Events to the frontend go through App.emit, and a test keeps their names
in step with wails.ts. QEMU argument splitting, hidden console processes,
the macOS release record, the running check and a few smaller helpers
now exist once.

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

465 lines
20 KiB
Go

package reims
import (
"bytes"
"cmp"
"errors"
"fmt"
"os"
"os/exec"
"path/filepath"
"reflect"
"slices"
"strings"
"testing"
"github.com/Nwflower/reims-go/internal/host"
"github.com/Nwflower/reims-go/internal/i18n"
)
const (
fileRepository = "C:/Windows/System32/DriverStore/FileRepository/"
intelOldICD = fileRepository + "iigd_dch.inf_amd64_010a7b33a54cb65d/igvk64.json"
intelNewICD = fileRepository + "iigd_dch.inf_amd64_413e993a06fd9302/igvk64.json"
nvidiaNewICD = fileRepository + "nv_dispig.inf_amd64_b45678ef/Vulkan/nv-vk64.json"
)
func TestResolveStaleDriverStoreICD(t *testing.T) {
intel := host.GPUInfo{Kind: host.GPUIntegrated, VulkanICD: intelNewICD, VulkanVersion: "1.4.0", Compat: host.GPUCompatSupported}
nvidia := host.GPUInfo{Kind: host.GPUDiscrete, VulkanICD: nvidiaNewICD, VulkanVersion: "1.4.0", Compat: host.GPUCompatSupported}
amd := host.GPUInfo{Kind: host.GPUDiscrete, VulkanICD: fileRepository + "u0406575.inf_amd64_9abc5678/amd-vulkan64.json", VulkanVersion: "1.3.0", Compat: host.GPUCompatWarn}
mixed := intel
mixed.VulkanICD = "c:/WINDOWS\\System32/DRIVERSTORE\\FileRepository/IIGD_DCH.INF_AMD64_413E993A06FD9302\\IGVK64.JSON"
secondIntel := intel
secondIntel.VulkanICD = fileRepository + "iigd_dch.inf_amd64_1234567890abcdef/igvk64.json"
unprobed := intel
unprobed.VulkanVersion = ""
unprobed.Compat = host.GPUCompatUnknown
warnUnprobed := amd
warnUnprobed.VulkanVersion = ""
unsupported := intel
unsupported.Compat = host.GPUCompatUnsupported
virtual := intel
virtual.Kind = host.GPUVirtual
differentINF := intel
differentINF.VulkanICD = fileRepository + "iigd_other.inf_amd64_413e993a06fd9302/igvk64.json"
for _, tc := range []struct {
name string
oldPath string
gpus []host.GPUInfo
wantPath string
ambiguous bool
}{
{name: "Intel Arc B390", oldPath: intelOldICD, gpus: []host.GPUInfo{intel}, wantPath: intelNewICD},
{name: "NVIDIA nested manifest", oldPath: fileRepository + "nv_dispig.inf_amd64_a12345cd/Vulkan/nv-vk64.json", gpus: []host.GPUInfo{nvidia}, wantPath: nvidiaNewICD},
{name: "AMD warning grade", oldPath: fileRepository + "u0406575.inf_amd64_1234abcd/amd-vulkan64.json", gpus: []host.GPUInfo{amd}, wantPath: amd.VulkanICD},
{name: "mixed case and separators", oldPath: strings.ReplaceAll(intelOldICD, "/", "\\"), gpus: []host.GPUInfo{mixed}, wantPath: mixed.VulkanICD},
{name: "Intel and NVIDIA", oldPath: intelOldICD, gpus: []host.GPUInfo{nvidia, intel}, wantPath: intelNewICD},
{name: "different vendor", oldPath: intelOldICD, gpus: []host.GPUInfo{nvidia}},
{name: "same vendor multiple adapters", oldPath: intelOldICD, gpus: []host.GPUInfo{intel, secondIntel}, ambiguous: true},
{name: "shared manifest", oldPath: intelOldICD, gpus: []host.GPUInfo{intel, intel}, ambiguous: true},
{name: "unprobed also counts towards ambiguity", oldPath: intelOldICD, gpus: []host.GPUInfo{intel, unprobed}, ambiguous: true},
{name: "only match unprobed", oldPath: intelOldICD, gpus: []host.GPUInfo{unprobed}},
{name: "PCI-based warning without a probe", oldPath: fileRepository + "u0406575.inf_amd64_1234abcd/amd-vulkan64.json", gpus: []host.GPUInfo{warnUnprobed}},
{name: "only match unsupported", oldPath: intelOldICD, gpus: []host.GPUInfo{unsupported}},
{name: "ignore virtual adapter", oldPath: intelOldICD, gpus: []host.GPUInfo{virtual, intel}, wantPath: intelNewICD},
{name: "different INF package", oldPath: intelOldICD, gpus: []host.GPUInfo{differentINF}},
{name: "different repository", oldPath: "D" + intelOldICD[1:], gpus: []host.GPUInfo{intel}},
{name: "different relative path", oldPath: fileRepository + "iigd_dch.inf_amd64_010a7b33a54cb65d/Vulkan/igvk64.json", gpus: []host.GPUInfo{intel}},
{name: "invalid package hash", oldPath: fileRepository + "iigd_dch.inf_amd64_0123456g/igvk64.json", gpus: []host.GPUInfo{intel}},
{name: "short package hash", oldPath: fileRepository + "iigd_dch.inf_amd64_0123456/igvk64.json", gpus: []host.GPUInfo{intel}},
{name: "custom path", oldPath: "C:/custom/igvk64.json", gpus: []host.GPUInfo{intel}},
} {
t.Run(tc.name, func(t *testing.T) {
got, ambiguous := ResolveStaleDriverStoreICD(tc.oldPath, tc.gpus)
if got != tc.wantPath || ambiguous != tc.ambiguous {
t.Fatalf("ResolveStaleDriverStoreICD() = (%q, %v), want (%q, %v)", got, ambiguous, tc.wantPath, tc.ambiguous)
}
})
}
}
func TestStartWithCompatStaleGPUICD(t *testing.T) {
const name = "macOS test"
const newPath = "C:/Windows/System32/DriverStore/FileRepository/iigd_dch.inf_amd64_413e993a06fd9302/ICD manifests/igvk64.json"
const oldPath = "C:/Windows/System32/DriverStore/FileRepository/iigd_dch.inf_amd64_010a7b33a54cb65d/ICD manifests/igvk64.json"
const customPath = "C:/custom/igvk64.JSON"
intel := host.GPUInfo{Kind: host.GPUIntegrated, VulkanICD: newPath, VulkanVersion: "1.4.0", Compat: host.GPUCompatSupported}
show := "show\t" + name
start := "start\t" + name
set := "set\t" + name + "\t--gpu\t" + newPath
rebound := "显卡 Vulkan ICD 路径已从 " + oldPath + " 更新为 " + newPath
stale := "原显卡的 Vulkan ICD 文件已不存在(" + oldPath + ")。在设置 → 图形与显示器中重新选择显卡,或选择自动"
staleCustom := "The selected GPU's Vulkan ICD file no longer exists (" + customPath + "). In Settings → Graphics & displays, reselect the GPU or choose Automatic"
binary, err := os.Executable()
if err != nil {
t.Fatal(err)
}
for _, tc := range []struct {
name string
gpu string
graphics string
state string
statErr error
gpus []host.GPUInfo
fail string
twice bool
useStderr bool
wantCalls []string
wantStats []string
wantProbe int
wantNote string
wantStale bool
}{
{name: "existing file", gpu: oldPath, wantCalls: []string{show, start}, wantStats: []string{oldPath}},
{name: "auto", gpu: "automatic: the only GPU", wantCalls: []string{show, start}},
{name: "GPU name", gpu: "Intel Arc B390", wantCalls: []string{show, start}},
{name: "SVGA", gpu: oldPath, graphics: "VMware SVGA", wantCalls: []string{show, start}},
{name: "running", gpu: oldPath, state: "running, pid 1234", wantCalls: []string{show, start}},
{name: "show failure", gpu: oldPath, fail: "show", wantCalls: []string{show, start}},
{name: "stat permission denied", gpu: oldPath, statErr: os.ErrPermission, wantCalls: []string{show, start}, wantStats: []string{oldPath}},
{name: "rebind once across two starts", gpu: oldPath, statErr: os.ErrNotExist, gpus: []host.GPUInfo{intel}, twice: true, wantCalls: []string{show, set, start, show, start}, wantStats: []string{oldPath, newPath}, wantProbe: 1, wantNote: rebound},
{name: "rebind note falls back to stderr", gpu: oldPath, statErr: os.ErrNotExist, gpus: []host.GPUInfo{intel}, useStderr: true, wantCalls: []string{show, set, start}, wantStats: []string{oldPath}, wantProbe: 1, wantNote: rebound},
{name: "ambiguous", gpu: oldPath, statErr: os.ErrNotExist, gpus: []host.GPUInfo{intel, intel}, wantCalls: []string{show}, wantStats: []string{oldPath}, wantProbe: 1, wantNote: stale, wantStale: true},
{name: "no match", gpu: oldPath, statErr: os.ErrNotExist, wantCalls: []string{show}, wantStats: []string{oldPath}, wantProbe: 1, wantNote: stale, wantStale: true},
{name: "missing custom JSON", gpu: customPath, statErr: os.ErrNotExist, gpus: []host.GPUInfo{intel}, useStderr: true, wantCalls: []string{show}, wantStats: []string{customPath}, wantProbe: 1, wantNote: staleCustom, wantStale: true},
{name: "set failure", gpu: oldPath, statErr: os.ErrNotExist, gpus: []host.GPUInfo{intel}, fail: "set", wantCalls: []string{show, set}, wantStats: []string{oldPath}, wantProbe: 1},
} {
t.Run(tc.name, func(t *testing.T) {
dir := t.TempDir()
gpuFile := filepath.Join(dir, "gpu")
if err := os.WriteFile(gpuFile, []byte(tc.gpu), 0o644); err != nil {
t.Fatal(err)
}
locale := i18n.ZhCN
if tc.gpu == customPath {
locale = i18n.EnUS
}
var statPaths, notes []string
probes := 0
client := Client{
Binary: binary,
Env: append(os.Environ(),
"REIMS_TEST_CTL_DIR="+dir,
"REIMS_TEST_CTL_GRAPHICS="+cmp.Or(tc.graphics, "reims-vgpu"),
"REIMS_TEST_CTL_STATE="+cmp.Or(tc.state, "stopped"),
"REIMS_TEST_CTL_FAIL="+tc.fail,
),
Locale: locale,
statFile: func(path string) (os.FileInfo, error) {
statPaths = append(statPaths, path)
if path == newPath {
return nil, nil
}
if tc.statErr == nil {
return nil, nil
}
return nil, &os.PathError{Op: "stat", Path: path, Err: tc.statErr}
},
probeGPUs: func() []host.GPUInfo {
probes++
return tc.gpus
},
}
var stderr bytes.Buffer
onNote := func(msg string) { notes = append(notes, msg) }
if tc.useStderr {
onNote = nil
}
err := client.StartWithCompat(t.Context(), name, nil, &stderr, onNote)
switch {
case tc.wantStale:
if err == nil || err.Error() != tc.wantNote {
t.Fatalf("start error = %v, want %q", err, tc.wantNote)
}
case tc.fail == "set":
var exitErr *exec.ExitError
if !errors.As(err, &exitErr) || exitErr.ExitCode() != 7 || !strings.Contains(err.Error(), "reims-ctl set "+name+" --gpu") {
t.Fatalf("start error = %v, want wrapped set exit status 7", err)
}
case err != nil:
t.Fatal(err)
}
if tc.twice {
if err := client.StartWithCompat(t.Context(), name, nil, &stderr, onNote); err != nil {
t.Fatal(err)
}
}
calls, err := os.ReadFile(filepath.Join(dir, "commands"))
if err != nil {
t.Fatal(err)
}
if want := strings.Join(tc.wantCalls, "\n") + "\n"; string(calls) != want {
t.Errorf("reims-ctl commands = %q, want %q", calls, want)
}
if probes != tc.wantProbe || !slices.Equal(statPaths, tc.wantStats) {
t.Errorf("probes = %d, stat paths = %q, want %d and %q", probes, statPaths, tc.wantProbe, tc.wantStats)
}
wantGPU := tc.gpu
if slices.Contains(tc.wantCalls, set) && tc.fail != "set" {
wantGPU = newPath
}
gpu, err := os.ReadFile(gpuFile)
if err != nil || string(gpu) != wantGPU {
t.Errorf("saved GPU = %q, err = %v, want %q", gpu, err, wantGPU)
}
var wantNotes []string
wantStderr := ""
if tc.useStderr {
wantStderr = tc.wantNote + "\n"
} else if tc.wantNote != "" {
wantNotes = []string{tc.wantNote}
}
if !slices.Equal(notes, wantNotes) || stderr.String() != wantStderr {
t.Errorf("notes = %q, stderr = %q, want %q and %q", notes, stderr.String(), wantNotes, wantStderr)
}
})
}
}
func TestMain(m *testing.M) {
if os.Getenv("REIMS_TEST_CTL_DIR") != "" {
// Client.run invokes the test binary with the original ctl arguments.
os.Args = append([]string{os.Args[0], "-test.run=^TestHelperProcess$", "--"}, os.Args[1:]...)
}
os.Exit(m.Run())
}
func TestHelperProcess(t *testing.T) {
dir := os.Getenv("REIMS_TEST_CTL_DIR")
if dir == "" {
return
}
args := os.Args[3:]
if len(args) < 2 {
t.Fatalf("expected ctl command and VM name, got %q", args)
}
log, err := os.OpenFile(filepath.Join(dir, "commands"), os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0o644)
if err != nil {
t.Fatal(err)
}
_, writeErr := fmt.Fprintln(log, strings.Join(args, "\t"))
if closeErr := log.Close(); writeErr != nil || closeErr != nil {
t.Fatalf("record ctl call: write %v, close %v", writeErr, closeErr)
}
if args[0] == os.Getenv("REIMS_TEST_CTL_FAIL") {
os.Exit(7)
}
gpuFile := filepath.Join(dir, "gpu")
switch args[0] {
case "show":
gpu, err := os.ReadFile(gpuFile)
if err != nil {
t.Fatal(err)
}
fmt.Printf("%s\n state %s\n graphics %s\n gpu %s\n", args[1], os.Getenv("REIMS_TEST_CTL_STATE"), os.Getenv("REIMS_TEST_CTL_GRAPHICS"), gpu)
case "set":
if len(args) != 4 || args[2] != "--gpu" {
t.Fatalf("expected set <name> --gpu <path>, got %q", args)
}
if err := os.WriteFile(gpuFile, []byte(args[3]), 0o644); err != nil {
t.Fatal(err)
}
case "start":
default:
t.Fatalf("unexpected ctl command %q", args)
}
}
func TestBuildDeleteArgs(t *testing.T) {
got := BuildDeleteArgs("macos-tahoe", false)
want := []string{"delete", "--yes", "macos-tahoe"}
if !reflect.DeepEqual(got, want) {
t.Fatalf("BuildDeleteArgs(keepFiles=false) = %v, want %v", got, want)
}
gotKeep := BuildDeleteArgs("macos-tahoe", true)
wantKeep := []string{"delete", "--yes", "macos-tahoe", "--keep-files"}
if !reflect.DeepEqual(gotKeep, wantKeep) {
t.Fatalf("BuildDeleteArgs(keepFiles=true) = %v, want %v", gotKeep, wantKeep)
}
}
func TestCleanAbortedCreateDir(t *testing.T) {
dataDir := t.TempDir()
vmDir := filepath.Join(dataDir, "reims-ctl", "vms", "macos-tahoe")
if err := os.MkdirAll(vmDir, 0o755); err != nil {
t.Fatal(err)
}
if err := os.WriteFile(filepath.Join(vmDir, creatingMarker), nil, 0o644); err != nil {
t.Fatal(err)
}
if err := os.WriteFile(filepath.Join(vmDir, "disk.qcow2"), []byte("partial"), 0o644); err != nil {
t.Fatal(err)
}
// Refuses if VM is registered.
removed, err := CleanAbortedCreateDir(dataDir, CreateOpts{Name: "macos-tahoe"}, []VMListItem{{Name: "macos-tahoe"}})
if err != nil || removed != "" {
t.Fatalf("expected skip for registered VM, got removed=%q err=%v", removed, err)
}
// Refuses if vm.toml exists.
tomlPath := filepath.Join(vmDir, "vm.toml")
if err := os.WriteFile(tomlPath, []byte("cpus = 8\n"), 0o644); err != nil {
t.Fatal(err)
}
removed, err = CleanAbortedCreateDir(dataDir, CreateOpts{Name: "macos-tahoe"}, nil)
if err != nil || removed != "" {
t.Fatalf("expected skip when vm.toml exists, got removed=%q err=%v", removed, err)
}
_ = os.Remove(tomlPath)
// Cleans when unregistered, .reims-ctl-creating exists, and vm.toml is absent.
removed, err = CleanAbortedCreateDir(dataDir, CreateOpts{Name: "macos-tahoe"}, nil)
if err != nil || removed != vmDir {
t.Fatalf("expected removal of %q, got removed=%q err=%v", vmDir, removed, err)
}
if _, err := os.Stat(vmDir); !os.IsNotExist(err) {
t.Fatalf("expected %q to be deleted, stat err=%v", vmDir, err)
}
// Refuses arbitrary non-empty directory without marker.
customDir := filepath.Join(t.TempDir(), "user-folder")
if err := os.MkdirAll(customDir, 0o755); err != nil {
t.Fatal(err)
}
if err := os.WriteFile(filepath.Join(customDir, "notes.txt"), []byte("keep"), 0o644); err != nil {
t.Fatal(err)
}
removed, err = CleanAbortedCreateDir(dataDir, CreateOpts{Name: "other", Dir: customDir}, nil)
if err != nil || removed != "" {
t.Fatalf("expected skip without marker, got removed=%q err=%v", removed, err)
}
}
func TestWHPXNestedVirtCompat(t *testing.T) {
sampleErr := "2026-11-28T13:04:47Z qemu: -accel whpx: WHPX: Failed to enable nested virtualization, hr=80370302\n"
if !IsWHPXNestedVirtError(sampleErr) {
t.Fatalf("expected IsWHPXNestedVirtError to match")
}
if IsWHPXNestedVirtError("some unrelated error") {
t.Fatalf("unexpected match on unrelated error")
}
if got := MergeKernelIrqchipOffArgs(""); got != "-machine kernel-irqchip=off" {
t.Fatalf("MergeKernelIrqchipOffArgs(empty) = %q", got)
}
existing := "-no-reboot -qmp tcp:127.0.0.1:45555,server=on,wait=off"
want := existing + " -machine kernel-irqchip=off"
if got := MergeKernelIrqchipOffArgs(existing); got != want {
t.Fatalf("MergeKernelIrqchipOffArgs = %q, want %q", got, want)
}
// Idempotent when already set.
if got := MergeKernelIrqchipOffArgs(want); got != want {
t.Fatalf("expected idempotent merge, got %q", got)
}
if !HasKernelIrqchipArg("-accel whpx,kernel-irqchip=on") {
t.Fatalf("expected HasKernelIrqchipArg to detect accel form")
}
}
func TestIsWHPXNoAcceleratorError(t *testing.T) {
sample := "2026-11-29T18:01:40.594876Z qemu-system-x86_64.exe: -accel whpx: WHPX: No accelerator found, hr=00000000\n" +
"2026-11-29T18:01:40.596903Z qemu-system-x86_64.exe: -accel whpx: failed to initialize whpx: No space left on device\n"
if !IsWHPXNoAcceleratorError(sample) {
t.Fatalf("expected IsWHPXNoAcceleratorError to match WHPX ENOSPC output")
}
if !IsWHPXNoAcceleratorError("qemu: -accel whpx: failed to initialize whpx: No space left on device") {
t.Fatalf("expected IsWHPXNoAcceleratorError to match ENOSPC line alone")
}
if IsWHPXNoAcceleratorError("write disk.qcow2: No space left on device") {
t.Fatalf("must not misclassify genuine disk-full error as WHPX error")
}
}
func TestMergeAndStripOfflineHelperArgs(t *testing.T) {
base := `-no-reboot -qmp tcp:127.0.0.1:45555,server=on,wait=off -machine kernel-irqchip=off`
merged := MergeOfflineHelperArgs(base, `D:\Data\reims-go\cache\reims-helper.img`)
if !strings.Contains(merged, "id=reimshelp,if=none,format=raw,readonly=on,file=D:/Data/reims-go/cache/reims-helper.img") {
t.Fatalf("unexpected merged helper args: %q", merged)
}
merged2 := MergeOfflineHelperArgs(merged, `D:\My Data\helper,v2.img`)
if strings.Count(merged2, "id=reimshelp,") != 1 || !strings.Contains(merged2, "helper,,v2.img") {
t.Fatalf("expected idempotent replace with comma escape: %q", merged2)
}
stripped := StripOfflineHelperArgs(merged2)
if stripped != base {
t.Fatalf("StripOfflineHelperArgs = %q, want %q", stripped, base)
}
}
func TestBuildUpdateOpenCoreArgs(t *testing.T) {
gotOn := strings.Join(BuildUpdateOpenCoreArgs("macos-tahoe", true), " ")
if gotOn != "update-opencore macos-tahoe --boot-selection=true" {
t.Fatalf("BuildUpdateOpenCoreArgs(true) = %q", gotOn)
}
gotOff := strings.Join(BuildUpdateOpenCoreArgs("macos-tahoe", false), " ")
if gotOff != "update-opencore macos-tahoe --boot-selection=false" {
t.Fatalf("BuildUpdateOpenCoreArgs(false) = %q", gotOff)
}
}
func TestCreateDefaultNVMeAndPreview(t *testing.T) {
opts := CreateOpts{Name: "macos-tahoe", MacOS: "tahoe", CPUs: 8, Memory: "16G"}
if got := EffectiveCreateDiskController(opts); got != "nvme" {
t.Fatalf("EffectiveCreateDiskController default = %q, want nvme", got)
}
if EffectiveCreateCapture(opts) {
t.Fatalf("EffectiveCreateCapture default = true, want false")
}
cmd, err := PreviewCreateCommand(opts)
if err != nil {
t.Fatal(err)
}
if !strings.Contains(cmd, "&& reims-ctl set macos-tahoe --disk-controller nvme --capture false") {
t.Fatalf("PreviewCreateCommand missing nvme + capture=false set step: %q", cmd)
}
opts.DiskController = "ahci"
on := true
opts.Capture = &on
cmdAhciCaptureOn, err := PreviewCreateCommand(opts)
if err != nil {
t.Fatal(err)
}
if strings.Contains(cmdAhciCaptureOn, "&& reims-ctl set") {
t.Fatalf("PreviewCreateCommand should omit set step for ahci + capture=true: %q", cmdAhciCaptureOn)
}
}
func TestMergeAndStripGuestToolsArgs(t *testing.T) {
base := `-drive id=reimshelp,if=none,format=raw,readonly=on,file=D:/help.img -device usb-storage,id=reimshelp-dev,drive=reimshelp,bus=xhci.0`
merged := MergeGuestToolsArgs(base, `D:\Data\reims-go\cache\m0-tools.img`)
if !HasGuestToolsArgs(merged) || !strings.Contains(merged, "id=reimshelp,") {
t.Fatalf("expected both reimshelp and reimstools coexisting: %q", merged)
}
stripped := StripGuestToolsArgs(merged)
if stripped != base || HasGuestToolsArgs(stripped) {
t.Fatalf("StripGuestToolsArgs = %q, want %q", stripped, base)
}
}
func TestDiskImportAndCoWArgs(t *testing.T) {
if !NeedsDiskConversion(`D:\vms\mac.vmdk`) || !NeedsDiskConversion(`D:\vms\mac.RAW`) {
t.Fatalf("expected .vmdk and .raw to need conversion")
}
if NeedsDiskConversion(`D:\vms\disk.qcow2`) || NeedsDiskConversion(`D:\vms\disk.img`) {
t.Fatalf("did not expect .qcow2/.img to need conversion")
}
wantOpts := DefaultQCOW2CreateOptions().OptionString()
conv := strings.Join(BuildConvertToQCOW2Args("in.vmdk", "out.qcow2"), " ")
if conv != "convert -O qcow2 -o "+wantOpts+" in.vmdk out.qcow2" {
t.Fatalf("BuildConvertToQCOW2Args = %q", conv)
}
cow := strings.Join(BuildCoWOverlayArgs("golden.qcow2", "cow-dev.qcow2", DefaultQCOW2CreateOptions()), " ")
if cow != "create -f qcow2 -b golden.qcow2 -F qcow2 -o "+wantOpts+" cow-dev.qcow2" {
t.Fatalf("BuildCoWOverlayArgs = %q", cow)
}
cmp := strings.Join(BuildCompactDiskArgs("disk.qcow2", "disk.compact.tmp", DefaultQCOW2CreateOptions()), " ")
if cmp != "convert -p -f qcow2 -O qcow2 -o "+wantOpts+" disk.qcow2 disk.compact.tmp" {
t.Fatalf("BuildCompactDiskArgs = %q", cmp)
}
}