Skip to content

test: split proc stat limit coverage by architecture - #833

Open
happysnaker wants to merge 1 commit into
prometheus:masterfrom
happysnaker:fix-432-proc-stat-limits
Open

test: split proc stat limit coverage by architecture#833
happysnaker wants to merge 1 commit into
prometheus:masterfrom
happysnaker:fix-432-proc-stat-limits

Conversation

@happysnaker

Copy link
Copy Markdown

Fixes #432.

This keeps the ProcStat limit coverage architecture-aware without relying on the shared 64-bit fixture values in testdata/fixtures.ttar.

What changed

  • move TestProcStatLimits out of proc_stat_test.go
  • add 32-bit and 64-bit test entry points with the same build-tag split pattern used by proc_maps*_test.go
  • generate a tiny temporary /proc/<pid>/stat fixture per architecture, so the parsed CUTime / CSTime values match the native int width of that build target

Why this shape

The earlier math.MinInt / math.MaxInt constant-only approach still leaves a mismatch with the shipped fixture data, which encodes 64-bit extrema for those fields. On 32-bit architectures that means the test can compile but the parsed values are still not representable as native ints.

Using a temporary stat fixture keeps the test focused on the parser behavior we want to validate on each target architecture, while leaving the shared repository fixtures unchanged.

I did not run go test here; this patch is based on the issue discussion and static review only.

Signed-off-by: Shirong Lu <73147033+happysnaker@users.noreply.github.com>
@happysnaker
happysnaker force-pushed the fix-432-proc-stat-limits branch from 4bece3b to 3fceaf6 Compare July 1, 2026 17:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant