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>
This commit is contained in:
parent
2517e13a5e
commit
cbc33018b3
24
platforms/cpuinfo_test.go
Normal file
24
platforms/cpuinfo_test.go
Normal file
@ -0,0 +1,24 @@
|
||||
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)
|
||||
}
|
Loading…
Reference in New Issue
Block a user