Debian / PPA: add autopkgtests, run them for debian amd64 jobs

These tests require qemu, and it's somewhat tricky,
i haven't quite figured out the incantation
that works for Github's aarch64 workers.

I'm also unsure how to make them work for ubuntu builds.

Since debian stable's kernel is too old, as discussed,
i'm disabling PPA for it.
This commit is contained in:
Roman Lebedev 2025-09-24 16:25:01 +03:00
parent 72b40537af
commit b6475f7ee9
No known key found for this signature in database
GPG Key ID: 083C3EBB4A1689E0
11 changed files with 313 additions and 33 deletions

View File

@ -25,7 +25,7 @@ jobs:
runs-on: ${{ inputs.runs-on }}
container:
image: debian:unstable-slim
options: --cap-add=SYS_ADMIN --security-opt=apparmor:unconfined --tmpfs /tmp:exec --tmpfs /__w/${{ github.event.repository.name }}/${{ github.event.repository.name }}:exec
options: --privileged --cap-add=SYS_ADMIN --security-opt=apparmor:unconfined --tmpfs /tmp:exec --tmpfs /__w/${{ github.event.repository.name }}/${{ github.event.repository.name }}
env:
DEBFULLNAME: apt.bcachefs.org CI bot
DEBEMAIL: linux-bcachefs@vger.kernel.org
@ -71,17 +71,30 @@ jobs:
apt full-upgrade
apt install \
${{ inputs.dist-name }}-keyring \
autopkgtest \
curl \
devscripts \
dosfstools \
e2fsprogs \
fakemachine \
fdisk \
gpg \
iproute2 \
libarchive13 \
mmdebstrap \
mtools \
ovmf \
qemu-efi-aarch64 \
qemu-utils \
sbuild \
sudo \
systemd-boot-efi \
tar \
uidmap \
xz-utils \
zip
zerofree \
zip \
;
apt clean
USER=`whoami`
sudo usermod --add-subuids 100000-165535 --add-subgids 100000-165535 $USER
@ -122,6 +135,7 @@ jobs:
run: |
set -xe
BUILD_DIR="$GITHUB_WORKSPACE/deb-bin/${{ inputs.dist-version }}/${{ inputs.arch }}"
echo "BUILD_DIR=$(echo ${BUILD_DIR})" >> $GITHUB_ENV
mkdir -p "$BUILD_DIR"
tee -a ~/.sbuildrc > /dev/null <<EOT
\$verbose = 1;
@ -138,9 +152,22 @@ jobs:
EOT
if [ "${{ inputs.dist-name }}" = "debian" ];
then
MIRROR="http://deb.debian.org/debian"
elif [ "${{ inputs.dist-name }}" = "ubuntu" ] && [ "${{ inputs.arch }}" = "amd64" ];
then
MIRROR="http://archive.ubuntu.com/ubuntu"
elif [ "${{ inputs.dist-name }}" = "ubuntu" ] && [ "${{ inputs.arch }}" != "amd64" ];
then
MIRROR="http://ports.ubuntu.com/ubuntu-ports"
else
exit 1
fi
echo "MIRROR=$(echo ${MIRROR})" >> $GITHUB_ENV
if [ "${{ inputs.dist-name }}" = "debian" ];
then
tee -a ~/.sbuildrc > /dev/null <<EOT
push @{\$unshare_mmdebstrap_extra_args}, "*", [
'http://deb.debian.org/debian',
'$MIRROR',
'--keyring=/usr/share/keyrings/debian-keyring.gpg',
'--components=main'
];
@ -150,8 +177,8 @@ jobs:
then
tee -a ~/.sbuildrc > /dev/null <<EOT
\$extra_repositories = [
'deb http://deb.debian.org/debian ${{ inputs.dist-version }}-updates main',
'deb http://deb.debian.org/debian ${{ inputs.dist-version }}-backports main'
'deb $MIRROR ${{ inputs.dist-version }}-updates main',
'deb $MIRROR ${{ inputs.dist-version }}-backports main'
];
EOT
fi
@ -159,33 +186,14 @@ jobs:
then
tee -a ~/.sbuildrc > /dev/null <<EOT
push @{\$unshare_mmdebstrap_extra_args}, "*", [
'$MIRROR',
'--keyring=/usr/share/keyrings/ubuntu-archive-keyring.gpg',
'--components=main,universe'
];
EOT
fi
if [ "${{ inputs.dist-name }}" = "ubuntu" ] && [ "${{ inputs.arch }}" = "amd64" ];
then
tee -a ~/.sbuildrc > /dev/null <<EOT
push @{\$unshare_mmdebstrap_extra_args}, "*", [
'http://archive.ubuntu.com/ubuntu',
];
\$extra_repositories = [
'deb http://archive.ubuntu.com/ubuntu ${{ inputs.dist-version }}-updates main universe',
'deb http://archive.ubuntu.com/ubuntu ${{ inputs.dist-version }}-security main universe',
'deb http://archive.ubuntu.com/ubuntu ${{ inputs.dist-version }}-backports main universe',
];
EOT
elif [ "${{ inputs.dist-name }}" = "ubuntu" ] && [ "${{ inputs.arch }}" != "amd64" ];
then
tee -a ~/.sbuildrc > /dev/null <<EOT
push @{\$unshare_mmdebstrap_extra_args}, "*", [
'http://ports.ubuntu.com/ubuntu-ports',
];
\$extra_repositories = [
'deb http://ports.ubuntu.com/ubuntu-ports ${{ inputs.dist-version }}-updates main universe',
'deb http://ports.ubuntu.com/ubuntu-ports ${{ inputs.dist-version }}-security main universe',
'deb http://ports.ubuntu.com/ubuntu-ports ${{ inputs.dist-version }}-backports main universe',
'deb $MIRROR ${{ inputs.dist-version }}-updates main universe',
'deb $MIRROR ${{ inputs.dist-version }}-security main universe',
'deb $MIRROR ${{ inputs.dist-version }}-backports main universe',
];
EOT
fi
@ -268,3 +276,18 @@ jobs:
with:
subject-name: artifact-bin-${{ inputs.dist-version }}-${{ inputs.arch }}.tar.zip
subject-digest: sha256:${{ steps.deb-bin-upload.outputs.artifact-digest }}
- name: Build Qemu image for autopkgtest
timeout-minutes: 2
id: qemu-image
if: inputs.dist-name == 'debian' && inputs.arch == 'amd64'
run: |
set -xe
IMAGE="/tmp/autopkgtest-qemu-image.qcow2"
echo "IMAGE=$(echo ${IMAGE})" >> $GITHUB_ENV
mmdebstrap-autopkgtest-build-qemu --boot=efi --mirror "${{ env.MIRROR }}" "${{ inputs.dist-version }}" "$IMAGE"
- name: Run autopkgtest
timeout-minutes: 60
if: steps.qemu-image.conclusion != 'skipped'
run: |
set -xe
autopkgtest --no-built-binaries --apt-upgrade "$GITHUB_WORKSPACE/deb-src"/*.dsc "${{ env.BUILD_DIR }}"/*.changes -- autopkgtest-virt-qemu --boot=efi "${{ env.IMAGE }}"

View File

@ -43,7 +43,6 @@ jobs:
dist:
- { name: debian, version: unstable }
- { name: debian, version: forky } # Debian 14
- { name: debian, version: trixie } # Debian 13
- { name: ubuntu, version: questing } # Ubuntu 25.10 (Questing Quokka) Beta
- { name: ubuntu, version: plucky } # Ubuntu 25.04 (Plucky Puffin)
uses: ./.github/workflows/deb-buildd.yml

View File

@ -18,7 +18,7 @@ jobs:
runs-on: ubuntu-latest
container:
image: debian:unstable-slim
options: --cap-add=SYS_ADMIN --security-opt=apparmor:unconfined --device /dev/fuse --tmpfs /tmp:exec --tmpfs /__w/${{ github.event.repository.name }}/${{ github.event.repository.name }}:exec
options: --cap-add=SYS_ADMIN --security-opt=apparmor:unconfined --device /dev/fuse --tmpfs /tmp --tmpfs /__w/${{ github.event.repository.name }}/${{ github.event.repository.name }}
env:
SUITE: ${{ (github.event_name == 'push' && github.ref_type == 'tag') && 'release' || 'snapshot' }}
steps:

View File

@ -22,7 +22,7 @@ jobs:
runs-on: ${{ inputs.runs-on }}
container:
image: debian:unstable-slim
options: --cap-add=SYS_ADMIN --security-opt=apparmor:unconfined --tmpfs /tmp:exec --tmpfs /__w/${{ github.event.repository.name }}/${{ github.event.repository.name }}:exec
options: --cap-add=SYS_ADMIN --security-opt=apparmor:unconfined --tmpfs /tmp:exec --tmpfs /__w/${{ github.event.repository.name }}/${{ github.event.repository.name }}
env:
RUST_VERSION: 1.89.0
DEBFULLNAME: apt.bcachefs.org CI bot

7
debian/control vendored
View File

@ -3,7 +3,6 @@ Maintainer: Roman Lebedev <lebedev.ri@gmail.com>
Section: utils
Priority: optional
Standards-Version: 4.7.0
Rules-Requires-Root: no
Build-Depends: debhelper-compat (= 13),
cargo,
dh-dkms,
@ -19,6 +18,7 @@ Build-Depends: debhelper-compat (= 13),
libudev-dev,
liburcu-dev (>= 0.15),
libzstd-dev,
linux-libc-dev (>= 6.12),
pkgconf,
python3-docutils,
python3:native,
@ -29,6 +29,8 @@ Build-Depends: debhelper-compat (= 13),
Homepage: https://bcachefs.org/
Vcs-Git: git://evilpiepirate.org/bcachefs-tools.git
Vcs-Browser: https://evilpiepirate.org/git/bcachefs-tools.git
Rules-Requires-Root: no
Testsuite: autopkgtest-pkg-dkms
Package: bcachefs-tools
Architecture: linux-any
@ -50,7 +52,8 @@ Architecture: linux-any
Section: kernel
Depends: ${misc:Depends},
initramfs-tools | linux-initramfs-tool,
linux-headers-generic
linux-headers-amd64 (>= 6.16) [amd64] | linux-headers-cloud-amd64 (>= 6.16) [amd64] | linux-headers-rt-amd64 (>= 6.16) [amd64] |
linux-headers-arm64 (>= 6.16) [arm64] | linux-headers-cloud-arm64 (>= 6.16) [arm64] | linux-headers-rt-arm64 (>= 6.16) [arm64],
Pre-Depends: bcachefs-tools (= ${binary:Version}),
Provides: bcachefs-kernel
Description: bcachefs kernel module DKMS source

4
debian/tests/control vendored Normal file
View File

@ -0,0 +1,4 @@
Tests: kernel-smoke-test
Architecture: amd64 arm64
Restrictions: needs-root, allow-stderr, isolation-machine
Depends: bcachefs-kernel-dkms

53
debian/tests/kernel-smoke-test vendored Normal file
View File

@ -0,0 +1,53 @@
#!/bin/sh
set +e
set -x
# Drop dangling symlink that hinders testing
rm -f ./bcachefs || /bin/true
echo "Ensuring that the bcachefs module isn't already loaded"
/sbin/lsmod | grep -q "^bcachefs"
if [ $? -eq 0 ]; then
echo "Error: bcachefs module is already loaded."
exit 1
fi
echo "Loading the bcachefs module"
/sbin/modprobe bcachefs
if [ $? -ne 0 ]; then
echo "Error: failed to load bcachefs module."
exit 1
fi
FAILED_TESTS=0
for t in ./debian/tests/$(basename "$0").*
do
echo "Performing test $t"
echo "$t" | grep -q ".disabled$"
if [ $? -eq 0 ]; then
echo "Skipping disabled test $t"
continue
fi
TMPDIR="$(mktemp -d)"
if [ $? -ne 0 ]; then
echo "FATAL: failed create temporary directory for a test"
exit 1
fi
TMPDIR="$TMPDIR" /bin/sh $t
if [ $? -ne 0 ]; then
echo "Warning: test $t has FAILED!"
FAILED_TESTS=1
else
echo "Test $t: success."
fi
rm -rf "$TMPDIR"
if [ $? -ne 0 ]; then
echo "FATAL: failed to remove test's temporary directory"
exit 1
fi
done
exit $FAILED_TESTS

View File

@ -0,0 +1,26 @@
#!/bin/sh
set +e
set -x
echo "kernel smoke test, create/mount/umount bcachefs filesystem"
STORAGE_SIZE_MB=128
STORAGE="$(mktemp)"
dd if=/dev/zero of="$STORAGE" bs=1M count=$STORAGE_SIZE_MB > /dev/null 2>&1
LODEVICE="$(losetup --find --show $STORAGE)"
cleanup() {
losetup -d "$LODEVICE"
}
trap cleanup EXIT
bcachefs format "$LODEVICE"
ret=$?
if [ $ret -ne 0 ]; then
echo "FAILED: bcachefs format failed, exit code=$ret"
exit 1
fi
echo "PASSED"
exit 0

View File

@ -0,0 +1,41 @@
#!/bin/sh
set +e
set -x
echo "kernel smoke test, create/mount/umount bcachefs filesystem"
STORAGE_SIZE_MB=128
STORAGE="$(mktemp)"
dd if=/dev/zero of="$STORAGE" bs=1M count=$STORAGE_SIZE_MB > /dev/null 2>&1
LODEVICE="$(losetup --find --show $STORAGE)"
cleanup() {
losetup -d "$LODEVICE"
}
trap cleanup EXIT
bcachefs format "$LODEVICE"
ret=$?
if [ $ret -ne 0 ]; then
echo "FAILED: bcachefs format failed, exit code=$ret"
exit 1
fi
MOUNTPOINT="$(mktemp -d)"
mount -t bcachefs "$LODEVICE" "$MOUNTPOINT"
ret=$?
if [ $ret -ne 0 ]; then
echo "FAILED: bcachefs mount failed, exit code=$ret"
exit 1
fi
umount "$MOUNTPOINT"
ret=$?
if [ $ret -ne 0 ]; then
echo "FAILED: bcachefs umount failed, exit code=$ret"
exit 1
fi
echo "PASSED"
exit 0

View File

@ -0,0 +1,55 @@
#!/bin/sh
set +e
set -x
echo "kernel smoke test, create/mount/umount bcachefs filesystem"
STORAGE_SIZE_MB=512
STORAGE="$(mktemp)"
dd if=/dev/zero of="$STORAGE" bs=1M count=$STORAGE_SIZE_MB > /dev/null 2>&1
LODEVICE="$(losetup --find --show $STORAGE)"
cleanup() {
losetup -d "$LODEVICE"
}
trap cleanup EXIT
bcachefs format "$LODEVICE"
ret=$?
if [ $ret -ne 0 ]; then
echo "FAILED: bcachefs format failed, exit code=$ret"
exit 1
fi
MOUNTPOINT="$(mktemp -d)"
mount -t bcachefs "$LODEVICE" "$MOUNTPOINT"
ret=$?
if [ $ret -ne 0 ]; then
echo "FAILED: bcachefs mount failed, exit code=$ret"
exit 1
fi
cp -r . "$MOUNTPOINT/files"
ret=$?
if [ $ret -ne 0 ]; then
echo "FAILED: failed to copy data to mounted filesystem"
exit 1
fi
diff -rq . "$MOUNTPOINT/files"
ret=$?
if [ $ret -ne 0 ]; then
echo "FAILED: filesystem content differs from original"
exit 1
fi
umount "$MOUNTPOINT"
ret=$?
if [ $ret -ne 0 ]; then
echo "FAILED: bcachefs umount failed, exit code=$ret"
exit 1
fi
echo "PASSED"
exit 0

View File

@ -0,0 +1,76 @@
#!/bin/sh
set +e
set -x
echo "kernel smoke test, create/mount/umount bcachefs filesystem"
STORAGE_SIZE_MB=512
STORAGE="$(mktemp)"
dd if=/dev/zero of="$STORAGE" bs=1M count=$STORAGE_SIZE_MB > /dev/null 2>&1
LODEVICE="$(losetup --find --show $STORAGE)"
cleanup() {
losetup -d "$LODEVICE"
}
trap cleanup EXIT
bcachefs format "$LODEVICE"
ret=$?
if [ $ret -ne 0 ]; then
echo "FAILED: bcachefs format failed, exit code=$ret"
exit 1
fi
MOUNTPOINT="$(mktemp -d)"
mount -t bcachefs "$LODEVICE" "$MOUNTPOINT"
ret=$?
if [ $ret -ne 0 ]; then
echo "FAILED: bcachefs mount failed, exit code=$ret"
exit 1
fi
cp -r . "$MOUNTPOINT/files"
ret=$?
if [ $ret -ne 0 ]; then
echo "FAILED: failed to copy data to mounted filesystem"
exit 1
fi
diff -rq . "$MOUNTPOINT/files"
ret=$?
if [ $ret -ne 0 ]; then
echo "FAILED: filesystem content differs from original"
exit 1
fi
umount "$MOUNTPOINT"
ret=$?
if [ $ret -ne 0 ]; then
echo "FAILED: bcachefs umount failed, exit code=$ret"
exit 1
fi
mount -t bcachefs "$LODEVICE" "$MOUNTPOINT"
ret=$?
if [ $ret -ne 0 ]; then
echo "FAILED: bcachefs mount failed, exit code=$ret"
exit 1
fi
diff -rq . "$MOUNTPOINT/files"
ret=$?
if [ $ret -ne 0 ]; then
echo "FAILED: filesystem content differs from original after remounting"
exit 1
fi
umount "$MOUNTPOINT"
ret=$?
if [ $ret -ne 0 ]; then
echo "FAILED: bcachefs umount failed, exit code=$ret"
exit 1
fi
echo "PASSED"
exit 0