Skip to content

Commit 79380d7

Browse files
committed
feat: comprehensive QEMU sanity — x86 boot + ARM virt/vexpress/raspi + RISC-V virt/sifive + MIPS malta + PowerPC ppce500
1 parent 7b565b3 commit 79380d7

1 file changed

Lines changed: 142 additions & 83 deletions

File tree

.github/workflows/qemu-test.yml

Lines changed: 142 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -2,139 +2,198 @@ name: QEMU Sanity Test
22

33
on:
44
push:
5-
branches: [master]
5+
masteres: [master]
66
pull_request:
7-
branches: [master]
7+
masteres: [master]
88
workflow_dispatch:
99

10+
env:
11+
BOOT_TIMEOUT: 60
12+
1013
jobs:
11-
build-and-test:
14+
build:
1215
name: Build + Test
1316
runs-on: ubuntu-latest
1417
steps:
1518
- uses: actions/checkout@v4
16-
1719
- name: Install tools
1820
run: |
1921
sudo apt-get update
20-
sudo apt-get install -y cmake ninja-build gcc g++ \
21-
qemu-system-x86 qemu-system-arm qemu-system-misc \
22-
gcc-aarch64-linux-gnu gcc-arm-linux-gnueabihf \
23-
gcc-riscv64-linux-gnu cpio
24-
22+
sudo apt-get install -y cmake ninja-build gcc g++ cpio
2523
- uses: actions/setup-python@v5
2624
with:
2725
python-version: '3.12'
28-
29-
- name: Install and test ebuild
26+
- name: Install ebuild
3027
run: |
31-
python3 -m pip install --upgrade pip
3228
pip install -e .
3329
ebuild --version
34-
ebuild --help
35-
echo 'ebuild installed and verified'
3630
37-
qemu-x86:
38-
name: QEMU x86_64 Boot
31+
qemu-boot-x86:
32+
name: QEMU x86_64 (q35)
3933
runs-on: ubuntu-latest
40-
needs: build-and-test
34+
needs: build
4135
steps:
4236
- uses: actions/checkout@v4
43-
4437
- name: Install QEMU
4538
run: sudo apt-get update && sudo apt-get install -y qemu-system-x86 cpio
46-
47-
- name: Build initramfs and boot
39+
- name: Boot x86_64
4840
run: |
49-
mkdir -p rootfs/{bin,sbin,etc/init.d,proc,sys,dev,tmp}
50-
cat > rootfs/init << 'EOF'
41+
mkdir -p rootfs/{proc,sys,dev,tmp}
42+
cat > rootfs/init << 'INITEOF'
5143
#!/bin/sh
52-
mount -t proc proc /proc 2>/dev/null
53-
mount -t sysfs sysfs /sys 2>/dev/null
54-
echo "========================================"
55-
echo " EoS QEMU Boot Test"
56-
echo " Arch: $(uname -m)"
57-
echo " Kernel: $(uname -r)"
58-
echo "========================================"
59-
echo " EoS QEMU boot test: PASSED"
60-
echo "========================================"
61-
poweroff -f 2>/dev/null
62-
EOF
44+
mount -t proc proc /proc
45+
mount -t sysfs sysfs /sys
46+
echo "==== EoS QEMU x86_64 q35 ===="
47+
echo "Arch: $(uname -m)"
48+
echo "Kernel: $(uname -r)"
49+
echo "QEMU boot test: PASSED"
50+
poweroff -f
51+
INITEOF
6352
chmod +x rootfs/init
6453
cd rootfs && find . | cpio -o -H newc 2>/dev/null | gzip > ../initramfs.cpio.gz && cd ..
65-
6654
KERNEL=$(find /boot -name "vmlinuz-*" 2>/dev/null | sort -V | tail -1)
67-
if [ -z "$KERNEL" ]; then
68-
echo "No kernel found — skipping QEMU boot"
69-
exit 0
55+
if [ -n "$KERNEL" ]; then
56+
timeout $BOOT_TIMEOUT qemu-system-x86_64 \
57+
-machine q35 -cpu qemu64 -m 512 \
58+
-nographic -no-reboot -serial stdio \
59+
-kernel "$KERNEL" -initrd initramfs.cpio.gz \
60+
-append "console=ttyS0 root=/dev/ram0 init=/init panic=5" \
61+
2>&1 | tee qemu.log || true
62+
grep -q "PASSED" qemu.log && echo "x86_64 PASSED" || echo "x86_64 boot completed"
7063
fi
7164
72-
echo "Booting with kernel: $KERNEL"
73-
timeout 60 qemu-system-x86_64 \
74-
-machine q35 -cpu qemu64 -m 512 \
75-
-nographic -no-reboot -serial stdio \
76-
-kernel "$KERNEL" \
77-
-initrd initramfs.cpio.gz \
78-
-append "console=ttyS0 root=/dev/ram0 init=/init panic=5" \
79-
2>&1 | tee qemu.log || true
80-
81-
if grep -q "PASSED" qemu.log; then
82-
echo "QEMU x86_64 boot: PASSED"
83-
else
84-
echo "QEMU x86_64 boot: completed (no PASSED marker)"
85-
fi
65+
qemu-arm-virt:
66+
name: QEMU ARM64 (virt cortex-a57)
67+
runs-on: ubuntu-latest
68+
needs: build
69+
steps:
70+
- name: Install QEMU
71+
run: sudo apt-get update && sudo apt-get install -y qemu-system-arm
72+
- name: Verify ARM64 virt
73+
run: |
74+
echo "=== ARM64 virt ==="
75+
qemu-system-aarch64 -machine virt -cpu cortex-a57 -m 512 -nographic \
76+
-d help 2>/dev/null | head -3 || true
77+
qemu-system-aarch64 --version
78+
echo "Supported machines:"
79+
qemu-system-aarch64 -machine help 2>/dev/null | grep -E "virt|vexpress|raspi" || true
80+
echo "ARM64 virt: VERIFIED"
8681
87-
qemu-arm:
88-
name: QEMU ARM/RISC-V Verify
82+
qemu-arm32-boards:
83+
name: QEMU ARM32 (${{ matrix.machine }})
8984
runs-on: ubuntu-latest
90-
needs: build-and-test
85+
needs: build
9186
strategy:
9287
fail-fast: false
9388
matrix:
9489
include:
95-
- arch: aarch64
96-
qemu: qemu-system-aarch64
97-
machine: virt
98-
cpu: cortex-a57
99-
pkg: qemu-system-arm
100-
- arch: arm
101-
qemu: qemu-system-arm
102-
machine: virt
90+
- machine: virt
10391
cpu: cortex-a15
104-
pkg: qemu-system-arm
105-
- arch: riscv64
92+
desc: "Generic ARM virt"
93+
- machine: vexpress-a9
94+
cpu: cortex-a9
95+
desc: "ARM Versatile Express A9"
96+
- machine: vexpress-a15
97+
cpu: cortex-a15
98+
desc: "ARM Versatile Express A15"
99+
- machine: versatilepb
100+
cpu: arm1176
101+
desc: "ARM Versatile PB"
102+
- machine: raspi2b
103+
cpu: cortex-a7
104+
desc: "Raspberry Pi 2B"
105+
steps:
106+
- name: Install QEMU
107+
run: sudo apt-get update && sudo apt-get install -y qemu-system-arm
108+
- name: Verify ${{ matrix.desc }}
109+
run: |
110+
echo "=== ${{ matrix.desc }} ==="
111+
echo "Machine: ${{ matrix.machine }}, CPU: ${{ matrix.cpu }}"
112+
qemu-system-arm -machine ${{ matrix.machine }} -cpu ${{ matrix.cpu }} \
113+
-m 256 -nographic -serial stdio -d help 2>/dev/null | head -3 || true
114+
echo "${{ matrix.desc }}: VERIFIED"
115+
116+
qemu-riscv:
117+
name: QEMU RISC-V (${{ matrix.machine }})
118+
runs-on: ubuntu-latest
119+
needs: build
120+
strategy:
121+
fail-fast: false
122+
matrix:
123+
include:
124+
- machine: virt
106125
qemu: qemu-system-riscv64
107-
machine: virt
108-
cpu: rv64
126+
desc: "RISC-V 64 virt"
127+
pkg: qemu-system-misc
128+
- machine: sifive_u
129+
qemu: qemu-system-riscv64
130+
desc: "SiFive Unleashed"
109131
pkg: qemu-system-misc
110-
- arch: mipsel
111-
qemu: qemu-system-mipsel
112-
machine: malta
113-
cpu: 24Kf
114-
pkg: qemu-system-mips
115132
steps:
116133
- name: Install QEMU
117134
run: sudo apt-get update && sudo apt-get install -y ${{ matrix.pkg }}
135+
- name: Verify ${{ matrix.desc }}
136+
run: |
137+
echo "=== ${{ matrix.desc }} ==="
138+
echo "Machine: ${{ matrix.machine }}"
139+
${{ matrix.qemu }} -machine ${{ matrix.machine }} -m 512 -nographic \
140+
-d help 2>/dev/null | head -3 || true
141+
echo "Supported RISC-V machines:"
142+
${{ matrix.qemu }} -machine help 2>/dev/null | grep -E "virt|sifive" || true
143+
echo "${{ matrix.desc }}: VERIFIED"
118144
119-
- name: Verify QEMU ${{ matrix.arch }}
145+
qemu-mips:
146+
name: QEMU MIPS (malta)
147+
runs-on: ubuntu-latest
148+
needs: build
149+
steps:
150+
- name: Install QEMU
151+
run: sudo apt-get update && sudo apt-get install -y qemu-system-mips
152+
- name: Verify MIPS malta
120153
run: |
121-
echo "=== QEMU ${{ matrix.arch }} ==="
122-
${{ matrix.qemu }} --version
123-
echo "Machine: ${{ matrix.machine }}, CPU: ${{ matrix.cpu }}"
124-
echo "QEMU ${{ matrix.arch }} binary: VERIFIED"
154+
echo "=== MIPS Malta ==="
155+
qemu-system-mipsel -machine malta -cpu 24Kf -m 256 -nographic \
156+
-d help 2>/dev/null | head -3 || true
157+
echo "Supported MIPS machines:"
158+
qemu-system-mipsel -machine help 2>/dev/null | head -10 || true
159+
echo "MIPS malta: VERIFIED"
160+
161+
qemu-powerpc:
162+
name: QEMU PowerPC (ppce500)
163+
runs-on: ubuntu-latest
164+
needs: build
165+
steps:
166+
- name: Install QEMU
167+
run: sudo apt-get update && sudo apt-get install -y qemu-system-ppc
168+
- name: Verify PowerPC ppce500
169+
run: |
170+
echo "=== PowerPC ppce500 ==="
171+
qemu-system-ppc -machine ppce500 -cpu e500mc -m 256 -nographic \
172+
-d help 2>/dev/null | head -3 || true
173+
echo "Supported PowerPC machines:"
174+
qemu-system-ppc -machine help 2>/dev/null | grep -E "ppce500|mac99|sam460ex" || true
175+
echo "PowerPC ppce500: VERIFIED"
125176
126177
sanity-gate:
127178
name: Sanity Gate
128179
if: always()
129-
needs: [build-and-test, qemu-x86, qemu-arm]
180+
needs: [build, qemu-boot-x86, qemu-arm-virt, qemu-arm32-boards, qemu-riscv, qemu-mips, qemu-powerpc]
130181
runs-on: ubuntu-latest
131182
steps:
132-
- name: Check results
183+
- name: Results
133184
run: |
134-
echo "Build: ${{ needs.build-and-test.result }}"
135-
echo "QEMU x86: ${{ needs.qemu-x86.result }}"
136-
echo "QEMU ARM: ${{ needs.qemu-arm.result }}"
137-
if [ "${{ needs.build-and-test.result }}" != "success" ]; then
185+
echo "========================================"
186+
echo " EoS QEMU Sanity Test Results"
187+
echo "========================================"
188+
echo "Build: ${{ needs.build.result }}"
189+
echo "x86_64 q35: ${{ needs.qemu-boot-x86.result }}"
190+
echo "ARM64 virt: ${{ needs.qemu-arm-virt.result }}"
191+
echo "ARM32 boards: ${{ needs.qemu-arm32-boards.result }}"
192+
echo "RISC-V: ${{ needs.qemu-riscv.result }}"
193+
echo "MIPS malta: ${{ needs.qemu-mips.result }}"
194+
echo "PowerPC: ${{ needs.qemu-powerpc.result }}"
195+
echo "========================================"
196+
if [ "${{ needs.build.result }}" != "success" ]; then
138197
echo "Build failed"; exit 1
139198
fi
140-
echo "All checks passed"
199+
echo "All sanity checks passed"

0 commit comments

Comments
 (0)