/[fuse.before_github]/perl-llin/test/mknod.t
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /perl-llin/test/mknod.t

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

perl/trunk/test/mknod.t revision 4 by mszeredi, Thu Nov 11 14:44:15 2004 UTC perl-llin/test/mknod.t revision 107 by dpavlin, Sun Dec 3 11:25:02 2006 UTC
# Line 2  Line 2 
2  use test::helper qw($_real $_point);  use test::helper qw($_real $_point);
3  use Test::More;  use Test::More;
4  plan tests => 24;  plan tests => 24;
5    use English;
6    
7  my (@stat);  my (@stat);
8    
9  chdir($_point);  chdir($_point);
10  ok(!(system("touch reg"      )>>8),"create normal file");  ok(!(system("touch reg"      )>>8),"create normal file");
 ok(!(system("mknod chr c 2 3")>>8),"create chrdev");  
 ok(!(system("mknod blk b 2 3")>>8),"create blkdev");  
11  ok(!(system("mknod fifo p"   )>>8),"create fifo");  ok(!(system("mknod fifo p"   )>>8),"create fifo");
12    
13  chdir($_real);  chdir($_real);
14  ok(-e "reg" ,"normal file exists");  ok(-e "reg" ,"normal file exists");
 ok(-e "chr" ,"chrdev exists");  
 ok(-e "blk" ,"blkdev exists");  
15  ok(-e "fifo","fifo exists");  ok(-e "fifo","fifo exists");
16  ok(-f "reg" ,"normal file is normal file");  ok(-f "reg" ,"normal file is normal file");
 ok(-c "chr" ,"chrdev is chrdev");  
 ok(-b "blk" ,"blkdev is blkdev");  
17  ok(-p "fifo","fifo is fifo");  ok(-p "fifo","fifo is fifo");
18  @stat = stat("chr");  
19  is($stat[6],3+(2<<8),"chrdev has right major,minor");  SKIP: {
20  @stat = stat("blk");          skip('Need root to mknod devices', 8) unless ($UID == 0);
21  is($stat[6],3+(2<<8),"blkdev has right major,minor");  
22            chdir($_point);
23            ok(!(system("mknod chr c 2 3")>>8),"create chrdev");
24            ok(!(system("mknod blk b 2 3")>>8),"create blkdev");
25    
26            chdir($_real);
27            ok(-e "chr" ,"chrdev exists");
28            ok(-e "blk" ,"blkdev exists");
29            
30            skip('mknod() is just pretend under fakeroot(1)', 4)
31              if exists $ENV{FAKEROOTKEY};
32    
33            ok(-c "chr" ,"chrdev is chrdev");
34            ok(-b "blk" ,"blkdev is blkdev");
35    
36            @stat = stat("chr");
37            is($stat[6],3+(2<<8),"chrdev has right major,minor");
38            @stat = stat("blk");
39            is($stat[6],3+(2<<8),"blkdev has right major,minor");
40    }
41    
42  chdir($_point);  chdir($_point);
43  ok(-e "reg" ,"normal file exists");  ok(-e "reg" ,"normal file exists");
 ok(-e "chr" ,"chrdev exists");  
 ok(-e "blk" ,"blkdev exists");  
44  ok(-e "fifo","fifo exists");  ok(-e "fifo","fifo exists");
45  ok(-f "reg" ,"normal file is normal file");  ok(-f "reg" ,"normal file is normal file");
 ok(-c "chr" ,"chrdev is chrdev");  
 ok(-b "blk" ,"blkdev is blkdev");  
46  ok(-p "fifo","fifo is fifo");  ok(-p "fifo","fifo is fifo");
47  @stat = stat("chr");  
48  is($stat[6],3+(2<<8),"chrdev has right major,minor");  SKIP: {
49  @stat = stat("blk");          skip('Need root to mknod devices', 6) unless ($UID == 0);
50  is($stat[6],3+(2<<8),"blkdev has right major,minor");  
51            ok(-e "chr" ,"chrdev exists");
52            ok(-e "blk" ,"blkdev exists");
53            ok(-c "chr" ,"chrdev is chrdev");
54            ok(-b "blk" ,"blkdev is blkdev");
55    
56            @stat = stat("chr");
57            is($stat[6],3+(2<<8),"chrdev has right major,minor");
58            @stat = stat("blk");
59            is($stat[6],3+(2<<8),"blkdev has right major,minor");
60    }
61    
62  map { unlink } qw(reg chr blk fifo);  map { unlink } qw(reg chr blk fifo);

Legend:
Removed from v.4  
changed lines
  Added in v.107

  ViewVC Help
Powered by ViewVC 1.1.26