diff --git a/.github/workflows/deb-buildd.yml b/.github/workflows/deb-buildd.yml index 3961dc1b..0e5a5566 100644 --- a/.github/workflows/deb-buildd.yml +++ b/.github/workflows/deb-buildd.yml @@ -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 <> $GITHUB_ENV + if [ "${{ inputs.dist-name }}" = "debian" ]; + then tee -a ~/.sbuildrc > /dev/null < /dev/null < /dev/null < /dev/null < /dev/null <> $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 }}" diff --git a/.github/workflows/deb-orchestrator.yml b/.github/workflows/deb-orchestrator.yml index 37c70b22..1913355d 100644 --- a/.github/workflows/deb-orchestrator.yml +++ b/.github/workflows/deb-orchestrator.yml @@ -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 diff --git a/.github/workflows/deb-publish.yml b/.github/workflows/deb-publish.yml index 2c39c944..bd50abc5 100644 --- a/.github/workflows/deb-publish.yml +++ b/.github/workflows/deb-publish.yml @@ -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: diff --git a/.github/workflows/deb-src.yml b/.github/workflows/deb-src.yml index c6c83a90..e2b77b4a 100644 --- a/.github/workflows/deb-src.yml +++ b/.github/workflows/deb-src.yml @@ -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 diff --git a/debian/control b/debian/control index 6d20d297..54e1df5a 100644 --- a/debian/control +++ b/debian/control @@ -3,7 +3,6 @@ Maintainer: Roman Lebedev 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 diff --git a/debian/tests/control b/debian/tests/control new file mode 100644 index 00000000..409ce551 --- /dev/null +++ b/debian/tests/control @@ -0,0 +1,4 @@ +Tests: kernel-smoke-test +Architecture: amd64 arm64 +Restrictions: needs-root, allow-stderr, isolation-machine +Depends: bcachefs-kernel-dkms diff --git a/debian/tests/kernel-smoke-test b/debian/tests/kernel-smoke-test new file mode 100644 index 00000000..1abaec4f --- /dev/null +++ b/debian/tests/kernel-smoke-test @@ -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 diff --git a/debian/tests/kernel-smoke-test.00.single b/debian/tests/kernel-smoke-test.00.single new file mode 100644 index 00000000..2f961509 --- /dev/null +++ b/debian/tests/kernel-smoke-test.00.single @@ -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 diff --git a/debian/tests/kernel-smoke-test.01.single-mount b/debian/tests/kernel-smoke-test.01.single-mount new file mode 100644 index 00000000..5f78d42f --- /dev/null +++ b/debian/tests/kernel-smoke-test.01.single-mount @@ -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 diff --git a/debian/tests/kernel-smoke-test.02.single-populate b/debian/tests/kernel-smoke-test.02.single-populate new file mode 100644 index 00000000..644ca50e --- /dev/null +++ b/debian/tests/kernel-smoke-test.02.single-populate @@ -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 diff --git a/debian/tests/kernel-smoke-test.03.single-persists b/debian/tests/kernel-smoke-test.03.single-persists new file mode 100644 index 00000000..d9b3a0fc --- /dev/null +++ b/debian/tests/kernel-smoke-test.03.single-persists @@ -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