Skip to content

Commit 632e068

Browse files
committed
Fix cpu_info tests with qemu >= 8.2, update README
Signed-off-by: Paul Guyot <pguyot@kallisys.net>
1 parent 8b7ac3c commit 632e068

2 files changed

Lines changed: 57 additions & 21 deletions

File tree

.github/workflows/test-cpu_info.yml

Lines changed: 50 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@ on:
99

1010
jobs:
1111
test_zero_w:
12-
runs-on: ubuntu-latest
12+
runs-on: ${{ matrix.runner }}
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
runner: ["ubuntu-22.04", "ubuntu-24.04"]
1317
steps:
1418
- uses: actions/checkout@v4
1519
- uses: ./ # pguyot/arm-runner-action@HEAD
@@ -21,43 +25,58 @@ jobs:
2125
cat /proc/cpuinfo > cpuinfo.txt
2226
- name: Test content of cpuinfo
2327
run: |
28+
cat cpuinfo.txt
2429
grep -c ARMv6 cpuinfo.txt
2530
grep -c "CPU architecture: 7" cpuinfo.txt
26-
grep -c 6769746875620000 cpuinfo.txt
31+
grep -c "CPU part.*0xb76" cpuinfo.txt
2732
test_3b:
28-
runs-on: ubuntu-latest
33+
runs-on: ${{ matrix.runner }}
34+
strategy:
35+
fail-fast: false
36+
matrix:
37+
runner: ["ubuntu-22.04", "ubuntu-24.04"]
2938
steps:
3039
- uses: actions/checkout@v4
3140
- uses: ./ # pguyot/arm-runner-action@HEAD
3241
with:
3342
cpu_info: cpuinfo/raspberrypi_3b
3443
bind_mount_repository: true
35-
cpu: cortex-a7
44+
cpu: cortex-a53:cortex-a53
3645
commands: |
3746
cat /proc/cpuinfo > cpuinfo.txt
3847
- name: Test content of cpuinfo
3948
run: |
49+
cat cpuinfo.txt
4050
grep -c ARMv7 cpuinfo.txt
4151
grep -c "CPU architecture: 7" cpuinfo.txt
42-
grep -c 676974687562003b cpuinfo.txt
52+
grep -c "CPU part.*0xd03" cpuinfo.txt
4353
test_zero2_w:
44-
runs-on: ubuntu-latest
54+
runs-on: ${{ matrix.runner }}
55+
strategy:
56+
fail-fast: false
57+
matrix:
58+
runner: ["ubuntu-22.04", "ubuntu-24.04"]
4559
steps:
4660
- uses: actions/checkout@v4
4761
- uses: ./ # pguyot/arm-runner-action@HEAD
4862
with:
4963
cpu_info: cpuinfo/raspberrypi_zero2_w
5064
bind_mount_repository: true
51-
cpu: cortex-a7
65+
cpu: cortex-a53:cortex-a53
5266
commands: |
5367
cat /proc/cpuinfo > cpuinfo.txt
5468
- name: Test content of cpuinfo
5569
run: |
70+
cat cpuinfo.txt
5671
grep -c ARMv7 cpuinfo.txt
5772
grep -c "CPU architecture: 7" cpuinfo.txt
58-
grep -c 6769746875620002 cpuinfo.txt
73+
grep -c "CPU part.*0xd03" cpuinfo.txt
5974
test_zero2_w_arm64:
60-
runs-on: ubuntu-latest
75+
runs-on: ${{ matrix.runner }}
76+
strategy:
77+
fail-fast: false
78+
matrix:
79+
runner: ["ubuntu-22.04", "ubuntu-24.04"]
6180
steps:
6281
- uses: actions/checkout@v4
6382
- uses: ./ # pguyot/arm-runner-action@HEAD
@@ -70,39 +89,51 @@ jobs:
7089
cat /proc/cpuinfo > cpuinfo.txt
7190
- name: Test content of cpuinfo
7291
run: |
92+
cat cpuinfo.txt
7393
grep -c "CPU architecture: 8" cpuinfo.txt
74-
grep -c 6769746875620002 cpuinfo.txt
94+
grep -c "CPU part.*0xd03" cpuinfo.txt
7595
test_4b:
76-
runs-on: ubuntu-latest
96+
runs-on: ${{ matrix.runner }}
97+
strategy:
98+
fail-fast: false
99+
matrix:
100+
runner: ["ubuntu-22.04", "ubuntu-24.04"]
77101
steps:
78102
- uses: actions/checkout@v4
79103
- uses: ./ # pguyot/arm-runner-action@HEAD
80104
with:
81105
cpu_info: cpuinfo/raspberrypi_4b
82106
bind_mount_repository: true
83-
cpu: cortex-a53
107+
cpu: max:cortex-a72
108+
base_image: raspios_lite_arm64:latest
84109
commands: |
85110
cat /proc/cpuinfo > cpuinfo.txt
86111
- name: Test content of cpuinfo
87112
run: |
88113
cat cpuinfo.txt
89114
grep -c "CPU architecture: 8" cpuinfo.txt
90-
grep -c 676974687562004b cpuinfo.txt
115+
grep -c "CPU part.*0xd08" cpuinfo.txt
91116
test_5:
92-
runs-on: ubuntu-latest
117+
runs-on: ${{ matrix.runner }}
118+
strategy:
119+
fail-fast: false
120+
matrix:
121+
runner: ["ubuntu-22.04", "ubuntu-24.04"]
93122
steps:
94123
- uses: actions/checkout@v4
95124
- uses: ./ # pguyot/arm-runner-action@HEAD
96125
with:
97126
cpu_info: cpuinfo/raspberrypi_5
98127
bind_mount_repository: true
99-
cpu: cortex-a53
128+
cpu: cortex-a76
129+
base_image: raspios_lite_arm64:latest
100130
commands: |
101131
cat /proc/cpuinfo > cpuinfo.txt
102132
- name: Test content of cpuinfo
103133
run: |
134+
cat cpuinfo.txt
104135
grep -c "CPU architecture: 8" cpuinfo.txt
105-
grep -c 6769746875620050 cpuinfo.txt
136+
grep -c "CPU part.*0xd0b" cpuinfo.txt
106137
test_cortex_a76:
107138
# Ubuntu 24.04 comes with qemu >= 8.2 which does emulate /proc/cpuinfo
108139
# on aarch64
@@ -113,9 +144,12 @@ jobs:
113144
with:
114145
bind_mount_repository: true
115146
cpu: cortex-a76
147+
base_image: raspios_lite_arm64:latest
116148
commands: |
117149
cat /proc/cpuinfo > cpuinfo.txt
118150
- name: Test content of cpuinfo
119151
run: |
152+
cat cpuinfo.txt
120153
grep -c "model name : ARMv8 Processor rev 0 (v8l)" cpuinfo.txt
121154
grep -c "CPU architecture: 8" cpuinfo.txt
155+
grep -c "CPU part.*0xd0b" cpuinfo.txt

