Skip to content

Commit be6699e

Browse files
committed
Log the host CPU in build-test jobs
Print the OS and hypervisor versions and the CPU model and features before building, to help debug failures that depend on the runner. Signed-off-by: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com>
1 parent dc1d246 commit be6699e

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

‎.github/workflows/dep_build_test.yml‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,34 @@ jobs:
126126
name: c-guests-${{ inputs.arch }}-${{ inputs.config }}
127127
path: src/tests/c_guests/bin/${{ inputs.config }}/
128128

129+
# For helping with debugging.
130+
- name: Log CPU
131+
continue-on-error: true
132+
run: |
133+
case "$RUNNER_OS" in
134+
Linux)
135+
echo "Kernel: $(uname -r)"
136+
(dmesg || sudo -n dmesg) 2>/dev/null | grep -m1 'Host Build' || true
137+
lscpu
138+
sed '/^$/q' /proc/cpuinfo
139+
;;
140+
Windows)
141+
pwsh -NoProfile -Command '
142+
"OS: " + [System.Environment]::OSVersion.VersionString
143+
Get-ChildItem "$env:SystemRoot\System32\hv*64.exe" | ForEach-Object { "Installed hypervisor: {0} {1}" -f $_.Name, $_.VersionInfo.ProductVersion }
144+
reg query "HKLM\HARDWARE\DESCRIPTION\System\CentralProcessor\0"
145+
if ($env:RUNNER_ARCH -eq "X64") {
146+
$r = [System.Runtime.Intrinsics.X86.X86Base]::CpuId(0x40000002, 0)
147+
"Running hypervisor: {0}.{1}.{2}.{3}" -f ($r.Item2 -shr 16), ($r.Item2 -band 0xFFFF), $r.Item1, ($r.Item4 -band 0xFFFFFF)
148+
foreach ($leaf in 1, 7, 0xD, 0x80000001, 0x80000008) {
149+
$r = [System.Runtime.Intrinsics.X86.X86Base]::CpuId($leaf, 0)
150+
"CPUID {0:X8}: {1:X8} {2:X8} {3:X8} {4:X8}" -f $leaf, $r.Item1, $r.Item2, $r.Item3, $r.Item4
151+
}
152+
}'
153+
;;
154+
macOS) sysctl machdep.cpu hw.optional ;;
155+
esac
156+
129157
- name: Build
130158
run: just build ${{ inputs.config }}
131159

0 commit comments

Comments
 (0)