]> Savannah Git Hosting - gnulib.git/commitdiff
utimens, utimensat, fdutimensat: Avoid test failures on AIX 7.2.
authorBruno Haible <bruno@clisp.org>
Wed, 6 Jan 2021 05:16:22 +0000 (06:16 +0100)
committerBruno Haible <bruno@clisp.org>
Wed, 6 Jan 2021 05:16:22 +0000 (06:16 +0100)
* lib/utimecmp.c (utimecmpat): On AIX, declare equality when the two
times differ by less than 0.01 seconds.
* tests/test-futimens.h (test_futimens): Pass UTIMECMP_TRUNCATE_SOURCE
flag.

ChangeLog
lib/utimecmp.c
tests/test-futimens.h

index b97481065091401e95ca0e5b4633dc3b16a851c6..61d4e7aaef609d620d1b6c946d4bc66ed6bf8dd8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2021-01-05  Bruno Haible  <bruno@clisp.org>
+
+       utimens, utimensat, fdutimensat: Avoid test failures on AIX 7.2.
+       * lib/utimecmp.c (utimecmpat): On AIX, declare equality when the two
+       times differ by less than 0.01 seconds.
+       * tests/test-futimens.h (test_futimens): Pass UTIMECMP_TRUNCATE_SOURCE
+       flag.
+
 2021-01-05  Bruno Haible  <bruno@clisp.org>
 
        utimensat: Work around trailing slash bug in utimensat() on AIX 7.2.
index 7f73925ae94316fcc4cdb6552b5f4143baed0c3a..781a0d28923530e041a21795589a26a53b33854a 100644 (file)
@@ -157,6 +157,17 @@ utimecmpat (int dfd, char const *dst_name,
 
   if (options & UTIMECMP_TRUNCATE_SOURCE)
     {
+#if defined _AIX
+      /* On AIX 7.2, on a jfs2 file system, the times may differ by up to
+         0.01 seconds in either direction.  But it does not seem to come
+         from clock ticks of 0.01 seconds each.  */
+      long long difference =
+        ((long long) dst_s - (long long) src_s) * BILLION
+        + ((long long) dst_ns - (long long) src_ns);
+      if (difference < 10000000 && difference > -10000000)
+        return 0;
+#endif
+
       /* Look up the timestamp resolution for the destination device.  */
 
       /* Hash table for caching information learned about devices.  */
index 31ff900f3d136a2c49a8d305dd07a0bda2525006..53eeb5c042cf2c409aa1d20a9551e2251b40be39 100644 (file)
@@ -154,7 +154,7 @@ test_futimens (int (*func) (int, struct timespec const *),
     ASSERT (st3.st_atime == Y2K);
     ASSERT (0 <= get_stat_atime_ns (&st3));
     ASSERT (get_stat_atime_ns (&st3) <= BILLION / 2);
-    ASSERT (utimecmp (BASE "file", &st1, &st3, 0) <= 0);
+    ASSERT (utimecmp (BASE "file", &st1, &st3, UTIMECMP_TRUNCATE_SOURCE) <= 0);
     if (check_ctime)
       ASSERT (ctime_compare (&st2, &st3) < 0);
     nap ();