3 # $RCSfile: fs.t,v $$Revision: 4.1 $$Date: 92/08/07 18:27:28 $
17 `rm -f tmp 2>/dev/null; mkdir tmp 2>/dev/null`;
19 `/bin/rm -rf a b c x` if -x '/bin/rm';
23 if ((umask(0)&0777) == 022) {print "ok 1\n";} else {print "not ok 1\n";}
24 open(fh,'>x') || die "Can't create x";
26 open(fh,'>a') || die "Can't create a";
29 if (eval {link('a','b')}) {print "ok 2\n";} else {print "not ok 2\n";}
31 if (eval {link('b','c')}) {print "ok 3\n";} else {print "not ok 3\n";}
33 ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,
34 $blksize,$blocks) = stat('c');
36 if ($Config{dont_use_nlink} || $nlink == 3)
37 {print "ok 4\n";} else {print "not ok 4\n";}
39 if (($mode & 0777) == 0666) {print "ok 5\n";} else {print "not ok 5\n";}
41 if ((chmod 0777,'a') == 1) {print "ok 6\n";} else {print "not ok 6\n";}
43 ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,
44 $blksize,$blocks) = stat('c');
45 if (($mode & 0777) == 0777) {print "ok 7\n";} else {print "not ok 7\n";}
47 if ((chmod 0700,'c','x') == 2) {print "ok 8\n";} else {print "not ok 8\n";}
49 ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,
50 $blksize,$blocks) = stat('c');
51 if (($mode & 0777) == 0700) {print "ok 9\n";} else {print "not ok 9\n";}
52 ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,
53 $blksize,$blocks) = stat('x');
54 if (($mode & 0777) == 0700) {print "ok 10\n";} else {print "not ok 10\n";}
56 if ((unlink 'b','x') == 2) {print "ok 11\n";} else {print "not ok 11\n";}
57 ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,
58 $blksize,$blocks) = stat('b');
59 if ($ino == 0) {print "ok 12\n";} else {print "not ok 12\n";}
60 ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,
61 $blksize,$blocks) = stat('x');
62 if ($ino == 0) {print "ok 13\n";} else {print "not ok 13\n";}
64 if (rename('a','b')) {print "ok 14\n";} else {print "not ok 14\n";}
65 ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,
66 $blksize,$blocks) = stat('a');
67 if ($ino == 0) {print "ok 15\n";} else {print "not ok 15\n";}
68 $foo = (utime 500000000,500000001,'b');
69 if ($foo == 1) {print "ok 16\n";} else {print "not ok 16 $foo\n";}
70 ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,
71 $blksize,$blocks) = stat('b');
72 if ($ino) {print "ok 17\n";} else {print "not ok 17\n";}
73 if (($atime == 500000000 && $mtime == 500000001) || $wd =~ m#/afs/#)
76 {print "not ok 18 $atime $mtime\n";}
78 if ((unlink 'b') == 1) {print "ok 19\n";} else {print "not ok 19\n";}
79 ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,
80 $blksize,$blocks) = stat('b');
81 if ($ino == 0) {print "ok 20\n";} else {print "not ok 20\n";}
84 chdir $wd || die "Can't cd back to $wd";
88 if (`ls -l perl 2>/dev/null` =~ /^l.*->/) { # we have symbolic links
89 if (symlink("TEST","c")) {print "ok 21\n";} else {print "not ok 21\n";}
91 if ($foo) {print "ok 22\n";} else {print "not ok 22\n";}
95 print "ok 21\nok 22\n";
98 # truncate (may not be implemented everywhere)
100 `echo helloworld > Iofs.tmp`;
101 eval { truncate "Iofs.tmp", 5; };
102 if ($@ =~ /not implemented/) {
103 print "# truncate not implemented -- skipping tests 23 through 26\n";
109 if (-s "Iofs.tmp" == 5) {print "ok 23\n"} else {print "not ok 23\n"}
110 truncate "Iofs.tmp", 0;
111 if (-z "Iofs.tmp") {print "ok 24\n"} else {print "not ok 24\n"}
112 `echo helloworld > Iofs.tmp`;
113 open(FH, ">Iofs.tmp") or die "Can't create Iofs.tmp";
115 if (-s "Iofs.tmp" == 5) {print "ok 25\n"} else {print "not ok 25\n"}
117 if (-z "Iofs.tmp") {print "ok 26\n"} else {print "not ok 26\n"}