Skip to content

Commit 44529a8

Browse files
committed
[github] run the qemu boot tests
This runs all of the unittests for some of the architectures.
1 parent 743e46f commit 44529a8

File tree

1 file changed

+106
-0
lines changed

1 file changed

+106
-0
lines changed
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
name: LK QEMU Boot Tests
2+
3+
# Run boot tests on QEMU for various architectures
4+
5+
on:
6+
pull_request:
7+
push:
8+
branches-ignore:
9+
- 'wip/**'
10+
- 'docs/**' # Skip tests for documentation branches
11+
paths-ignore:
12+
- '**.md' # Skip tests when only markdown files change
13+
- 'docs/**' # Skip tests for docs directory changes
14+
15+
jobs:
16+
qemu-boot-test:
17+
runs-on: ubuntu-24.04
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
arch:
22+
- arm
23+
- arm64
24+
- m68k
25+
- riscv32
26+
- riscv64
27+
- x86
28+
- x86-64
29+
toolchain-ver: [15.2.0]
30+
31+
env:
32+
ARCH: ${{ matrix.arch }}
33+
TOOLCHAIN_VER: ${{ matrix.toolchain-ver }}
34+
35+
steps:
36+
- name: banner
37+
shell: bash
38+
run: |
39+
printf "Running QEMU boot tests with %d processors\n" "$(nproc)"
40+
grep -oP '(?<=model name\t: ).*' /proc/cpuinfo|head -n1
41+
echo ARCH = $ARCH
42+
echo TOOLCHAIN_VER = $TOOLCHAIN_VER
43+
44+
# check out the source
45+
- name: checkout
46+
uses: actions/checkout@v4
47+
48+
# Install QEMU
49+
- name: install qemu
50+
shell: bash
51+
run: |
52+
sudo apt-get update
53+
sudo apt-get install -y qemu-system-arm qemu-system-misc qemu-system-x86
54+
55+
# compute the toolchain prefix this project will need
56+
- name: compute toolchain
57+
shell: bash
58+
run: |
59+
case "${{ matrix.arch }}" in
60+
arm) TOOLCHAIN_PREFIX="arm-eabi-" ;;
61+
arm64) TOOLCHAIN_PREFIX="aarch64-elf-" ;;
62+
m68k) TOOLCHAIN_PREFIX="m68k-elf-" ;;
63+
riscv32) TOOLCHAIN_PREFIX="riscv32-elf-" ;;
64+
riscv64) TOOLCHAIN_PREFIX="riscv64-elf-" ;;
65+
x86) TOOLCHAIN_PREFIX="i386-elf-" ;;
66+
x86-64) TOOLCHAIN_PREFIX="x86_64-elf-" ;;
67+
*) echo "Unknown architecture: ${{ matrix.arch }}" && exit 1 ;;
68+
esac
69+
echo "TOOLCHAIN_PREFIX=${TOOLCHAIN_PREFIX}" >> $GITHUB_ENV
70+
echo "TOOLCHAIN=${TOOLCHAIN_PREFIX}${{ matrix.toolchain-ver }}-$(uname)-$(uname -m)" >> $GITHUB_ENV
71+
72+
# maintain a directory archives/ in the repo
73+
# it will contain tarballs of various toolchains
74+
- name: cache
75+
uses: actions/cache@v4
76+
id: cache
77+
with:
78+
# A list of files, directories, and wildcard patterns to cache and restore
79+
path: archives
80+
# An explicit key for restoring and saving the cache
81+
key: archives-${{ env.TOOLCHAIN }}-${{ env.TOOLCHAIN_ALT }}
82+
83+
# download a toolchain from https://newos.org/toolchains
84+
# if not already cached
85+
- name: fetch/extract toolchain
86+
shell: bash
87+
run: |
88+
TOOLCHAIN_BASE_URL="https://newos.org/toolchains"
89+
TOOLCHAIN_SUFFIX="tar.xz"
90+
TOOLCHAIN_ADDRESS="$TOOLCHAIN_BASE_URL/$TOOLCHAIN.$TOOLCHAIN_SUFFIX"
91+
mkdir -p archives
92+
cd archives
93+
echo "Downloading toolchain $TOOLCHAIN from $TOOLCHAIN_ADDRESS"
94+
wget -v -N $TOOLCHAIN_ADDRESS || exit 1
95+
cd ..
96+
echo "Unpacking $TOOLCHAIN"
97+
tar xf archives/$TOOLCHAIN.$TOOLCHAIN_SUFFIX || exit 1
98+
echo "$GITHUB_WORKSPACE/$TOOLCHAIN/bin" >> $GITHUB_PATH
99+
100+
# run the boot test for this architecture
101+
- name: run boot test
102+
shell: bash
103+
run: |
104+
./scripts/run-qemu-boot-tests.py --arch ${{ matrix.arch }}
105+
106+
# vim: ts=2 sw=2 expandtab

0 commit comments

Comments
 (0)