containerd/platforms/cpuinfo_test.go
Wei Chen cbc33018b3 ctr: Add a test file to test cpu getCpuVariant
Change-Id: Id9558de2e41b08c41cf7d4b458774e99e24515a0
Signed-off-by: Wei Chen <Wei.Chen@arm.com>
Signed-off-by: Penny Zheng <Penny.Zheng@arm.com>
2017-12-20 14:50:20 +08:00

25 lines
487 B
Go

package platforms
import (
"runtime"
"testing"
)
func TestCPUVariant(t *testing.T) {
if !isArmArch(runtime.GOARCH) || !isLinuxOS(runtime.GOOS) {
t.Skip("only relevant on linux/arm")
}
variants := []string{"v8", "v7", "v6", "v5", "v4", "v3"}
p := getCPUVariant()
for _, variant := range variants {
if p == variant {
t.Logf("got valid variant as expected: %#v = %#v\n", p, variant)
return
}
}
t.Fatalf("could not get valid variant as expected: %v\n", variants)
}