Skip to content

Commit

Permalink
Merge pull request #1485 from nalind/test-btrfs
Browse files Browse the repository at this point in the history
Test btrfs in CI
  • Loading branch information
rhatdan committed Jan 27, 2023
2 parents f793bae + 137b452 commit b2615c3
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 0 deletions.
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
}

0 comments on commit b2615c3

Please sign in to comment.