summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorGisle Aas <gisle@aas.no>2005-10-31 05:53:53 -0800
committerH.Merijn Brand <h.m.brand@xs4all.nl>2005-10-31 22:15:01 +0000
commite96b369dc61077fe31b75895167f55dbce4d7519 (patch)
tree613fb52284a3e7b4f3fa60658b49597039c6afb4 /t
parent0b612f938c486fe63cc6e365cfa90d407732bbcc (diff)
downloadperl-e96b369dc61077fe31b75895167f55dbce4d7519.tar.gz
futimes [PATCH]
Message-ID: <lrk6ft8ia6.fsf_-_@caliper.activestate.com> p4raw-id: //depot/perl@25941
Diffstat (limited to 't')
-rwxr-xr-xt/io/fs.t29
1 files changed, 27 insertions, 2 deletions
diff --git a/t/io/fs.t b/t/io/fs.t
index f1d5fc453b..4dd188e974 100755
--- a/t/io/fs.t
+++ b/t/io/fs.t
@@ -47,7 +47,7 @@ $needs_fh_reopen = 1 if (defined &Win32::IsWin95 && Win32::IsWin95());
my $skip_mode_checks =
$^O eq 'cygwin' && $ENV{CYGWIN} !~ /ntsec/;
-plan tests => 42;
+plan tests => 49;
if (($^O eq 'MSWin32') || ($^O eq 'NetWare')) {
@@ -206,10 +206,27 @@ 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';
-$foo = (utime 500000000,500000000 + $delta,'b');
+$foo = (utime 500000000,500000000 + $delta,'b');
is($foo, 1, "utime");
+check_utime_result();
+
+utime undef, undef, 'b';
+($atime,$mtime) = (stat 'b')[8,9];
+print "# utime undef, undef --> $atime, $mtime\n";
+isnt($atime, 500000000, 'atime');
+isnt($mtime, 500000000 + $delta, 'mtime');
+
+SKIP: {
+ skip "no futimes", 4 unless ($Config{d_futimes} || "") eq "define";
+ open(my $fh, "<", 'b');
+ $foo = (utime 500000000,500000000 + $delta, $fh);
+ is($foo, 1, "futime");
+ check_utime_result();
+}
+
+sub check_utime_result {
($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,
$blksize,$blocks) = stat('b');
@@ -259,6 +276,14 @@ SKIP: {
}
}
}
+}
+
+SKIP: {
+ skip "has futimes", 1 if ($Config{d_futimes} || "") eq "define";
+ open(my $fh, "<", "b") || die;
+ eval { utime(undef, undef, $fh); };
+ like($@, qr/^The futimes function is unimplemented at/, "futimes is unimplemented");
+}
is(unlink('b'), 1, "unlink b");