* tests/init.cfg (fiemap_capable_): New function.
* tests/cp/fiemap-perf: Use it.
* tests/cp/sparse-fiemap: Likewise.
* tests/cp/fiemap-2: Likewise.
print_ver_ cp
# Require a fiemap-enabled FS.
-df -T -t btrfs -t xfs -t ext4 -t ocfs2 . \
+fiemap_capable_ . \
|| skip_ "this file system lacks FIEMAP support"
# Exercise the code that handles a file ending in a hole.
print_ver_ cp
# Require a fiemap-enabled FS.
-df -T -t btrfs -t xfs -t ext4 -t ocfs2 . \
+fiemap_capable_ . \
|| skip_ "this file system lacks FIEMAP support"
# Create a large-but-sparse file.
. "${srcdir=.}/init.sh"; path_prepend_ ../src
print_ver_ cp
-if df -T -t btrfs -t xfs -t ext4 -t ocfs2 . ; then
+if fiemap_capable_ . ; then
: # Current dir is on a partition with working extents. Good!
else
# It's not; we need to create one, hence we need root access.
kill $pid
}
+# Return nonzero if the specified directory is on a file system
+# for which FIEMAP support exists.
+fiemap_capable_()
+{
+ df -T -t btrfs -t xfs -t ext4 -t ocfs2 "$@"
+}
+
# Does the current (working-dir) file system support sparse files?
require_sparse_support_()
{