Skip to content

Commit b1f7236

Browse files
committed
github/workflows: Run the selftests on multiple architectures
We're already running the tests in QEMU, so it only takes a bit of surgery to enable them to run on all the architectures we can pull the Fedora kernels from. Signed-off-by: Toke Høiland-Jørgensen <[email protected]>
1 parent f17b087 commit b1f7236

File tree

4 files changed

+33
-44
lines changed

4 files changed

+33
-44
lines changed

.github/scripts/prepare_test_kernel.sh

+20-20
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,25 @@
22

33
set -e
44

5-
if [[ "$KERNEL_VERSION" == "LATEST" ]]; then
6-
git clone --depth 1 https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git kernel
7-
cd kernel
8-
cp "$GITHUB_WORKSPACE"/.github/scripts/.config .config
9-
make -j $(nproc) olddefconfig all
10-
else
11-
KERNEL_VERSION_COMPLETE="$KERNEL_VERSION"-"$KERNEL_PATCH_VERSION".x86_64
12-
PACKAGES_URL=https://kojipkgs.fedoraproject.org/packages/kernel/
13-
PACKAGES_URL+="$KERNEL_VERSION"/"$KERNEL_PATCH_VERSION"/x86_64
5+
IFS=- read KERNEL_UPSTREAM_VERSION KERNEL_PATCH_VERSION <<< $KERNEL_VERSION
146

15-
for package in core modules modules-extra devel; do
16-
wget -nv "$PACKAGES_URL"/kernel-"$package"-"$KERNEL_VERSION_COMPLETE".rpm
17-
rpm2cpio kernel-"$package"-"$KERNEL_VERSION_COMPLETE".rpm | cpio -di
18-
done
19-
find lib -name "*.xz" -exec xz -d {} \;
7+
KERNEL_VERSION_COMPLETE="$KERNEL_UPSTREAM_VERSION"-"$KERNEL_PATCH_VERSION"."$KERNEL_ARCH"
8+
PACKAGES_URL=https://kojipkgs.fedoraproject.org/packages/kernel/
9+
PACKAGES_URL+="$KERNEL_UPSTREAM_VERSION"/"$KERNEL_PATCH_VERSION"/"$KERNEL_ARCH"
2010

21-
mv lib/modules/"$KERNEL_VERSION_COMPLETE" kernel
22-
mkdir -p kernel/arch/x86/boot
23-
cp kernel/vmlinuz kernel/arch/x86/boot/bzImage
24-
cp kernel/config kernel/.config
25-
rsync -a usr/src/kernels/"$KERNEL_VERSION_COMPLETE"/ kernel/
26-
fi
11+
for package in core modules modules-extra devel; do
12+
wget -nv "$PACKAGES_URL"/kernel-"$package"-"$KERNEL_VERSION_COMPLETE".rpm
13+
rpm2cpio kernel-"$package"-"$KERNEL_VERSION_COMPLETE".rpm | cpio -di
14+
done
15+
find lib -name "*.xz" -exec xz -d {} \;
16+
17+
KERNEL_ARCHDIR=x86
18+
[[ "$KERNEL_ARCH" == "aarch64" ]] && KERNEL_ARCHDIR=arm64
19+
[[ "$KERNEL_ARCH" == "ppc64le" ]] && KERNEL_ARCHDIR=ppc64le
20+
[[ "$KERNEL_ARCH" == "s390x" ]] && KERNEL_ARCHDIR=s390
21+
22+
mv lib/modules/"$KERNEL_VERSION_COMPLETE" kernel
23+
mkdir -p kernel/arch/$KERNEL_ARCHDIR/boot
24+
cp kernel/vmlinuz kernel/arch/$KERNEL_ARCHDIR/boot/bzImage
25+
cp kernel/config kernel/.config
26+
rsync -a usr/src/kernels/"$KERNEL_VERSION_COMPLETE"/ kernel/

.github/scripts/prepare_test_tools.sh

-13
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,3 @@ echo ::group::Install virtme
1717
git clone https://github.com/amluto/virtme
1818
sudo python3 -m pip install ./virtme
1919
echo ::endgroup::
20-
21-
22-
if [[ $KERNEL_VERSION == "LATEST" ]]; then
23-
echo ::group::Install pahole
24-
# In the repo there is only version 1.15 and we need newer.
25-
git clone https://git.kernel.org/pub/scm/devel/pahole/pahole.git
26-
mkdir pahole/build
27-
cd pahole/build
28-
cmake -D__LIB=lib ..
29-
sudo make install
30-
sudo ldconfig /usr/local/lib
31-
echo ::endgroup::
32-
fi

.github/scripts/run_tests_in_vm.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
touch TEST_OUTPUT
44
tail -f TEST_OUTPUT &
55

6-
sudo virtme-run --kdir kernel --script-exec .github/scripts/run_tests.sh --pwd --rw --mods=auto --qemu-opts -cpu qemu64 -machine accel=tcg -m 2G
6+
sudo virtme-run --arch $KERNEL_ARCH --kdir kernel --script-exec .github/scripts/run_tests.sh --pwd --rw --mods=auto --memory 2G
77

88
kill %1
99

10-
exit "$(cat TEST_RESULT)"
10+
exit "$(cat TEST_RESULT)"

.github/workflows/selftests.yml

+11-9
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,20 @@ jobs:
1111
runs-on: ubuntu-latest
1212
strategy:
1313
matrix:
14-
include:
15-
- KERNEL_VERSION: 5.16.8
16-
KERNEL_PATCH_VERSION: 200.fc35
17-
- KERNEL_VERSION: 5.11.0
18-
KERNEL_PATCH_VERSION: 156.fc34
19-
- KERNEL_VERSION: 5.6.19
20-
KERNEL_PATCH_VERSION: 300.fc32
14+
KERNEL_VERSION:
15+
- "5.16.8-200.fc35"
16+
- "5.11.0-156.fc34"
17+
- "5.6.19-300.fc32"
18+
KERNEL_ARCH:
19+
- aarch64
20+
- ppc64le
21+
- s390x
22+
- x86_64
2123
fail-fast: false
2224

2325
env:
2426
KERNEL_VERSION: ${{ matrix.KERNEL_VERSION }}
25-
KERNEL_PATCH_VERSION: ${{ matrix.KERNEL_PATCH_VERSION }}
27+
KERNEL_ARCH: ${{ matrix.KERNEL_ARCH }}
2628
CLANG: clang-10
2729
LLC: llc-10
2830

@@ -34,7 +36,7 @@ jobs:
3436
- name: Prepare packages
3537
run: |
3638
sudo apt-get update
37-
sudo apt-get install zstd binutils-dev elfutils libpcap-dev libelf-dev gcc-multilib pkg-config wireshark tshark bpfcc-tools python3 python3-pip python3-setuptools qemu-kvm rpm2cpio libdw-dev libdwarf-dev
39+
sudo apt-get install zstd binutils-dev elfutils libpcap-dev libelf-dev gcc-multilib pkg-config wireshark tshark bpfcc-tools python3 python3-pip python3-setuptools qemu-kvm rpm2cpio libdw-dev libdwarf-dev qemu-system-arm qemu-system-ppc qemu-system-s390x
3840
- name: Prepare Clang
3941
run: |
4042
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -

0 commit comments

Comments
 (0)