summaryrefslogtreecommitdiff
path: root/tests/cp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/cp')
-rwxr-xr-xtests/cp/copy-FMR.sh (renamed from tests/cp/fiemap-FMR.sh)1
-rwxr-xr-xtests/cp/sparse-2.sh (renamed from tests/cp/fiemap-2.sh)9
-rwxr-xr-xtests/cp/sparse-extents-2.sh (renamed from tests/cp/sparse-fiemap.sh)12
-rwxr-xr-xtests/cp/sparse-extents.sh (renamed from tests/cp/fiemap-extents.sh)9
-rwxr-xr-xtests/cp/sparse-perf.sh (renamed from tests/cp/fiemap-perf.sh)20
5 files changed, 19 insertions, 32 deletions
diff --git a/tests/cp/fiemap-FMR.sh b/tests/cp/copy-FMR.sh
index 7bbb88a2c..1ecdbe44d 100755
--- a/tests/cp/fiemap-FMR.sh
+++ b/tests/cp/copy-FMR.sh
@@ -22,6 +22,7 @@ print_ver_ cp
require_valgrind_
require_perl_
+# Trigger FMR in fiemap logic from v8.11..v8.19
$PERL -e 'for (1..600) { sysseek (*STDOUT, 4096, 1)' \
-e '&& syswrite (*STDOUT, "a" x 1024) or die "$!"}' > j || fail=1
valgrind --quiet --error-exitcode=3 cp --reflink=never j j2 || fail=1
diff --git a/tests/cp/fiemap-2.sh b/tests/cp/sparse-2.sh
index e6b80ebd3..05aa7f980 100755
--- a/tests/cp/fiemap-2.sh
+++ b/tests/cp/sparse-2.sh
@@ -1,5 +1,5 @@
#!/bin/sh
-# Exercise a few more corners of the fiemap-copying code.
+# Exercise a few more corners of the copying code.
# Copyright (C) 2011-2021 Free Software Foundation, Inc.
@@ -19,10 +19,9 @@
. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
print_ver_ cp
-# Require a fiemap-enabled FS.
-touch fiemap_chk # check a file rather than current dir for best coverage
-fiemap_capable_ fiemap_chk \
- || skip_ "this file system lacks FIEMAP support"
+touch sparse_chk
+seek_data_capable_ sparse_chk \
+ || skip_ "this file system lacks SEEK_DATA support"
# Exercise the code that handles a file ending in a hole.
printf x > k || framework_failure_
diff --git a/tests/cp/sparse-fiemap.sh b/tests/cp/sparse-extents-2.sh
index c66e714fc..544b959ef 100755
--- a/tests/cp/sparse-fiemap.sh
+++ b/tests/cp/sparse-extents-2.sh
@@ -1,5 +1,5 @@
#!/bin/sh
-# Test cp --sparse=always through fiemap copy
+# Test cp --sparse=always through SEEK_DATA copy
# Copyright (C) 2010-2021 Free Software Foundation, Inc.
@@ -22,11 +22,11 @@ require_perl_
# The test was seen to fail on ext3 so exclude that type
# (or any file system where the type can't be determined)
-touch fiemap_chk
-if fiemap_capable_ fiemap_chk && ! df -t ext3 . >/dev/null; then
+touch sparse_chk
+if seek_data_capable_ sparse_chk && ! df -t ext3 . >/dev/null; then
: # Current partition has working extents. Good!
else
- skip_ "current file system has insufficient FIEMAP support"
+ skip_ "current file system has insufficient SEEK_DATA support"
# It's not; we need to create one, hence we need root access.
require_root_
@@ -50,8 +50,8 @@ else
fi
# =================================================
-# Ensure that we exercise the FIEMAP-copying code enough
-# to provoke at least two iterations of the do...while loop
+# The data below was set up to ensure that the original FIEMAP-copying code
+# was exercised enough to provoke at least two iterations of the do...while loop
# in which it calls ioctl (fd, FS_IOC_FIEMAP,...
# This also verifies that non-trivial extents are preserved.
diff --git a/tests/cp/fiemap-extents.sh b/tests/cp/sparse-extents.sh
index 23f5cd9a3..1e9156149 100755
--- a/tests/cp/fiemap-extents.sh
+++ b/tests/cp/sparse-extents.sh
@@ -21,10 +21,9 @@ print_ver_ cp
require_sparse_support_
-touch fiemap_chk || framework_failure_
-fiemap_capable_ fiemap_chk ||
- skip_ 'this file system lacks FIEMAP support'
-rm fiemap_chk
+touch sparse_chk || framework_failure_
+seek_data_capable_ sparse_chk ||
+ skip_ 'this file system lacks SEEK_DATA support'
fallocate --help >/dev/null || skip_ 'The fallocate utility is required'
touch falloc.test || framework_failure_
@@ -65,7 +64,7 @@ fi
# Ensure we handle extents beyond file size correctly.
# Note until we support fallocate, we will not maintain
# the file allocation. FIXME: amend this test if fallocate is supported.
-# Note currently this only uses fiemap logic when the allocation (-l)
+# Note currently this only uses SEEK_DATA logic when the allocation (-l)
# is smaller than the size, thus identifying the file as sparse.
# Note the '-l 1' case is an effective noop, and just checks
# a file with a trailing hole is copied correctly.
diff --git a/tests/cp/fiemap-perf.sh b/tests/cp/sparse-perf.sh
index de110914f..a71b854cf 100755
--- a/tests/cp/fiemap-perf.sh
+++ b/tests/cp/sparse-perf.sh
@@ -19,30 +19,18 @@
. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
print_ver_ cp
-# Require a fiemap-enabled FS.
-touch fiemap_chk
-fiemap_capable_ fiemap_chk ||
- skip_ "this file system lacks FIEMAP support"
-
-# Exclude ext[23] (or unknown fs types)
-# as the emulated extent scanning can be slow
-df -t ext2 -t ext3 . >/dev/null &&
- skip_ "ext[23] can have slow FIEMAP scanning"
+touch sparse_chk
+seek_data_capable_ sparse_chk ||
+ skip_ "this file system lacks SEEK_DATA support"
# Create a large-but-sparse file.
timeout 10 truncate -s1T f ||
skip_ "unable to create a 1 TiB sparse file"
-# Disable this test on old BTRFS (e.g. Fedora 14)
-# which reports (unwritten) extents for holes.
-filefrag f || skip_ "the 'filefrag' utility is missing"
-filefrag f | grep -F ': 0 extents found' > /dev/null ||
- skip_ 'this file system reports extents for holes'
-
# Nothing can read (much less write) that many bytes in so little time.
timeout 10 cp f f2 || fail=1
-# Ensure that the sparse file copied through fiemap has the same size
+# Ensure that the sparse file copied through SEEK_DATA has the same size
# in bytes as the original.
test "$(stat --printf %s f)" = "$(stat --printf %s f2)" || fail=1