Skip to content

Commit

Permalink
unit-test: refine qemu_arm64_test.go
Browse files Browse the repository at this point in the history
refine a set of test functions under qemu_arm64_test.go. e.g. test
func for memoryTopology shouldn't be the same one on amd64, since
for now, we don't support nvdimm on arm64.

Fixes: kata-containers#1200

Signed-off-by: Penny Zheng <[email protected]>
  • Loading branch information
Pennyzct committed Jan 31, 2019
1 parent d079ed3 commit afcebcb
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions virtcontainers/qemu_arm64_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,32 +26,27 @@ func newTestQemu(machineType string) qemuArch {

func TestQemuArm64CPUModel(t *testing.T) {
assert := assert.New(t)
arm64 := newTestQemu(virt)
arm64 := newTestQemu(QemuVirt)

expectedOut := defaultCPUModel
model := arm64.cpuModel()
assert.Equal(expectedOut, model)

arm64.enableNestingChecks()
expectedOut = defaultCPUModel + ",pmu=off"
model = arm64.cpuModel()
assert.Equal(expectedOut, model)
}

func TestQemuArm64MemoryTopology(t *testing.T) {
assert := assert.New(t)
arm64 := newTestQemu(virt)
memoryOffset := 1024
arm64 := newTestQemu(QemuVirt)

hostMem := uint64(1024)
mem := uint64(120)
hostMem := uint64(4096)
mem := uint64(1024)
slots := uint8(3)
expectedMemory := govmmQemu.Memory{
Size: fmt.Sprintf("%dM", mem),
Slots: defaultMemSlots,
MaxMem: fmt.Sprintf("%dM", hostMem+uint64(memoryOffset)),
Slots: slots,
MaxMem: fmt.Sprintf("%dM", hostMem),
}

m := arm64.memoryTopology(mem, hostMem)
m := arm64.memoryTopology(mem, hostMem, slots)
assert.Equal(expectedMemory, m)
}

Expand Down

0 comments on commit afcebcb

Please sign in to comment.