mirror of
https://github.com/nestriness/nestri.git
synced 2026-09-19 17:25:19 +03:00
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:
@@ -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;
|
||||
}
|
||||
#[cfg(not(any(target_os = "linux", windows, target_os = "macos")))]
|
||||
|
||||
Reference in New Issue
Block a user