>From fe5ece9b74a34722d82fe2de2b92db7db36a4d40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A1draig=20Brady?= Date: Thu, 23 Sep 2021 16:19:35 +0100 Subject: [PATCH] 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. --- tests/cp/sparse-perf.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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. -- 2.26.2