Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

arm64: Fix static check error #1223

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions cli/kata-check_arm64.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
7 changes: 7 additions & 0 deletions cli/kata-check_arm64_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
7 changes: 5 additions & 2 deletions virtcontainers/qemu_arm64_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ func newTestQemu(machineType string) qemuArch {
}

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

Expand All @@ -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)
}

Expand Down