| 1 | |
| 2 | |
| 3 | |
| 4 | package qemu |
| 5 | |
| 6 | import "testing" |
| 7 | |
| 8 | func TestWHPXMachineCompatibility(t *testing.T) { |
| 9 | for _, accel := range []string{"whpx", "kvm", "hvf", "nvmm"} { |
| 10 | want := "q35,accel=" + accel |
| 11 | if accel == "whpx" { |
| 12 | want += ",kernel-irqchip=off" |
| 13 | } |
| 14 | args := appendQ35Machine(nil, accel) |
| 15 | if got, _ := argValue(args, "-machine"); got != want { |
| 16 | t.Fatalf("%s: got %q, want %q", accel, got, want) |
| 17 | } |
| 18 | } |
| 19 | |
| 20 | args := appendQ35Machine([]string{"-machine", "q35,accel=whpx,kernel-irqchip=on"}, "whpx") |
| 21 | if len(args) != 2 || args[1] != "q35,accel=whpx,kernel-irqchip=on" { |
| 22 | t.Fatalf("overrode explicit machine: %v", args) |
| 23 | } |
| 24 | } |