develooper Front page | perl.perl5.porters | Postings from November 2007

Re: [perl #47746] Not OK: perl 5.10.0 +RC1 on ia64-linux2.4.21-sgi302r24 (UNINSTALLED) [PATCH]

Thread Previous | Thread Next
From:
John P. Linderman
Date:
November 27, 2007 10:46
Subject:
Re: [perl #47746] Not OK: perl 5.10.0 +RC1 on ia64-linux2.4.21-sgi302r24 (UNINSTALLED) [PATCH]
Message ID:
200711271846.lARIkKFd14793373@raptor.research.att.com
In the spirit of trying to be helpful, how about this, as a
patch for op/stat.t?   On my NFS system with the 30-second skew
it gives me

...
ok 79 - -l _ croaks after -T _
ok 80 # skip: Too much clock skew between system and filesystem
ok 81 # skip: Too much clock skew between system and filesystem
ok 82 # skip: Too much clock skew between system and filesystem
ok 83 # skip: Too much clock skew between system and filesystem
ok 84 # skip: Too much clock skew between system and filesystem
ok 85 - can create temp file
...

-- jpl

--- stat.t.orig	Sun Jul 29 14:15:44 2007
+++ stat.t	Tue Nov 27 13:41:23 2007
@@ -50,6 +50,10 @@
 
 my($nlink, $mtime, $ctime) = (stat(FOO))[$NLINK, $MTIME, $CTIME];
 
+# The clock on a network filesystem might be different from the
+# system clock.
+my $Filesystem_Time_Offset = abs($mtime - time); 
+
 #nlink should if link support configured in Perl.
 SKIP: {
     skip "No link count - Hard link support not built in.", 1
@@ -453,20 +457,24 @@
     unlink $linkname or print "# unlink $linkname failed: $!\n";
 }
 
-print "# Zzz...\n";
-sleep(3);
-my $f = 'tstamp.tmp';
-unlink $f;
-ok (open(S, "> $f"), 'can create tmp file');
-close S or die;
-my @a = stat $f;
-print "# time=$^T, stat=(@a)\n";
-my @b = (-M _, -A _, -C _);
-print "# -MAC=(@b)\n";
-ok( (-M _) < 0, 'negative -M works');
-ok( (-A _) < 0, 'negative -A works');
-ok( (-C _) < 0, 'negative -C works');
-ok(unlink($f), 'unlink tmp file');
+SKIP: {
+    skip "Too much clock skew between system and filesystem", 5
+	if ($Filesystem_Time_Offset > 5);
+    print "# Zzz...\n";
+    sleep($Filesystem_Time_Offset+1);
+    my $f = 'tstamp.tmp';
+    unlink $f;
+    ok (open(S, "> $f"), 'can create tmp file');
+    close S or die;
+    my @a = stat $f;
+    print "# time=$^T, stat=(@a)\n";
+    my @b = (-M _, -A _, -C _);
+    print "# -MAC=(@b)\n";
+    ok( (-M _) < 0, 'negative -M works');
+    ok( (-A _) < 0, 'negative -M works');
+    ok( (-C _) < 0, 'negative -M works');
+    ok(unlink($f), 'unlink tmp file');
+}
 
 {
     ok(open(F, ">", $tmpfile), 'can create temp file');

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About