Skip to content

cpu: add regression test for non key:value lines in /proc/cpuinfo - #467

Merged
jaypipes merged 1 commit into
jaypipes:mainfrom
europaul:cpu-no-colon-test
Jul 8, 2026
Merged

jaypipes merged 1 commit into
jaypipes:mainfrom
europaul:cpu-no-colon-test

Conversation

@europaul

@europaul europaul commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

What

Adds a targeted regression test (TestQualcommCPUInfo) for /proc/cpuinfo contents that
contain lines without a : separator, as seen on some Qualcomm ARM SoCs (e.g. QCM6125),
where the SoC name appears on a line of its own:

processor       : 0
...
CPU revision    : 2

Qualcomm Technologies, Inc QCM6125

Why

Older ghw crashed on such lines. The underlying bug was already fixed upstream (#441, #443),
but there is no synthetic regression test locking that behavior in — the existing cpu tests
are all snapshot-fixture based. This test builds a minimal chroot with such a cpuinfo file
and asserts cpu.New succeeds and reports exactly one processor.

We (Zededa) hit this on real devices while using ghw for hardware inventory in
lf-edge/eve; this ports the test from our fork.

Testing

go test ./pkg/cpu/... passes on Linux.

add a simple test for a cpuinfo file that has lines without
':' and therefore crashed the code.

This test is based on the description of the commit with
the fix

Signed-off-by: Christoph Ostarek <christoph@zededa.com>
@europaul
europaul marked this pull request as draft July 7, 2026 13:57

@jaypipes jaypipes left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thank you @europaul :)

@jaypipes

jaypipes commented Jul 7, 2026

Copy link
Copy Markdown
Owner

@europaul did you want to take this out of draft state?

@europaul
europaul marked this pull request as ready for review July 8, 2026 09:28
@europaul

europaul commented Jul 8, 2026

Copy link
Copy Markdown
Contributor Author

@europaul did you want to take this out of draft state?

yes, sorry for the confusion :)

@jaypipes
jaypipes merged commit 6d7ddfe into jaypipes:main Jul 8, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants