Skip to content

Commit c9b9e77

Browse files
committed
ci: add test for qemu
1 parent 7d1e95a commit c9b9e77

File tree

2 files changed

+61
-4
lines changed

2 files changed

+61
-4
lines changed

.github/workflows/test.yml renamed to .github/workflows/test-board.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
name: Test CI
1+
name: Test for BOARD
22

33
on: [push, pull_request, workflow_dispatch]
44

55
jobs:
6-
board-test:
7-
name: "Test ${{ matrix.board }} - ${{ matrix.vmconfigs_name }}"
6+
test-board:
7+
name: "Test board: ${{ matrix.board }} - ${{ matrix.vmconfigs_name }}"
88
strategy:
99
matrix:
1010
include:
@@ -39,7 +39,7 @@ jobs:
3939
- name: Checkout
4040
uses: actions/checkout@v4
4141

42-
- name: Install dependencies (${{ matrix.board_name }})
42+
- name: Install dependencies
4343
run: cargo +stable install -f --git https://github.com/ZR233/ostool ostool
4444

4545
- name: Download images and patch VM configs

.github/workflows/test-qemu.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Test for QEMU
2+
3+
on: [workflow_dispatch]
4+
5+
jobs:
6+
test-qemu:
7+
name: "Test qemu: ${{ matrix.arch }} - ${{ matrix.vmconfigs_name }}"
8+
strategy:
9+
matrix:
10+
include:
11+
- arch: aarch64
12+
vmconfigs: configs/vms/arceos-aarch64-qemu-smp1.toml
13+
vmconfigs_name: ArceOS
14+
vmimage_name: qemu_arceos_aarch64
15+
- arch: riscv64
16+
vmconfigs: configs/vms/arceos-riscv64-qemu-smp1.toml
17+
vmconfigs_name: ArceOS
18+
vmimage_name: qemu_arceos_riscv64
19+
- arch: x86_64
20+
vmconfigs: configs/vms/arceos-x86_64-qemu-smp1.toml
21+
vmconfigs_name: ArceOS
22+
vmimage_name: qemu_arceos_x86_64
23+
fail-fast: false
24+
runs-on:
25+
- self-hosted
26+
- linux
27+
- intel
28+
29+
steps:
30+
- name: Checkout
31+
uses: actions/checkout@v4
32+
33+
- name: Install dependencies
34+
run: cargo +stable install -f --git https://github.com/ZR233/ostool ostool
35+
36+
- name: Download images and patch VM configs
37+
run: |
38+
echo "Downloading guest images and patching VM config files..."
39+
IFS=',' read -ra CONFIGS <<< "${{ matrix.vmconfigs }}"
40+
IFS=',' read -ra IMAGES <<< "${{ matrix.vmimage_name }}"
41+
for i in "${!CONFIGS[@]}"; do
42+
img="${IMAGES[$i]}"
43+
img=$(echo "$img" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
44+
config="${CONFIGS[$i]}"
45+
config=$(echo "$config" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
46+
cargo xtask image download $img
47+
sed -i 's|^kernel_path[[:space:]]*=.*|kernel_path = "/tmp/axvisor/'"$img"'/'"$img"'"|' "$config"
48+
echo "Updated kernel_path in $config"
49+
done
50+
51+
- name: Run tests
52+
run: |
53+
export RUST_LOG=debug
54+
cargo xtask qemu \
55+
--build-config configs/board/${{ matrix.arch }}.toml \
56+
--uboot-config .github/workflows/uboot.toml \
57+
--vmconfigs ${{ matrix.vmconfigs }}

0 commit comments

Comments
 (0)