diff --git a/qemu_test.go b/qemu_test.go index e43e39c239..7f01c4b612 100644 --- a/qemu_test.go +++ b/qemu_test.go @@ -60,6 +60,20 @@ func testAppend(structure interface{}, expected string, t *testing.T) { } params = appendKernel([]string{}, config) + + case Memory: + config := Config{ + Memory: s, + } + + params = appendMemory([]string{}, config) + + case SMP: + config := Config{ + SMP: s, + } + + params = appendCPUs([]string{}, config) } result := strings.Join(params, " ") @@ -166,3 +180,28 @@ func TestAppendKernel(t *testing.T) { testAppend(kernel, kernelString, t) } + +var memoryString = "-m 2G,slots=2,maxmem=3G" + +func TestAppendMemory(t *testing.T) { + memory := Memory{ + Size: "2G", + Slots: 2, + MaxMem: "3G", + } + + testAppend(memory, memoryString, t) +} + +var cpusString = "-smp 2,cores=1,threads=2,sockets=2" + +func TestAppendCPUs(t *testing.T) { + smp := SMP{ + CPUs: 2, + Sockets: 2, + Cores: 1, + Threads: 2, + } + + testAppend(smp, cpusString, t) +}