-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmachine_test.go
63 lines (54 loc) · 1.55 KB
/
machine_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
package qcli
import "testing"
func TestAppendMachine(t *testing.T) {
machineString := "-machine pc-lite,accel=kvm,kernel_irqchip=on,nvdimm=on"
machine := Machine{
Type: "pc-lite",
Acceleration: MachineAccelerationKVM,
KernelIRQChip: "on",
NVDIMM: "on",
}
testAppend(machine, machineString, t)
machineString = "-machine pc-lite,accel=kvm,kernel_irqchip=on,nvdimm=on,gic-version=host,usb=off"
machine = Machine{
Type: "pc-lite",
Acceleration: MachineAccelerationKVM,
KernelIRQChip: "on",
NVDIMM: "on",
Options: "gic-version=host,usb=off",
}
testAppend(machine, machineString, t)
machineString = "-machine microvm,accel=kvm,pic=off,pit=off"
machine = Machine{
Type: "microvm",
Acceleration: MachineAccelerationKVM,
Options: "pic=off,pit=off",
}
testAppend(machine, machineString, t)
machineString = "-machine q35,accel=kvm,smm=on"
machine = Machine{
Type: MachineTypePC35,
Acceleration: MachineAccelerationKVM,
SMM: "on",
}
testAppend(machine, machineString, t)
}
func TestAppendEmptyMachine(t *testing.T) {
machine := Machine{}
testAppend(machine, "", t)
}
func TestBadMachine(t *testing.T) {
c := &Config{}
c.appendMachine()
if len(c.qemuParams) != 0 {
t.Errorf("Expected empty qemuParams, found %s", c.qemuParams)
}
}
func TestAppendMachineAarch64Virt(t *testing.T) {
machineString := "-machine virt,accel=kvm"
machine := Machine{
Type: MachineTypeVirt,
Acceleration: MachineAccelerationKVM,
}
testAppend(machine, machineString, t)
}