summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2021-09-23 16:19:35 +0100
committerPádraig Brady <P@draigBrady.com>2021-09-24 12:17:58 +0100
commitbfedefd872e6d2b0ce5c451e9d40048f09c3f692 (patch)
treec85f94678eadefd0d4affe94480c3d1ad6d30d30
parent56bff500c5e48ab9c6fc62b9d457b1f283288417 (diff)
downloadcoreutils-bfedefd872e6d2b0ce5c451e9d40048f09c3f692.tar.gz
tests: sparse-perf: avoid false failure
* tests/cp/sparse-perf.sh: Avoid the case where we saw SEEK_DATA take 35s to return a result against a 1TB sparse file. This happened on a FreeBSD 9.1 VM at least. Reported by Nelson H. F. Beebe.
-rwxr-xr-xtests/cp/sparse-perf.sh11
1 files changed, 10 insertions, 1 deletions
diff --git a/tests/cp/sparse-perf.sh b/tests/cp/sparse-perf.sh
index d13415119..fafbf2275 100755
--- a/tests/cp/sparse-perf.sh
+++ b/tests/cp/sparse-perf.sh
@@ -28,7 +28,16 @@ timeout 10 truncate -s1T f ||
skip_ "unable to create a 1 TiB sparse file"
# Nothing can read (much less write) that many bytes in so little time.
-timeout 10 cp --reflink=never f f2 || fail=1
+timeout 10 cp --reflink=never f f2
+ret=$?
+if test $ret -eq 124; then # timeout
+ # Only fail if we allocated more data
+ # as we've seen SEEK_DATA taking 35s on some freebsd VMs
+ test $(stat -c%b f2) -gt $(stat -c%b f) && fail=1 ||
+ skip_ "SEEK_DATA timed out"
+elif test $ret -ne 0; then
+ fail=1
+fi
# Ensure that the sparse file copied through SEEK_DATA has the same size
# in bytes as the original.