Change 13651 by jhi@alpha on 2001/12/12 05:42:05

        rename() must be tested even without link()
        or the utime() and rename-directory tests fail.
        (Also got the BeOS utime atime/time the wrong way round.)

Affected files ...

.... //depot/perl/t/io/fs.t#35 edit

Differences ...

==== //depot/perl/t/io/fs.t#35 (xtext) ====
Index: perl/t/io/fs.t
--- perl/t/io/fs.t.~1~  Tue Dec 11 22:45:06 2001
+++ perl/t/io/fs.t      Tue Dec 11 22:45:06 2001
@@ -72,14 +72,17 @@
 open(fh,'>a') || die "Can't create a";
 close(fh);
 
+my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,
+    $blksize,$blocks);
+
 SKIP: { 
     skip("no link", 4) unless $has_link;
 
     ok(link('a','b'), "link a b");
     ok(link('b','c'), "link b c");
 
-    my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,
-       $blksize,$blocks) = stat('c');
+    ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,
+     $blksize,$blocks) = stat('c');
 
     if ($Config{dont_use_nlink}) {
        pass("Skip - dont_use_nlink");
@@ -101,8 +104,8 @@
 SKIP: {
     skip("no link", 9) unless $has_link;
 
-    my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,
-       $blksize,$blocks) = stat('c');
+    ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,
+     $blksize,$blocks) = stat('c');
 
     is($mode & 0777, $newmode, "chmod going through");
 
@@ -133,15 +136,14 @@
      $blksize,$blocks) = stat('x');
 
     is($ino, undef, "ino of removed file x should be undef");
+}
 
-    # Assumed that if link() exists, so does rename().
-    is(rename('a','b'), 1, "rename a b");
+is(rename('a','b'), 1, "rename a b");
 
-    ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,
-     $blksize,$blocks) = stat('a');
+($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,
+ $blksize,$blocks) = stat('a');
 
-    is($ino, undef, "ino of renamed file a should be undef");
-}
+is($ino, undef, "ino of renamed file a should be undef");
 
 $delta = $accurate_timestamps ? 1 : 2; # Granularity of time on the filesystem
 chmod 0777, 'b';
@@ -182,10 +184,10 @@
        fail("atime $atime mtime $mtime");
     }
 } elsif ($^O eq 'beos') {
-    if ($atime == 500000001) {
-        pass("atime (mtime not updated)");
+    if ($mtime == 500000001) {
+        pass("mtime (atime not updated)");
     } else {
-       fail("atime $atime (mtime not updated)");
+       fail("mtime $mtime (atime not updated)");
     }
 } else {
     fail("atime/mtime");
@@ -200,8 +202,6 @@
 
 chdir $wd || die "Can't cd back to $wd";
 
-unlink 'c';
-
 # Yet another way to look for links (perhaps those that cannot be
 # created by perl?).  Hopefully there is an ls utility in your
 # %PATH%. N.B. that $^O is 'cygwin' on Cygwin.
@@ -288,7 +288,7 @@
     
     # this works on win32 only, because fs isn't casesensitive
     ok(-e 'X', "rename working");
-    
+
     unlink 'X';
     chdir $wd || die "Can't cd back to $wd";
 }
End of Patch.

Reply via email to