diff --git a/qemu_test.go b/qemu_test.go index e19f65930..a86b193b7 100644 --- a/qemu_test.go +++ b/qemu_test.go @@ -39,11 +39,18 @@ func testAppend(structure interface{}, expected string, t *testing.T) { } params = appendDevices([]string{}, config) + + case Object: + config := Config{ + Objects: []Object{s}, + } + + params = appendObjects([]string{}, config) } result := strings.Join(params, " ") if result != expected { - t.Fatalf("Failed to append Machine [%s] != [%s]", result, expected) + t.Fatalf("Failed to append parameters [%s] != [%s]", result, expected) } } @@ -93,3 +100,22 @@ func TestAppendEmptyDevice(t *testing.T) { testAppend(device, "", t) } + +var objectMemoryString = "-object memory-backend-file,id=mem0,mem-path=/root,size=65536" + +func TestAppendObjectMemory(t *testing.T) { + object := Object{ + Type: "memory-backend-file", + ID: "mem0", + MemPath: "/root", + Size: 1 << 16, + } + + testAppend(object, objectMemoryString, t) +} + +func TestAppendEmptyObject(t *testing.T) { + device := Device{} + + testAppend(device, "", t) +}