Fix machine-dependent format_cpu_cores tests - #155
Merged
Conversation
`format_cpu_cores` reads the host's real CPU topology (Linux /sys cpufreq, macOS hw.perflevel*) and returns a "NP + ME / KT" hybrid string on Intel P/E and Apple Silicon machines, ignoring its passed-in (logical, physical) counts. The four fallback unit tests called it with fixed args, so they passed on non-hybrid CPUs/CI runners but failed on a hybrid host — an i7-1360P produced "8P + 8E / 16T" for (16, Some(8)) where the test expected "8C / 16T", hard- failing `just pr` there. Extract the pure fallback into `format_cpu_cores_plain` and retarget the four tests at it, so they no longer depend on the runner's hardware. Public behavior of `format_cpu_cores` is unchanged. Assisted-By: Claude Opus 4.8
l1a
added a commit
that referenced
this pull request
Jul 24, 2026
Two coupled docs/test-hygiene fixes (no runtime behavior change), bundled because the first is what lets `just pr` pass on the reinstalled Fedora box. 1. Machine-independent xrandr display tests. parse_xrandr_displays called get_monitor_name_for_port (live /sys/class/drm EDID) inline, so the fixture tests substituted the physically-attached monitor for the fixture's connector name (DP-1 -> the panel's EDID model ATNA33AA08-0). These tests are cfg(not(macos/windows)) and never ran on the old Windows arrakis, so the defect was latent until the first cargo test after the Fedora reinstall. Same class as #155. Extract a pure parse_xrandr_displays_with(stdout, resolve); the public wrapper passes get_monitor_name_for_port (production unchanged) and the tests pass |_| None. Add a regression test asserting the resolver is honored. 2. Regenerate docs/retch.1. The committed page carried double-bold groff runs from the Windows #160 `just man` run, where the recipe's sed 's/\fB\fB/\fB/g' strip did not take effect. Linux regeneration produces the intended single-bold output, matching the recipe's intent. Patch bump: retch-cli 0.6.2, retch-sysinfo 0.1.46 (new pub parse_xrandr_displays_with). Assisted-By: Claude Opus 4.8
8 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
format_cpu_coresreads the host's real CPU topology (Linux/sys/.../cpufreq,macOS
hw.perflevel*) and returns a"NP + ME / KT"hybrid string on Intel P/E and AppleSilicon machines, ignoring its passed-in
(logical, physical)counts. The four fallback unittests called it with fixed arguments, so they passed on non-hybrid CPUs and CI runners but
failed on a hybrid host — an i7-1360P produced
"8P + 8E / 16T"for(16, Some(8))wheretest_format_cpu_cores_hyperthreadedexpected"8C / 16T", hard-failingjust pron thatmachine. It had gone unnoticed because it was only ever exercised on non-hybrid hosts/runners.
Fix
Extract the pure fallback (
match physical { … }) into a privateformat_cpu_cores_plain(logical, physical)and retarget the four fallback tests at it, so theytest deterministic formatting without touching host hardware.
format_cpu_cores's publicbehavior is unchanged — it still detects hybrid topology first, then delegates to the helper.
Internal refactor + test-only fix; no user-visible behavior change.
retch-sysinfo→0.1.42,retch-cli→0.4.2.Test plan
cargo test -p retch-sysinfo --lib format_cpu_cores— all 4 pass on this i7-1360P hybrid (previously 1 failed)just prgate passes end-to-end (fmt, clippy--workspace, full test suite 85 green, man page current,Cargo.lockcurrent)