Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test btrfs in CI #1485

Merged
merged 1 commit into from
Jan 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 9 additions & 0 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ fedora_testing_task: &fedora_testing
TEST_DRIVER: "fuse-overlay"
- env:
TEST_DRIVER: "fuse-overlay-whiteout"
- env:
TEST_DRIVER: "btrfs"

# Separate scripts for separate outputs, makes debugging easier.
setup_script: '${CIRRUS_WORKING_DIR}/${SCRIPT_BASE}/setup.sh |& ${_TIMESTAMP}'
Expand All @@ -90,6 +92,7 @@ fedora_testing_task: &fedora_testing
journal_log_script: '${_JOURNALCMD} || true'


# aufs was dropped between 20.04 and 22.04, can't test it
ubuntu_testing_task: &ubuntu_testing
<<: *fedora_testing
alias: ubuntu_testing
Expand All @@ -102,6 +105,12 @@ ubuntu_testing_task: &ubuntu_testing
TEST_DRIVER: "vfs"
- env:
TEST_DRIVER: "overlay"
- env:
TEST_DRIVER: "fuse-overlay"
- env:
TEST_DRIVER: "fuse-overlay-whiteout"
- env:
TEST_DRIVER: "btrfs"


lint_task:
Expand Down
23 changes: 23 additions & 0 deletions contrib/cirrus/build_and_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,29 @@ case $TEST_DRIVER in
aufs)
showrun make STORAGE_DRIVER=aufs local-test-integration local-test-unit
;;
btrfs)
# Fedora: install btrfs-progs, btrfs-progs-devel
# Ubuntu: install btrfs-progs, libbtrfs-dev
if [[ "$(./hack/btrfs_tag.sh)" =~ exclude_graphdriver_btrfs ]]; then
die "Built without btrfs, so we can't test it"
fi
if ! check_filesystem_supported $TEST_DRIVER ; then
die "This CI VM does not support $TEST_DRIVER in its kernel"
fi
if test -z "$(which mkfs.btrfs 2> /dev/null)" ; then
die "This CI VM does not have mkfs.btrfs installed"
fi
tmpdir=$(mktemp -d)
if [ -z "$tmpdir" ]; then
die "Error creating temporary directory"
fi
trap "umount -l $tmpdir; rm -f $GOSRC/$TEST_DRIVER.img" EXIT
truncate -s 0 $GOSRC/$TEST_DRIVER.img
fallocate -l 1G $GOSRC/$TEST_DRIVER.img
mkfs.btrfs $GOSRC/$TEST_DRIVER.img
mount -o loop $GOSRC/$TEST_DRIVER.img $tmpdir
TMPDIR="$tmpdir" showrun make STORAGE_DRIVER=$TEST_DRIVER local-test-integration local-test-unit
;;
*)
die "Unknown/Unsupported \$TEST_DRIVER=$TEST_DRIVER (see .cirrus.yml and $(basename $0))"
;;
Expand Down
11 changes: 11 additions & 0 deletions contrib/cirrus/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -115,3 +115,14 @@ install_bats_from_git(){
mkdir -p ~/.parallel
touch ~/.parallel/will-cite
}

check_filesystem_supported(){
if ! grep -q " $1\$" /proc/filesystems ; then
modprobe $1 > /dev/null 2> /dev/null || :en
if ! grep -q " $1\$" /proc/filesystems ; then
echo "This CI VM does not support $TEST_DRIVER in its kernel"
false
fi
fi
true
}