node_exporter icon indicating copy to clipboard operation
node_exporter copied to clipboard

end-to-end tests fail when run on an ARM system

Open somehibs opened this issue 4 years ago • 2 comments

Host operating system: output of uname -a

Linux HOSTNAME 5.10.11-v7l+ #1399 SMP Thu Jan 28 12:09:48 GMT 2021 armv7l GNU/Linux

node_exporter version: output of node_exporter --version

node_exporter, version 1.1.2 (branch: master, revision: 7717702c96f374a072913052ffaa67e30fd2d98b) build user: user@HOSTNAME build date: 20210404-10:52:17 go version: go1.16.3 platform: linux/arm

node_exporter command line flags

Not applicable (end-to-end-test.sh)

Are you running node_exporter in Docker?

No

What did you do that produced an error?

Ran make

What did you expect to see?

Successful build

What did you see instead?

End to end test failure caused by faking an Intel processor for /proc/cpuinfo tests. procfs expects an ARM processor and crashes trying to access a missing string. On an ARM system, /proc/cpuinfo is expected to contain the line 'Features :' but the test information is for an Intel Core i7.

panic: runtime error: index out of range [1] with length 1

goroutine 96 [running]:
github.com/prometheus/procfs.parseCPUInfoARM(0x2558000, 0x2900, 0x3000, 0x2900, 0x3000, 0x0, 0x0, 0x2)
	/home/user/go/pkg/mod/github.com/prometheus/[email protected]/cpuinfo.go:250 +0xa80
github.com/prometheus/procfs.FS.CPUInfo(0xbeb03162, 0x17, 0x0, 0x0, 0x0, 0x0, 0x0)
	/home/user/go/pkg/mod/github.com/prometheus/[email protected]/cpuinfo.go:72 +0x13c
github.com/prometheus/node_exporter/collector.(*cpuCollector).updateInfo(0x20a25a0, 0x22bb140, 0x0, 0x0)
	/home/user/go/src/github.com/prometheus/node_exporter/collector/cpu_linux.go:147 +0x2c
github.com/prometheus/node_exporter/collector.(*cpuCollector).Update(0x20a25a0, 0x22bb140, 0x41bdb5ea, 0x0)
	/home/user/go/src/github.com/prometheus/node_exporter/collector/cpu_linux.go:132 +0xb4
github.com/prometheus/node_exporter/collector.execute(0x697337, 0x3, 0x7733b0, 0x20a25a0, 0x22bb140, 0x773158, 0x20ad308)
	/home/user/go/src/github.com/prometheus/node_exporter/collector/collector.go:153 +0x40
github.com/prometheus/node_exporter/collector.NodeCollector.Collect.func1(0x22bb140, 0x217e180, 0x773158, 0x20ad308, 0x22c04e0, 0x697337, 0x3, 0x7733b0, 0x20a25a0)
	/home/user/go/src/github.com/prometheus/node_exporter/collector/collector.go:144 +0x4c
created by github.com/prometheus/node_exporter/collector.NodeCollector.Collect
	/home/user/go/src/github.com/prometheus/node_exporter/collector/collector.go:143 +0xcc
=========================
./end-to-end-test.sh: line 138: kill: (28796) - No such process
make: *** [Makefile:116: test-e2e] Error 1

Example output from /proc/cpuinfo for an ARM system

processor	: 0
model name	: ARMv7 Processor rev 3 (v7l)
BogoMIPS	: 108.00
Features	: half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32 
CPU implementer	: 0x41
CPU architecture: 7
CPU variant	: 0x0
CPU part	: 0xd08
CPU revision	: 3

Output used in the end to end test

processor	: 7
vendor_id	: GenuineIntel
cpu family	: 6
model		: 142
model name	: Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz
stepping	: 10
microcode	: 0xb4
cpu MHz		: 800.030
cache size	: 8192 KB
physical id	: 0
siblings	: 8
core id		: 3
cpu cores	: 4
apicid		: 7
initial apicid	: 7
fpu		: yes
fpu_exception	: yes
cpuid level	: 22
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx rdseed adx smap clflushopt intel_pt xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp md_clear flush_l1d
bugs		: cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs
bogomips	: 4224.00
clflush size	: 64
cache_alignment	: 64
address sizes	: 39 bits physical, 48 bits virtual
power management:

somehibs avatar Apr 04 '21 11:04 somehibs

I guess we should add an additional skip condition to the Makefile for this.

SuperQ avatar Apr 04 '21 11:04 SuperQ

Or, we stop using the end-to-end tests for the --collector.cpu.info feature.

SuperQ avatar Apr 04 '21 11:04 SuperQ

@SuperQ IIUC this is fixed: https://github.com/prometheus/node_exporter/pull/2415/files#diff-76f15e8612832d5c71c1fa40fceeef7f1d0fa0fe50064e026748fed80bb43f3aR82?

rexagod avatar Mar 19 '24 04:03 rexagod