summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2001-12-12 05:42:05 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2001-12-12 05:42:05 +0000
commit8268670f812926c9ec3dc5d88442c6573b0eacc5 (patch)
treecd929357041c860fd50d376f2321dd1a955afd92 /t
parentd1c9dd79741af11ae3e822bbf399085c4f310ec2 (diff)
downloadperl-8268670f812926c9ec3dc5d88442c6573b0eacc5.tar.gz
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.) p4raw-id: //depot/perl@13651
Diffstat (limited to 't')
-rwxr-xr-xt/io/fs.t32
1 files changed, 16 insertions, 16 deletions
diff --git a/t/io/fs.t b/t/io/fs.t
index 574dcc028d..9a5d97d46a 100755
--- 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';
@@ -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";
}