fix(nesdoctor): fall back to the SoC name on Apple Silicon, and print raw probes

The macOS arm added in the previous commit did not change anything -- the
runner still reported `gpu=unknown`. Checked rather than assumed, which is the
only reason it is known.

Two possible causes and no way to choose between them from here: either the
`system_profiler SPDisplaysDataType` parsing is wrong, or that machine is a
headless virtual Mac with no display adapter to enumerate at all, in which case
`unknown` was the correct answer and there is nothing to fix. The second is
likely and the first is not ruled out.

So, rather than guessing again: on an arm64 Mac the GPU *is* the SoC, so the
chip name is a true and useful answer even with no display attached.
`sysctl -n machdep.cpu.brand_string` works headless and yields
"Apple M1 (integrated)". Intel Macs get no fallback, because there the GPU may
be integrated or discrete and a guess would be wrong rather than coarse.

And the CI step now dumps the **raw** output of each platform's probes --
`system_profiler`, `Get-CimInstance Win32_VideoController`, `Get-PSDrive`,
`df -Pk`, `/sys/class/drm` -- into its own log group. A field that comes back
empty can then be told apart from a parser that is wrong, which is exactly the
distinction that cost this round trip. All of it is `|| true`: the step exists
for looking, and a probe that misbehaves on a runner must never fail a release.
This commit is contained in:
Wanjohi
2026-09-02 16:29:03 +03:00
parent 0f26df5c02
commit 730739a5c0
2 changed files with 44 additions and 0 deletions

View File

@@ -130,6 +130,29 @@ jobs:
echo "::group::${{ matrix.target }} — JSON" echo "::group::${{ matrix.target }} — JSON"
cat "$RUNNER_TEMP/probe.json" 2>/dev/null || echo "(no json written)" cat "$RUNNER_TEMP/probe.json" 2>/dev/null || echo "(no json written)"
echo "::endgroup::" echo "::endgroup::"
# The raw output of the platform probes, so a field that comes back
# empty can be told apart from a parser that is wrong. `gpu=unknown`
# on the macOS runner could be either, and guessing which cost a
# round trip.
echo "::group::${{ matrix.target }} — raw platform probes"
case "${{ runner.os }}" in
macOS)
system_profiler SPDisplaysDataType 2>&1 | head -40 || true
sysctl -n machdep.cpu.brand_string 2>&1 || true
df -Pk 2>&1 | head -20 || true
;;
Windows)
powershell -NoProfile -Command \
"Get-CimInstance Win32_VideoController | Format-List Name,AdapterCompatibility,AdapterRAM" 2>&1 | head -30 || true
powershell -NoProfile -Command \
"Get-PSDrive -PSProvider FileSystem | Format-Table Name,Free,Used" 2>&1 | head -20 || true
;;
Linux)
df -Pk 2>&1 | head -20 || true
ls -l /sys/class/drm/ 2>&1 | head -20 || true
;;
esac
echo "::endgroup::"
- name: Package - name: Package
shell: bash shell: bash

View File

@@ -293,6 +293,27 @@ fn gpus() -> Vec<Gpu> {
}); });
} }
} }
// Fallback for Apple Silicon, where the GPU *is* the SoC.
//
// The CI runner is a headless virtual Mac and still reported
// `gpu=unknown` after the parser above was added, which means either
// the parser is wrong or that machine genuinely has no display adapter
// to enumerate. Both are plausible and the second is likely, so rather
// than guess: on an arm64 Mac the integrated GPU is part of the chip,
// so the chip name is a true and useful answer even with no display
// attached.
if gpus.is_empty() && cfg!(target_arch = "aarch64") {
if let Some(soc) = sh("sysctl", &["-n", "machdep.cpu.brand_string"]) {
let soc = soc.trim();
if !soc.is_empty() {
gpus.push(Gpu {
name: format!("{soc} (integrated)"),
vendor: Some("Apple".into()),
render_node: None,
});
}
}
}
return gpus; return gpus;
} }
#[cfg(not(any(target_os = "linux", windows, target_os = "macos")))] #[cfg(not(any(target_os = "linux", windows, target_os = "macos")))]