* Fix some tests.
authorPaul Smith <psmith@gnu.org>
Thu, 16 Sep 1999 03:43:10 +0000 (03:43 +0000)
committerPaul Smith <psmith@gnu.org>
Thu, 16 Sep 1999 03:43:10 +0000 (03:43 +0000)
Makefile.am
tests/ChangeLog
tests/test_driver.pl

index bb613c3f82947d83234e375f1010e03890ab7026..131965411d47d761b0ae43dbd62f2681af346d09 100644 (file)
@@ -116,6 +116,7 @@ check-regression:
          if $(PERL) -v >/dev/null 2>&1; then \
            case `cd $(srcdir); pwd` in `pwd`) : ;; \
              *) test -d tests || mkdir tests; \
+                rm -f srctests; \
                 if ln -s "$(srcdir)/tests" srctests; then \
                   for f in run_make_tests run_make_tests.pl test_driver.pl scripts; do \
                     rm -f tests/$$f; ln -s ../srctests/$$f tests; \
index ee4b4a3068bc17d3d8ada0672245a54e7673eb84..dd763b1ba620bb6886596bd346b0033db0390e42 100644 (file)
@@ -1,5 +1,15 @@
 1999-09-15  Paul D. Smith  <psmith@gnu.org>
 
+       * test_driver.pl (touch): Rewrite this function.  Previously it
+       used to use utime() to hard-set the time based on the current
+       local clock.  This fails badly on networked filesystems where the
+       FS server clock is skewed from the local clock: normally modifying
+       a file causes it to get a mod time based on the _server's_ clock.
+       Hard-setting it based on the _local_ clock causes gratuitous
+       errors and makes the tests unreliable except on local filesystems.
+       The new function will simply modify the file, allowing the
+       filesystem to set the mod time as it sees fit.
+
        * scripts/features/parallelism: The second test output could
        change depending on how fast some scripts completed; use "sleep"
        to force the order we want.
index 7dd7fda1b0259219c30635485e4f9f9f48548243..001d2477d5f92aa65f4924bc44916df57f6216f9 100644 (file)
@@ -785,19 +785,40 @@ sub remove_directory_tree_inner
   return 1;
 }
 
+# We used to use this behavior for this function:
+#
+#sub touch
+#{
+#  local (@filenames) = @_;
+#  local ($now) = time;
+#  local ($file);
+#
+#  foreach $file (@filenames)
+#  {
+#    utime ($now, $now, $file)
+#          || (open (TOUCHFD, ">> $file") && close (TOUCHFD))
+#               || &error ("Couldn't touch $file: $!\n", 1);
+#  }
+#  return 1;
+#}
+#
+# But this behaves badly on networked filesystems where the time is
+# skewed, because it sets the time of the file based on the _local_
+# host.  Normally when you modify a file, it's the _remote_ host that
+# determines the modtime, based on _its_ clock.  So, instead, now we open
+# the file and write something into it to force the remote host to set
+# the modtime correctly according to its clock.
+#
+
 sub touch
 {
   local (@filenames) = @_;
-  local ($now) = time;
   local ($file);
 
-  foreach $file (@filenames)
-  {
-    utime ($now, $now, $file)
-          || (open (TOUCHFD, ">> $file") && close (TOUCHFD))
-               || &error ("Couldn't touch $file: $!\n", 1);
+  foreach $file (@filenames) {
+    (open(T, ">> $file") && print(T "\n") && close(T))
+       || &error("Couldn't touch $file: $!\n", 1);
   }
-  return 1;
 }
 
 # open a file, write some stuff to it, and close it.