Re: Next cygwin round.
[p5sagit/p5-mst-13.2.git] / t / io / fs.t
index 574dcc0..70ee3ae 100755 (executable)
--- a/t/io/fs.t
+++ b/t/io/fs.t
@@ -72,14 +72,17 @@ close(fh);
 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 @@ is(chmod($newmode,'a'), 1, "chmod succeeding");
 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 @@ SKIP: {
      $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';
@@ -163,7 +165,7 @@ if (($^O eq 'MSWin32') || ($^O eq 'NetWare')) {
 if ($wd =~ m#$Config{'afsroot'}/# ||
     $^O eq 'amigaos' ||
     $^O eq 'dos' || $^O eq 'MSWin32' || $^O eq 'NetWare' || $^O eq 'cygwin') {
-    fail("Skip - granularity of the atime/mtime");
+    pass("Skip - granularity of the atime/mtime");
 } elsif ($atime == 500000000 && $mtime == 500000000 + $delta) {
     pass("atime/mtime");
 } elsif ($^O =~ /\blinux\b/i) {
@@ -182,10 +184,10 @@ if ($wd =~ m#$Config{'afsroot'}/# ||
        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 @@ unlink 'c';
 
 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 @@ if ($^O eq 'cygwin') {
     
     # 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";
 }