X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=test%2Fmknod.t;h=c35853ac229999d8ca6e2b6b7bf420001c62cbd4;hb=48e91793fca961bcf8c0cda9b62aa9deb722a45a;hp=8ea3b46ef2d953c3135f60fe2c05914cfe7d1c67;hpb=0c5b7a0ebd205c613eb1f80ee0a79e4843294071;p=perl-fuse.git diff --git a/test/mknod.t b/test/mknod.t index 8ea3b46..c35853a 100644 --- a/test/mknod.t +++ b/test/mknod.t @@ -3,15 +3,16 @@ use test::helper qw($_real $_point); use Test::More; plan tests => 24; use English; - -my $maj_off = 8; -if ($^O eq 'darwin') { $maj_off = 24; } +use Unix::Mknod qw(:all); +use Fcntl qw(S_IFCHR S_IFBLK); +use POSIX; my (@stat); chdir($_point); -ok(!(system("touch reg" )>>8),"create normal file"); -ok(!(system("mkfifo fifo" )>>8),"create fifo"); +ok(open($file, '>', 'reg'),"create normal file"); +close($file); +ok(defined mkfifo($_point.'/fifo', 0600),"create fifo"); chdir($_real); ok(-e "reg" ,"normal file exists"); @@ -23,8 +24,8 @@ SKIP: { skip('Need root to mknod devices', 8) unless ($UID == 0); chdir($_point); - ok(!(system("mknod chr c 2 3")>>8),"create chrdev"); - ok(!(system("mknod blk b 2 3")>>8),"create blkdev"); + ok(!mknod($_point.'/chr', 0600|S_IFCHR, makedev(2,3)),"create chrdev"); + ok(!mknod($_point.'/blk', 0600|S_IFBLK, makedev(2,3)),"create blkdev"); chdir($_real); ok(-e "chr" ,"chrdev exists"); @@ -37,9 +38,9 @@ SKIP: { ok(-b "blk" ,"blkdev is blkdev"); @stat = stat("chr"); - is($stat[6],3+(2<<$maj_off),"chrdev has right major,minor"); + is($stat[6],makedev(2,3),"chrdev has right major,minor"); @stat = stat("blk"); - is($stat[6],3+(2<<$maj_off),"blkdev has right major,minor"); + is($stat[6],makedev(2,3),"blkdev has right major,minor"); } chdir($_point); @@ -57,9 +58,9 @@ SKIP: { ok(-b "blk" ,"blkdev is blkdev"); @stat = stat("chr"); - is($stat[6],3+(2<<$maj_off),"chrdev has right major,minor"); + is($stat[6],makedev(2,3),"chrdev has right major,minor"); @stat = stat("blk"); - is($stat[6],3+(2<<$maj_off),"blkdev has right major,minor"); + is($stat[6],makedev(2,3),"blkdev has right major,minor"); } map { unlink } qw(reg chr blk fifo);