]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
tests: avoid false failure in preserve-slink-time.sh on GPFS
authorPádraig Brady <P@draigBrady.com>
Tue, 19 Jan 2016 15:51:00 +0000 (15:51 +0000)
committerPádraig Brady <P@draigBrady.com>
Tue, 19 Jan 2016 16:09:09 +0000 (16:09 +0000)
* tests/cp/preserve-slink-time.sh: Add a delay between the
ln and the cp so that there is enough difference between
the timestamps so GPFS won't discard the update.
Reported by Assaf Gordon.

tests/cp/preserve-slink-time.sh

index 6c1835c3867e84536b94e6bb045bd0261b175900..3054d7913489500a950ce01a0bca93517f99e74e 100755 (executable)
@@ -31,11 +31,21 @@ case $(stat --format=%y dangle) in
   ??:??:??.000000000) sleep 2;;
 esac
 
-# Can't use --format=%x, as lstat() modifies atime on some platforms.
-cp -Pp dangle d2 || framework_failure_
-stat --format=%y dangle > t1 || framework_failure_
-stat --format=%y d2 > t2 || framework_failure_
-
-compare t1 t2 || fail=1
+copy_timestamp_() {
+  sleep $1
+  rm -f d2
+  cp -Pp dangle d2 || framework_failure_
+  # Can't use --format=%x, as lstat() modifies atime on some platforms.
+  stat --format=%y dangle > t1 || framework_failure_
+  stat --format=%y d2 > t2 || framework_failure_
+  compare t1 t2
+}
+
+# We retry with a delay at least 1.5s because on GPFS
+# it was seen that the timestamp wasn't updated unless there
+# was sufficient delay between the ln and cp.
+# I.e., if there wasn't sufficient difference in
+# the timestamp being updated, the update was discarded.
+retry_delay_ copy_timestamp_ .1 4 || fail=1
 
 Exit $fail