diff --git a/cli/kata-check_arm64.go b/cli/kata-check_arm64.go index 615e5aeaf4..0b116ad65b 100644 --- a/cli/kata-check_arm64.go +++ b/cli/kata-check_arm64.go @@ -121,12 +121,12 @@ func normalizeArmModel(model string) string { return model } -func getCPUDetails() (vendor, model string, err error) { - if vendor, model, err := genericGetCPUDetails(); err == nil { +func getCPUDetails() (string, string, error) { + vendor, model, err := genericGetCPUDetails() + if err == nil { vendor = normalizeArmVendor(vendor) model = normalizeArmModel(model) - return vendor, model, err - } else { - return vendor, model, err } + + return vendor, model, err } diff --git a/cli/kata-check_arm64_test.go b/cli/kata-check_arm64_test.go index 05c04043ae..083671a8b3 100644 --- a/cli/kata-check_arm64_test.go +++ b/cli/kata-check_arm64_test.go @@ -18,6 +18,13 @@ import ( "github.com/urfave/cli" ) +type TestDataa struct { + contents string + expectedVendor string + expectedModel string + expectError bool +} + func setupCheckHostIsVMContainerCapable(assert *assert.Assertions, cpuInfoFile string, moduleData []testModuleData) { //For now, Arm64 only deal with module check createModules(assert, cpuInfoFile, moduleData) diff --git a/virtcontainers/qemu_arm64_test.go b/virtcontainers/qemu_arm64_test.go index 30f3568010..affc509845 100644 --- a/virtcontainers/qemu_arm64_test.go +++ b/virtcontainers/qemu_arm64_test.go @@ -25,6 +25,7 @@ func newTestQemu(machineType string) qemuArch { } func TestQemuArm64CPUModel(t *testing.T) { + virt := defaultQemuMachineType assert := assert.New(t) arm64 := newTestQemu(virt) @@ -39,19 +40,21 @@ func TestQemuArm64CPUModel(t *testing.T) { } func TestQemuArm64MemoryTopology(t *testing.T) { + virt := defaultQemuMachineType assert := assert.New(t) arm64 := newTestQemu(virt) memoryOffset := 1024 hostMem := uint64(1024) mem := uint64(120) + slots := uint8(10) expectedMemory := govmmQemu.Memory{ Size: fmt.Sprintf("%dM", mem), - Slots: defaultMemSlots, + Slots: slots, MaxMem: fmt.Sprintf("%dM", hostMem+uint64(memoryOffset)), } - m := arm64.memoryTopology(mem, hostMem) + m := arm64.memoryTopology(mem, hostMem, slots) assert.Equal(expectedMemory, m) }