diff options
Diffstat (limited to 'perl/test')
-rw-r--r-- | perl/test/chmod.t | 11 | ||||
-rw-r--r-- | perl/test/chown.t | 14 | ||||
-rw-r--r-- | perl/test/getattr.t | 42 | ||||
-rw-r--r-- | perl/test/getdir.t | 33 | ||||
-rw-r--r-- | perl/test/helper.pm | 23 | ||||
-rw-r--r-- | perl/test/link.t | 16 | ||||
-rw-r--r-- | perl/test/mkdir.t | 11 | ||||
-rw-r--r-- | perl/test/mknod.t | 37 | ||||
-rw-r--r-- | perl/test/open.t | 10 | ||||
-rw-r--r-- | perl/test/read.t | 13 | ||||
-rw-r--r-- | perl/test/readlink.t | 11 | ||||
-rw-r--r-- | perl/test/rename.t | 12 | ||||
-rw-r--r-- | perl/test/rmdir.t | 13 | ||||
-rw-r--r-- | perl/test/s/mount.t | 25 | ||||
-rw-r--r-- | perl/test/s/umount.t | 7 | ||||
-rw-r--r-- | perl/test/statfs.t | 21 | ||||
-rw-r--r-- | perl/test/symlink.t | 19 | ||||
-rw-r--r-- | perl/test/test-template | 5 | ||||
-rw-r--r-- | perl/test/truncate.t | 12 | ||||
-rw-r--r-- | perl/test/unlink.t | 14 | ||||
-rw-r--r-- | perl/test/utime.t | 13 | ||||
-rw-r--r-- | perl/test/write.t | 45 |
22 files changed, 0 insertions, 407 deletions
diff --git a/perl/test/chmod.t b/perl/test/chmod.t deleted file mode 100644 index 366f89b..0000000 --- a/perl/test/chmod.t +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/perl -use test::helper qw($_real $_point); -use Test::More; -plan tests => 4; -chdir($_point); -system("echo frog >file"); -ok(chmod(0644,"file"),"set unexecutable"); -ok(!-x "file","unexecutable"); -ok(chmod(0755,"file"),"set executable"); -ok(-x "file","executable"); -unlink("file"); diff --git a/perl/test/chown.t b/perl/test/chown.t deleted file mode 100644 index 8ccbb88..0000000 --- a/perl/test/chown.t +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/perl -use test::helper qw($_real $_point); -use Test::More; -plan tests => 4; -my (@stat); -chdir($_point); -system("echo frog >file"); -ok(chown(0,0,"file"),"set 0,0"); -@stat = stat("file"); -ok($stat[4] == 0 && $stat[5] == 0,"0,0"); -ok(chown(1,1,"file"),"set 1,1"); -@stat = stat("file"); -ok($stat[4] == 1 && $stat[5] == 1,"1,1"); -unlink("file"); diff --git a/perl/test/getattr.t b/perl/test/getattr.t deleted file mode 100644 index 4203275..0000000 --- a/perl/test/getattr.t +++ /dev/null @@ -1,42 +0,0 @@ -#!/usr/bin/perl -use test::helper qw($_real $_point); -use Test::More; -use Data::Dumper; -plan tests => 28; -my ($a, $b) = ("$_real/wibble","$_point/wibble"); -`touch $b`; -is(-A "$a", -A "$b", '-A'); # 1 -is(-B "$a", -B "$b", '-B'); # 2 -is(-C "$a", -C "$b", '-C'); # 3 -is(-M "$a", -M "$b", '-M'); # 4 -is(-O "$a", -O "$b", '-O'); # 5 -is(-R "$a", -R "$b", '-R'); # 6 -is(-S "$a", -S "$b", '-S'); # 7 -is(-T "$a", -T "$b", '-T'); # 8 -is(-W "$a", -W "$b", '-W'); # 9 -is(-X "$a", -X "$b", '-X'); # 10 -is(-b "$a", -b "$b", '-b'); # 11 -is(-c "$a", -c "$b", '-c'); # 12 -is(-d "$a", -d "$b", '-d'); # 13 -is(-e "$a", -e "$b", '-e'); # 14 -is(-f "$a", -f "$b", '-f'); # 15 -is(-g "$a", -g "$b", '-g'); # 16 -is(-k "$a", -k "$b", '-k'); # 17 -is(-l "$a", -l "$b", '-l'); # 18 -is(-o "$a", -o "$b", '-o'); # 19 -is(-p "$a", -p "$b", '-p'); # 20 -is(-r "$a", -r "$b", '-r'); # 21 -is(-s "$a", -s "$b", '-s'); # 22 -is(-t "$a", -t "$b", '-t'); # 23 -is(-u "$a", -u "$b", '-u'); # 24 -is(-w "$a", -w "$b", '-w'); # 25 -is(-x "$a", -x "$b", '-x'); # 26 -is(-z "$a", -z "$b", '-z'); # 27 -my (@astat, @bstat); -@astat = stat("$a"); -@bstat = stat("$b"); -# dev and inode can legally change -shift(@astat); shift(@astat); -shift(@bstat); shift(@bstat); -is(join(" ",@astat),join(" ",@bstat),"stat()"); -`rm -f $a`; diff --git a/perl/test/getdir.t b/perl/test/getdir.t deleted file mode 100644 index 1d60561..0000000 --- a/perl/test/getdir.t +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/perl -use test::helper qw($_real $_point); -use Test::More; -my (@names) = qw(abc def ghi jkl mno pqr stu jlk sfdaljk sdfakjlsdfa kjldsf kjl;sdf akjl;asdf klj;asdf lkjsdflkjsdfkjlsdfakjsdfakjlsadfkjl;asdfklj;asdfkjl;asdfklj;asdfkjl;asdfkjlasdflkj;sadf); -@names = sort(@names); -plan tests => 2 * scalar @names; -chdir($_real); - -# create entries -map { system("touch \"$_\"") } @names; - -# make sure they exist in real dir -opendir(REAL,$_real); -my (@ents) = readdir(REAL); -closedir(REAL); -@ents = sort(@ents); -map { - shift(@ents) while($ents[0] eq '.' || $ents[0] eq '..'); - is(shift(@ents),$_,"ent $_") -} @names; - -# make sure they exist in fuse dir -opendir(POINT,$_point); -@ents = readdir(POINT); -closedir(POINT); -@ents = sort(@ents); -map { - shift(@ents) while($ents[0] eq '.' || $ents[0] eq '..'); - is(shift(@ents),$_,"ent $_") -} @names; - -# remove them -map { unlink } @names; diff --git a/perl/test/helper.pm b/perl/test/helper.pm deleted file mode 100644 index cd2bd55..0000000 --- a/perl/test/helper.pm +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/perl -package test::helper; -use strict; -use Exporter; -our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS); -@ISA = "Exporter"; -@EXPORT_OK = qw($_loop $_point $_pidfile $_real); -our($_loop, $_point, $_pidfile, $_real) = ("examples/loopback.pl","/mnt","test/s/mounted.pid","/tmp/fusetest"); -if($0 !~ qr|s/u?mount\.t$|) { - my ($reject) = 1; - if(-f $_pidfile) { - unless(system("ps `cat $_pidfile` | grep \"$_loop $_point\" >/dev/null")>>8) { - if(`mount | grep "on $_point"`) { - $reject = 0; - } else { - system("kill `cat $_pidfile`"); - } - } - } - $reject = 1 if (system("ls $_point >&/dev/null") >> 8); - die "not properly mounted\n" if $reject; -} -1; diff --git a/perl/test/link.t b/perl/test/link.t deleted file mode 100644 index 391b2f0..0000000 --- a/perl/test/link.t +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/perl -use test::helper qw($_real $_point); -use Test::More; -plan tests => 8; -chdir($_point); -system("echo hippity >womble"); -ok(-f "womble","exists"); -ok(!-f "rabbit","target file doesn't exist"); -is(-s "womble",8,"right size"); -ok(link("womble","rabbit"),"link"); -ok(-f "womble","old file exists"); -ok(-f "rabbit","target file exists"); -is(-s "womble",8,"right size"); -is(-s "rabbit",8,"right size"); -unlink("womble"); -unlink("rabbit"); diff --git a/perl/test/mkdir.t b/perl/test/mkdir.t deleted file mode 100644 index 90ec6f3..0000000 --- a/perl/test/mkdir.t +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/perl -use test::helper qw($_real $_point); -use Test::More; -plan tests => 3; -chdir($_point); -ok(mkdir("dir"),"mkdir"); -ok(-d "dir","dir exists"); -chdir($_real); -ok(-d "dir","dir really exists"); -chdir($_point); -rmdir("dir"); diff --git a/perl/test/mknod.t b/perl/test/mknod.t deleted file mode 100644 index 35c5c82..0000000 --- a/perl/test/mknod.t +++ /dev/null @@ -1,37 +0,0 @@ -#!/usr/bin/perl -use test::helper qw($_real $_point); -use Test::More; -plan tests => 24; -my (@stat); -chdir($_point); -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"); -ok(!(system("mknod fifo p" )>>8),"create fifo"); -chdir($_real); -ok(-e "reg" ,"normal file exists"); -ok(-e "chr" ,"chrdev exists"); -ok(-e "blk" ,"blkdev exists"); -ok(-e "fifo","fifo exists"); -ok(-f "reg" ,"normal file is normal file"); -ok(-c "chr" ,"chrdev is chrdev"); -ok(-b "blk" ,"blkdev is blkdev"); -ok(-p "fifo","fifo is fifo"); -@stat = stat("chr"); -is($stat[6],3+(2<<8),"chrdev has right major,minor"); -@stat = stat("blk"); -is($stat[6],3+(2<<8),"blkdev has right major,minor"); -chdir($_point); -ok(-e "reg" ,"normal file exists"); -ok(-e "chr" ,"chrdev exists"); -ok(-e "blk" ,"blkdev exists"); -ok(-e "fifo","fifo exists"); -ok(-f "reg" ,"normal file is normal file"); -ok(-c "chr" ,"chrdev is chrdev"); -ok(-b "blk" ,"blkdev is blkdev"); -ok(-p "fifo","fifo is fifo"); -@stat = stat("chr"); -is($stat[6],3+(2<<8),"chrdev has right major,minor"); -@stat = stat("blk"); -is($stat[6],3+(2<<8),"blkdev has right major,minor"); -map { unlink } qw(reg chr blk fifo); diff --git a/perl/test/open.t b/perl/test/open.t deleted file mode 100644 index 030dc1f..0000000 --- a/perl/test/open.t +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/perl -use test::helper qw($_real $_point); -use Test::More; -plan tests => 1; -chdir($_real); -system("echo frog >file"); -chdir($_point); -ok(open(FILE,"file"),"open"); -close(FILE); -unlink("file"); diff --git a/perl/test/read.t b/perl/test/read.t deleted file mode 100644 index 5eca920..0000000 --- a/perl/test/read.t +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/perl -use test::helper qw($_real $_point); -use Test::More; -plan tests => 3; -chdir($_real); -system("echo frog >file"); -chdir($_point); -ok(open(FILE,"file"),"open"); -my ($data) = <FILE>; -close(FILE); -is(length($data),5,"right amount read"); -is($data,"frog\n","right data read"); -unlink("file"); diff --git a/perl/test/readlink.t b/perl/test/readlink.t deleted file mode 100644 index 85b9ffc..0000000 --- a/perl/test/readlink.t +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/perl -use test::helper qw($_point $_real); -use Test::More; -plan tests => 4; -chdir($_real); -ok(symlink("abc","def"),"OS supports symlinks"); -is(readlink("def"),"abc","OS supports symlinks"); -chdir($_point); -ok(-l "def","symlink exists"); -is(readlink("def"),"abc","readlink"); -unlink("def"); diff --git a/perl/test/rename.t b/perl/test/rename.t deleted file mode 100644 index 9fbb330..0000000 --- a/perl/test/rename.t +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/perl -use test::helper qw($_real $_point); -use Test::More; -plan tests => 5; -chdir($_point); -system("echo hippity >frog"); -ok(-f "frog","exists"); -ok(!-f "toad","target file doesn't exist"); -ok(rename("frog","toad"),"rename"); -ok(!-f "frog","old file doesn't exist"); -ok(-f "toad","target file exists"); -unlink("toad"); diff --git a/perl/test/rmdir.t b/perl/test/rmdir.t deleted file mode 100644 index 36f0378..0000000 --- a/perl/test/rmdir.t +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/perl -use test::helper qw($_real $_point); -use Test::More; -plan tests => 5; -chdir($_real); -ok(mkdir("dir"),"mkdir"); -ok(-d "dir","dir really exists"); -chdir($_point); -ok(-d "dir","dir exists"); -rmdir("dir"); -ok(! -d "dir","dir removed"); -chdir($_real); -ok(! -d "dir","dir really removed"); diff --git a/perl/test/s/mount.t b/perl/test/s/mount.t deleted file mode 100644 index 26f6fc2..0000000 --- a/perl/test/s/mount.t +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/perl -w -use test::helper qw($_point $_loop $_real $_pidfile); -use strict; -use Test::More tests => 3; -ok(!(scalar grep(/ on $_point /,`cat /proc/mounts`)),"already mounted"); -ok(-f $_loop,"loopback exists"); - -if(!fork()) { - #close(STDIN); - close(STDOUT); - close(STDERR); - `echo $$ >test/s/mounted.pid`; - exec("perl $_loop $_point"); - exit(1); -} -select(undef, undef, undef, 0.5); -my ($success) = `cat /proc/mounts` =~ / $_point /; -ok($success,"mount succeeded"); -system("rm -rf $_real"); -unless($success) { - kill('INT',`cat $_pidfile`); - unlink($_pidfile); -} else { - mkdir($_real); -} diff --git a/perl/test/s/umount.t b/perl/test/s/umount.t deleted file mode 100644 index da60677..0000000 --- a/perl/test/s/umount.t +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/perl -use test::helper qw($_point $_real $_pidfile); -use strict; -use Test::More tests => 1; -system("umount $_point"); -ok(1,"unmount"); -system("rm -rf $_real $_pidfile"); diff --git a/perl/test/statfs.t b/perl/test/statfs.t deleted file mode 100644 index fb94704..0000000 --- a/perl/test/statfs.t +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/perl -use test::helper qw($_real $_point); -use Test::More; -require 'syscall.ph'; # for SYS_statfs -plan tests => 7; -my ($statfs_data) = " " x 10; -my ($tmp) = $_point; -ok(!syscall(&SYS_statfs,$tmp,$statfs_data),"statfs"); -# FIXME: this is soooooo linux-centric. perhaps parse the output of /bin/df? -my @list = unpack("LSSL8",$statfs_data); -shift(@list); -is(shift(@list),4096,"block size"); -shift(@list); -is(shift(@list),1000000,"blocks"); -is(shift(@list),500000,"blocks free"); -shift(@list); -is(shift(@list),1000000,"files"); -is(shift(@list),500000,"files free"); -shift(@list); -shift(@list); -is(shift(@list),255,"namelen"); diff --git a/perl/test/symlink.t b/perl/test/symlink.t deleted file mode 100644 index 19cc72d..0000000 --- a/perl/test/symlink.t +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/perl -use test::helper qw($_point $_real); -use Test::More; -plan tests => 6; -chdir($_point); -ok(symlink("abc","def"),"symlink created"); -ok(-l "def","symlink exists"); -is(readlink("def"),"abc","it worked"); -chdir($_real); -ok(-l "def","symlink really exists"); -is(readlink("def"),"abc","really worked"); -unlink("def"); - -# bug: doing a 'cp -a' on a directory which contains a symlink -# reports an error -mkdir("dira"); -system("cd dira; touch filea; ln -s filea fileb"); -is(system("cp -a dira dirb")>>8,0,"cp -a"); -system("rm -rf dira dirb"); diff --git a/perl/test/test-template b/perl/test/test-template deleted file mode 100644 index ef57e08..0000000 --- a/perl/test/test-template +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/perl -use test::helper qw($_real $_point); -use Test::More; -plan tests => 1; -ok(1); diff --git a/perl/test/truncate.t b/perl/test/truncate.t deleted file mode 100644 index 8607421..0000000 --- a/perl/test/truncate.t +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/perl -use test::helper qw($_real $_point); -use Test::More; -plan tests => 5; -chdir($_point); -system("echo hippity >womble"); -ok(-f "womble","exists"); -is(-s "womble",8,"right size"); -ok(truncate("womble",4),"truncate"); -ok(-f "womble","file exists"); -is(-s "womble",4,"right size"); -unlink("womble"); diff --git a/perl/test/unlink.t b/perl/test/unlink.t deleted file mode 100644 index eef8c1a..0000000 --- a/perl/test/unlink.t +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/perl -use test::helper qw($_real $_point); -use Test::More; -plan tests => 4; -chdir($_point); -system("touch file"); -ok(-f "file","file exists"); -chdir($_real); -ok(-f "file","file really exists"); -chdir($_point); -unlink("file"); -ok(! -f "file","file unlinked"); -chdir($_real); -ok(! -f "file","file really unlinked"); diff --git a/perl/test/utime.t b/perl/test/utime.t deleted file mode 100644 index 8ccefc6..0000000 --- a/perl/test/utime.t +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/perl -use test::helper qw($_real $_point); -use Test::More; -plan tests => 3; -my (@stat); -chdir($_real); -system("echo frog >file"); -chdir($_point); -ok(utime(1,2,"file"),"set utime"); -@stat = stat("file"); -is($stat[8],1,"atime"); -is($stat[9],2,"mtime"); -unlink("file"); diff --git a/perl/test/write.t b/perl/test/write.t deleted file mode 100644 index 58af2aa..0000000 --- a/perl/test/write.t +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/perl -use test::helper qw($_real $_point); -use Test::More; -plan tests => 15; -my ($data); -chdir($_point); -undef $/; # slurp it all -# create file -system("echo frogbing >writefile"); - -# fetch contents of file -ok(open(FILE,"writefile"),"open"); -$data = <FILE>; -close(FILE); -is(length($data),9,"right amount read"); -is($data,"frogbing\n","right data read"); - -# overwrite part -ok(open(FILE,'+<',"writefile"),"open"); -ok(seek(FILE,2,0),"seek"); -ok(print(FILE "ib"),"print"); -close(FILE); - -# fetch contents of file -ok(open(FILE,"writefile"),"open"); -$data = <FILE>; -close(FILE); -is(length($data),9,"right amount read"); -is($data,"fribbing\n","right data read"); - -# overwrite part, append some -ok(open(FILE,'+<',"writefile"),"open"); -ok(seek(FILE,7,0),"seek"); -ok(print(FILE "gle"),"print"); -close(FILE); - -# fetch contents of file -ok(open(FILE,"writefile"),"open"); -$data = <FILE>; -close(FILE); -is(length($data),10,"right amount read"); -is($data,"fribbingle","right data read"); - -# kill file -unlink("writefile"); |