]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
tests: avoid failure on older Centos 7
authorPádraig Brady <P@draigBrady.com>
Thu, 16 Apr 2026 17:35:26 +0000 (18:35 +0100)
committerPádraig Brady <P@draigBrady.com>
Thu, 16 Apr 2026 17:35:26 +0000 (18:35 +0100)
* tests/cp/sparse-perf.sh: Old Centos 7 can give EINVAL
from SEEK_DATA on sparse files being copied from /dev/shm.
Avoid this failure as it's not practical to fix.

tests/cp/sparse-perf.sh

index 2fa95deff1767b9ce7992b4f0340a28d1dd8929a..3908958e92fecfb0d4410c088f0e77f4b772a8ec 100755 (executable)
@@ -18,6 +18,7 @@
 
 . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
 print_ver_ cp
+getlimits_
 cleanup_() { rm -rf "$other_partition_tmpdir"; }
 . "$abs_srcdir/tests/other-fs-tmpdir"
 
@@ -30,7 +31,10 @@ truncate -s1M $other_partition_sparse || framework_failure_
 
 # cp should not disable anything by default, even for sparse files.  For e.g.
 # copy offload is an important performance improvement for sparse files on NFS.
-cp --debug $other_partition_sparse k2 >cp.out || fail=1
+cp --debug $other_partition_sparse k2 >cp.out 2>cp.err; ret=$?
+# Old Centos 7 or WSL 1 can give EINVAL erroneously
+grep -F "$EINVAL" cp.err && skip_ 'received EINVAL when copying sparse file'
+test "$ret" = 0 || { cat cp.err >&2; fail=1; }
 cmp $other_partition_sparse k2 || fail=1
 grep ': avoided' cp.out && { cat cp.out; fail=1; }