1
0
mirror of https://github.com/kata-containers/kata-containers.git synced 2025-04-29 04:04:45 +00:00

qemu: Add Device unit tests

We add a NVDIMM, a filesystem and an empty device.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
This commit is contained in:
Samuel Ortiz 2016-09-13 12:31:24 +02:00
parent 54d32c2414
commit 38e041dc9d

View File

@ -32,6 +32,13 @@ func testAppend(structure interface{}, expected string, t *testing.T) {
}
params = appendMachine([]string{}, config)
case Device:
config := Config{
Devices: []Device{s},
}
params = appendDevices([]string{}, config)
}
result := strings.Join(params, " ")
@ -56,3 +63,33 @@ func TestAppendEmptyMachine(t *testing.T) {
testAppend(machine, "", t)
}
var deviceNVDIMMString = "-device nvdimm,id=nv0,memdev=mem0"
func TestAppendDeviceNVDIMM(t *testing.T) {
device := Device{
Type: "nvdimm",
ID: "nv0",
MemDev: "mem0",
}
testAppend(device, deviceNVDIMMString, t)
}
var deviceFSString = "-device virtio-9p-pci,fsdev=workload9p,mount_tag=rootfs"
func TestAppendDeviceFS(t *testing.T) {
device := Device{
Type: "virtio-9p-pci",
FSDev: "workload9p",
MountTag: "rootfs",
}
testAppend(device, deviceFSString, t)
}
func TestAppendEmptyDevice(t *testing.T) {
device := Device{}
testAppend(device, "", t)
}