]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
tests: sparse-perf: avoid false failure
authorPádraig Brady <P@draigBrady.com>
Thu, 23 Sep 2021 15:19:35 +0000 (16:19 +0100)
committerPádraig Brady <P@draigBrady.com>
Fri, 24 Sep 2021 11:17:58 +0000 (12:17 +0100)
* 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.

tests/cp/sparse-perf.sh

index d134151190ef9400f22106e1a1ad7ef284f57e96..fafbf22753cd441448bd71aebc1f69401e7ba55f 100755 (executable)
@@ -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.