bcachefs-tools/debian/tests/kernel-smoke-test.02.single-populate
Roman Lebedev b6475f7ee9
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.
2025-09-24 22:54:26 +03:00

56 lines
1005 B
Bash

#!/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