summaryrefslogtreecommitdiff
path: root/tests/test_driver.pl
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>1999-09-16 03:43:10 +0000
committerPaul Smith <psmith@gnu.org>1999-09-16 03:43:10 +0000
commit6ec7d1881c0be453c7ece03a7dcc51681c514778 (patch)
treee9a78058e81a9b0bfa2e888473d02a35063be3d5 /tests/test_driver.pl
parentc8003673857919d2283e16c829325c9f14e10dfe (diff)
downloadgunmake-6ec7d1881c0be453c7ece03a7dcc51681c514778.tar.gz
* Fix some tests.
Diffstat (limited to 'tests/test_driver.pl')
-rw-r--r--tests/test_driver.pl35
1 files changed, 28 insertions, 7 deletions
diff --git a/tests/test_driver.pl b/tests/test_driver.pl
index 7dd7fda..001d247 100644
--- a/tests/test_driver.pl
+++ b/tests/test_driver.pl
@@ -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.