README.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -200,9 +200,8 @@ from the target system.
200200
#### `cpu_info`
201201

202202
Path to a fake cpu_info file to be used instead of `/proc/cpuinfo`. Default is
203-
to not fake the CPU. With older versions of qemu, including the one provided
204-
by ubuntu-latest as of this writing (ubuntu 22.04, qemu 6), `/proc/cpuinfo` is
205-
not intercepted and will report amd64 CPU of GitHub runner.
203+
to not fake the CPU. With older versions of qemu, `/proc/cpuinfo` is not
204+
intercepted and will report amd64 CPU of GitHub runner.
206205

207206
Some software checks for features using `/proc/cpuinfo` and this option can be
208207
used to trick them. The path is relative to the action (to use pre-defined
@@ -229,8 +228,11 @@ default emulated CPU for 32 bits may not work and you should set `cpu` option
229228
to `cortex-a7`.
230229

231230
qemu 8.2 and higher do intercept `/proc/cpuinfo` to report something related
232-
to the passed cpu option. So if you are running ubuntu-24.04 or if you install
233-
your own version of qemu-user-arm/aarch64, this option will be effectless.
231+
to the passed `cpu` option. So if you are running ubuntu-24.04 or if you install
232+
your own version of qemu-user-arm/aarch64, this option will not override
233+
`/proc/cpuinfo`; set `cpu` to the CPU you want qemu to report instead. For
234+
example, Raspberry Pi 4 should use `max:cortex-a72` with a 64-bit image, and
235+
Raspberry Pi 5 should use `cortex-a76` with a 64-bit image.
234236

235237
#### `optimize_image`
236238

0 commit comments

Comments
 (0)