@@ -18,7 +18,7 @@ package procfs
1818import "testing"
1919
2020const (
21- cpuinfoArm7 = `
21+ cpuinfoArm7Legacy = `
2222Processor : ARMv7 Processor rev 5 (v7l)
2323processor : 0
2424BogoMIPS : 2400.00
@@ -37,6 +37,51 @@ Hardware : sun8i
3737Revision : 0000
3838Serial : 5400503583203c3c040e`
3939
40+ cpuinfoArm7 = `
41+ processor : 0
42+ model name : ARMv7 Processor rev 3 (v7l)
43+ BogoMIPS : 108.00
44+ Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
45+ CPU implementer : 0x41
46+ CPU architecture: 7
47+ CPU variant : 0x0
48+ CPU part : 0xd08
49+ CPU revision : 3
50+
51+ processor : 1
52+ model name : ARMv7 Processor rev 3 (v7l)
53+ BogoMIPS : 108.00
54+ Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
55+ CPU implementer : 0x41
56+ CPU architecture: 7
57+ CPU variant : 0x0
58+ CPU part : 0xd08
59+ CPU revision : 3
60+
61+ processor : 2
62+ model name : ARMv7 Processor rev 3 (v7l)
63+ BogoMIPS : 108.00
64+ Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
65+ CPU implementer : 0x41
66+ CPU architecture: 7
67+ CPU variant : 0x0
68+ CPU part : 0xd08
69+ CPU revision : 3
70+
71+ processor : 3
72+ model name : ARMv7 Processor rev 3 (v7l)
73+ BogoMIPS : 108.00
74+ Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
75+ CPU implementer : 0x41
76+ CPU architecture: 7
77+ CPU variant : 0x0
78+ CPU part : 0xd08
79+ CPU revision : 3
80+
81+ Hardware : BCM2835
82+ Revision : c03111
83+ `
84+
4085 cpuinfoS390x = `
4186vendor_id : IBM/S390
4287# processors : 4
@@ -153,8 +198,8 @@ func TestCPUInfoX86(t *testing.T) {
153198 }
154199}
155200
156- func TestCPUInfoParseARM (t * testing.T ) {
157- cpuinfo , err := parseCPUInfoARM ([]byte (cpuinfoArm7 ))
201+ func TestCPUInfoParseARMLegacy (t * testing.T ) {
202+ cpuinfo , err := parseCPUInfoARM ([]byte (cpuinfoArm7Legacy ))
158203 if err != nil || cpuinfo == nil {
159204 t .Fatalf ("unable to parse arm cpu info: %v" , err )
160205 }
@@ -169,6 +214,22 @@ func TestCPUInfoParseARM(t *testing.T) {
169214 }
170215}
171216
217+ func TestCPUInfoParseARM (t * testing.T ) {
218+ cpuinfo , err := parseCPUInfoARM ([]byte (cpuinfoArm7 ))
219+ if err != nil || cpuinfo == nil {
220+ t .Fatalf ("unable to parse arm cpu info: %v" , err )
221+ }
222+ if want , have := 4 , len (cpuinfo ); want != have {
223+ t .Errorf ("want number of processors %v, have %v" , want , have )
224+ }
225+ if want , have := "ARMv7 Processor rev 3 (v7l)" , cpuinfo [0 ].ModelName ; want != have {
226+ t .Errorf ("want vendor %v, have %v" , want , have )
227+ }
228+ if want , have := "thumb" , cpuinfo [1 ].Flags [1 ]; want != have {
229+ t .Errorf ("want flag %v, have %v" , want , have )
230+ }
231+ }
232+
172233func TestCPUInfoParseS390X (t * testing.T ) {
173234 cpuinfo , err := parseCPUInfoS390X ([]byte (cpuinfoS390x ))
174235 if err != nil || cpuinfo == nil {
0 commit comments