mirror of
git://git.sv.gnu.org/coreutils.git
synced 2026-04-20 18:56:39 +02:00
tests: determine if SEEK_HOLE is enabled
Upcomming gnulib changes may disable SEEK_HOLE even if the system supports it, so dynamically check if we've SEEK_HOLE enabled. * init.cfg (seek_data_capable_): SEEK_DATA may be disabled in the build if the system support is deemed insufficient, so also use `cp --debug` to determine if it's enabled. * tests/cp/sparse-2.sh: Adjust to a more general diagnostic. * tests/cp/sparse-extents-2.sh: Likewise. * tests/cp/sparse-extents.sh: Likewise. * tests/cp/sparse-perf.sh: Likewise.
This commit is contained in:
12
init.cfg
12
init.cfg
@@ -546,6 +546,18 @@ require_kill_group_()
|
||||
# which SEEK_DATA support exists.
|
||||
seek_data_capable_()
|
||||
{
|
||||
# Check that SEEK_HOLE support is enabled
|
||||
# Note APFS was seen to not create sparse files < 16MiB
|
||||
if ! truncate -s16M file.sparse_; then
|
||||
warn_ "can't create a sparse file: assuming not SEEK_DATA capable"
|
||||
return 1
|
||||
fi
|
||||
if ! cp --debug --reflink=never file.sparse_ file.sparse_.cp \
|
||||
| grep SEEK_HOLE; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Check that SEEK_HOLE is supported on the passed file
|
||||
{ python3 < /dev/null && PYTHON_=python3; } ||
|
||||
{ python < /dev/null && PYTHON_=python; }
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ print_ver_ cp stat dd
|
||||
|
||||
touch sparse_chk
|
||||
seek_data_capable_ sparse_chk \
|
||||
|| skip_ "this file system lacks SEEK_DATA support"
|
||||
|| skip_ "insufficient SEEK_DATA support"
|
||||
|
||||
# Exercise the code that handles a file ending in a hole.
|
||||
printf x > k || framework_failure_
|
||||
|
||||
@@ -26,7 +26,7 @@ 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 SEEK_DATA support"
|
||||
skip_ "insufficient SEEK_DATA support"
|
||||
|
||||
# It's not; we need to create one, hence we need root access.
|
||||
require_root_
|
||||
|
||||
@@ -23,7 +23,7 @@ require_sparse_support_
|
||||
|
||||
touch sparse_chk || framework_failure_
|
||||
seek_data_capable_ sparse_chk ||
|
||||
skip_ 'this file system lacks SEEK_DATA support'
|
||||
skip_ 'insufficient SEEK_DATA support'
|
||||
|
||||
fallocate --help >/dev/null || skip_ 'The fallocate utility is required'
|
||||
touch falloc.test || framework_failure_
|
||||
|
||||
@@ -28,7 +28,7 @@ timeout 10 truncate -s1T f ||
|
||||
# between the creation of the file and the use of SEEK_DATA,
|
||||
# for it to determine it's an empty file (return ENXIO).
|
||||
seek_data_capable_ f ||
|
||||
skip_ "this file system lacks appropriate SEEK_DATA support"
|
||||
skip_ "insufficient SEEK_DATA support"
|
||||
|
||||
# Nothing can read that many bytes in so little time.
|
||||
timeout 10 cp --reflink=never f f2 || fail=1
|
||||
|
||||
Reference in New Issue
Block a user