sbin/bectl: Skip tests if sparse files are not supported

The tests create a 1GB test file and this causes the tests to fail in the
CheriBSD CI setup where we run tests with a tmpfs mount on /tmp. Tmpfs
does not support sparse files and it appears that tmpfs default to creating
a 1GB mount, so there is not enough space to run these tests.

Instead of checking for at least 1GB of free space, this commit skips the
tests on file systems that do not support sparse files.

Reviewed By:	kevans
Differential Revision: https://reviews.freebsd.org/D28463
This commit is contained in:
Alex Richardson 2021-02-03 09:31:32 +00:00
parent 8b820df156
commit d6f4e1a897

View File

@ -49,6 +49,13 @@ bectl_create_setup()
atf_check test -n "$zpool"
kldload -n -q zfs || atf_skip "ZFS module not loaded on the current system"
if ! getconf MIN_HOLE_SIZE "$(pwd)"; then
echo "getconf MIN_HOLE_SIZE $(pwd) failed; sparse files " \
"probably not supported by file system"
mount
atf_skip "Test's work directory does not support sparse files;" \
"try with a different TMPDIR?"
fi
atf_check mkdir -p ${mnt}
atf_check truncate -s 1G ${disk}
atf_check zpool create -R ${mnt} ${zpool} ${disk}