CI: Boot test using Ubuntu mainline kernel build

Ubuntu have daily builds of mainline kernels at
  https://wiki.ubuntu.com/Kernel/MainlineBuilds
They are built on groovy.

Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
This commit is contained in:
Vitaly Chikunov 2021-04-05 01:47:32 +03:00 committed by Solar Designer
parent 55d538dd15
commit ed37ed3f3f
8 changed files with 132 additions and 12 deletions

9
.github/workflows/dpkg-i.sh vendored Executable file
View File

@ -0,0 +1,9 @@
#!/bin/bash -eux
# Non-default mkosi.prepare script (--prepare-script=) to install
# mainline kernel debs.
# (It does have network and can run additional installs if needed.)
banner "dpkg -i" >&2
cd /root/src
ls -l linux-*.deb
dpkg -i linux-*.deb

View File

@ -23,15 +23,15 @@ jobs:
echo /usr/local/bin >> $GITHUB_PATH
- name: Create bootable image using mkosi
run: sudo mkosi -r ${{ matrix.release }}
run: sudo mkosi -r ${{ matrix.release }} --cache=mkosi.cache
- name: Boot image using on qemu
- name: Boot image on qemu
run: |
sudo expect <<- EOF | tr -d '\r' | tee boot.log
proc abort {} { send_error "ABORT"; exit 1 }
spawn mkosi qemu
expect "Booting" { send "\r" }
set timeout 120
set timeout 300
expect "login: " {} default abort
set timeout 60
expect "# " { send "systemctl poweroff\r" } default abort
@ -40,8 +40,14 @@ jobs:
shell: bash -eo pipefail {0}
- name: Check boot.log for 'LKRG initialized successfully'
run: grep 'LKRG initialized successfully' boot.log
run: |
grep 'Linux version' boot.log
grep 'LKRG initialized successfully' boot.log
- name: Check that boot.log does not contain problems
run: egrep 'Panic|BUG:|WARNING:|Oops|Call Trace' boot.log && false || true
- name: Check that boot.log contains shutdown sequence
run: |
grep 'Reached target.*Power-Off' boot.log
grep 'reboot: Power down' boot.log
# vim: sw=4

53
.github/workflows/mkosi-mainline.yml vendored Normal file
View File

@ -0,0 +1,53 @@
name: mkosi boot (mainline)
on:
push:
pull_request:
schedule:
- cron: '0 10 * * *'
jobs:
mkosi-mainline:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- run: sudo apt-get update
- run: sudo apt-get install -y debootstrap qemu-system-x86 systemd-container expect sysvbanner
- name: Install mkosi from git
# Native focal package seems to be too old (v5) and not even
# able to build images properly.
run: |
sudo python3 -m pip install git+https://github.com/systemd/mkosi.git
echo /usr/local/bin >> $GITHUB_PATH
- name: Create bootable image using mkosi
run: |
.github/workflows/ubuntu-kernel-daily.sh
sudo mkosi -r groovy -p '!linux-virtual' --cache=mkosi.cache --prepare-script=.github/workflows/dpkg-i.sh
- name: Boot image on qemu
run: |
sudo expect <<- EOF | tr -d '\r' | tee boot.log
proc abort {} { send_error "ABORT"; exit 1 }
spawn mkosi qemu
expect "Booting" { send "\r" }
set timeout 300
expect "login: " {} default abort
set timeout 60
expect "# " { send "systemctl poweroff\r" } default abort
expect timeout abort eof { exit 0 }
EOF
shell: bash -eo pipefail {0}
- name: Check boot.log for 'LKRG initialized successfully'
run: |
grep 'Linux version' boot.log
grep 'LKRG initialized successfully' boot.log
- name: Check that boot.log does not contain problems
run: "! egrep 'Panic|BUG:|WARNING:|Oops|Call Trace' boot.log"
- name: Check that boot.log contains shutdown sequence
run: |
grep 'Reached target.*Power-Off' boot.log
grep 'reboot: Power down' boot.log
# vim: sw=4

44
.github/workflows/ubuntu-kernel-daily.sh vendored Executable file
View File

@ -0,0 +1,44 @@
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0-only
#
# Download daily Ubuntu mainline kernel from
# https://wiki.ubuntu.com/Kernel/MainlineBuilds
#
# Copyright (c) 2021 Vitaly Chikunov <vt@altlinux.org>.
#
baseurl="https://kernel.ubuntu.com/~kernel-ppa"
for listurl in \
"$baseurl/mainline/daily/" \
"$baseurl/mainline/"
do
echo >&2 "List $listurl"
curl -s "$listurl" \
| grep -Eio 'href="[^"]+"' \
| grep -Eo '"[^"]+"' \
| grep -Po '[v2][rc\.\d-]+' \
| sort -Vr \
| while read subdir; do
url="$listurl$subdir/amd64/"
echo >&2 "Trying $url"
if page=$(curl -s --fail "$url"); then
banner $subdir >&2
# Show Ubuntu commit and build status.
curl --fail "$url/aggregate.yaml" || curl "$url/summary.yaml"
echo "$page" \
| grep -Eio 'href="[^"]+"' \
| grep -o "linux.*deb" \
| grep -v "lowlatency" \
| while read deb; do
if [ ! -e "$deb" ]; then
echo >&2 "Download $url$deb"
curl -O "$url$deb"
fi
done
# Signal success to upper shell.
exit 22
fi
done
# Exit if subshell succeeded.
[ $? -eq 22 ] && exit
done

1
.gitignore vendored
View File

@ -20,5 +20,6 @@ GRTAGS
GTAGS
# mkosi
.mkosi-*
mkosi.cache
image.raw*

View File

@ -1,10 +1,10 @@
#!/bin/bash -eu
#!/bin/bash -eux
# mkosi.build - Compile and install module into DESTDIR.
KERNELRELEASE=$(ls -d /lib/modules/*)
KERNELRELEASE=$(ls -d /lib/modules/* | sort -V | tail -1)
KERNELRELEASE=${KERNELRELEASE##/lib/modules/}
export KERNELRELEASE
banner build
set -x
banner build $KERNELRELEASE >&2
make -j$(nproc)
install -Dpm 644 p_lkrg.ko $DESTDIR/lib/modules/$KERNELRELEASE/extra/p_lkrg.ko

View File

@ -1,9 +1,11 @@
# mkosi.default - Another way to run a test system with LKRG module.
[Distribution]
Distribution=ubuntu
# Linux version per release:
# focal - v5.4
# groovy - v5.8
Release=focal
Release=groovy
[Output]
Bootable=yes
@ -15,16 +17,19 @@ WithUnifiedKernelImages=no
BootProtocols=bios
[Partitions]
RootSize=2G
# 2G was not enough for build with mainline kernels installs.
RootSize=3G
[Packages]
BuildPackages=
diffutils
gcc
make
linux-base
linux-virtual
Packages=
sysvbanner
kmod
[Host]
QemuHeadless=yes

View File

@ -1,12 +1,14 @@
#!/bin/bash -exu
# mkosi.postinst - Install compiled module into initramfs and fix grub.
KERNELRELEASE=$(ls -d /lib/modules/*)
# Use kernel with highest version.
KERNELRELEASE=$(ls -d /lib/modules/* | sort -V | tail -1)
KERNELRELEASE=${KERNELRELEASE##/lib/modules/}
# mkosi phase 2
#(We only support bios i.e. grub boot here).
if test -x /usr/bin/dracut; then
banner postinst
banner postinst >&2
# Register our module in kmod database.
depmod -a $KERNELRELEASE
# Install module into (and force load early in) initrd.