|
| 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