home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / perl / os2perl / fs.t < prev    next >
Text File  |  1991-04-12  |  3KB  |  86 lines

  1. #!./perl
  2.  
  3. # $Header: fs.t,v 4.0 91/03/20 01:50:55 lwall Locked $
  4.  
  5. print "1..22\n";
  6.  
  7. $wd = `pwd`;
  8. chop($wd);
  9.  
  10. `rm -f tmp 2>/dev/null; mkdir tmp 2>/dev/null`;
  11. chdir './tmp';
  12. `/bin/rm -rf a b c x`;
  13.  
  14. umask(022);
  15.  
  16. if (umask(0) == 022) {print "ok 1\n";} else {print "not ok 1\n";}
  17. open(fh,'>x') || die "Can't create x";
  18. close(fh);
  19. open(fh,'>a') || die "Can't create a";
  20. close(fh);
  21.  
  22. if (link('a','b')) {print "ok 2\n";} else {print "not ok 2\n";}
  23.  
  24. if (link('b','c')) {print "ok 3\n";} else {print "not ok 3\n";}
  25.  
  26. ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,
  27.     $blksize,$blocks) = stat('c');
  28.  
  29. if ($nlink == 3) {print "ok 4\n";} else {print "not ok 4\n";}
  30. if (($mode & 0777) == 0666) {print "ok 5\n";} else {print "not ok 5\n";}
  31.  
  32. if ((chmod 0777,'a') == 1) {print "ok 6\n";} else {print "not ok 6\n";}
  33.  
  34. ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,
  35.     $blksize,$blocks) = stat('c');
  36. if (($mode & 0777) == 0777) {print "ok 7\n";} else {print "not ok 7\n";}
  37.  
  38. if ((chmod 0700,'c','x') == 2) {print "ok 8\n";} else {print "not ok 8\n";}
  39.  
  40. ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,
  41.     $blksize,$blocks) = stat('c');
  42. if (($mode & 0777) == 0700) {print "ok 9\n";} else {print "not ok 9\n";}
  43. ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,
  44.     $blksize,$blocks) = stat('x');
  45. if (($mode & 0777) == 0700) {print "ok 10\n";} else {print "not ok 10\n";}
  46.  
  47. if ((unlink 'b','x') == 2) {print "ok 11\n";} else {print "not ok 11\n";}
  48. ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,
  49.     $blksize,$blocks) = stat('b');
  50. if ($ino == 0) {print "ok 12\n";} else {print "not ok 12\n";}
  51. ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,
  52.     $blksize,$blocks) = stat('x');
  53. if ($ino == 0) {print "ok 13\n";} else {print "not ok 13\n";}
  54.  
  55. if (rename('a','b')) {print "ok 14\n";} else {print "not ok 14\n";}
  56. ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,
  57.     $blksize,$blocks) = stat('a');
  58. if ($ino == 0) {print "ok 15\n";} else {print "not ok 15\n";}
  59. $foo = (utime 500000000,500000001,'b');
  60. if ($foo == 1) {print "ok 16\n";} else {print "not ok 16 $foo\n";}
  61. ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,
  62.     $blksize,$blocks) = stat('b');
  63. if ($ino) {print "ok 17\n";} else {print "not ok 17\n";}
  64. if (($atime == 500000000 && $mtime == 500000001) || $wd =~ m#/afs/#)
  65.     {print "ok 18\n";}
  66. else
  67.     {print "not ok 18 $atime $mtime\n";}
  68.  
  69. if ((unlink 'b') == 1) {print "ok 19\n";} else {print "not ok 19\n";}
  70. ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,
  71.     $blksize,$blocks) = stat('b');
  72. if ($ino == 0) {print "ok 20\n";} else {print "not ok 20\n";}
  73. unlink 'c';
  74.  
  75. chdir $wd || die "Can't cd back to $wd";
  76.  
  77. unlink 'c';
  78. if (`ls -l perl 2>/dev/null` =~ /^l.*->/) {  # we have symbolic links
  79.     if (symlink("TEST","c")) {print "ok 21\n";} else {print "not ok 21\n";}
  80.     $foo = `grep perl c`;
  81.     if ($foo) {print "ok 22\n";} else {print "not ok 22\n";}
  82. }
  83. else {
  84.     print "ok 21\nok 22\n";
  85. }
  86.