When testing, check if '/proc/mounts' exists.
[perl-fuse.git] / test / getdir.t
1 #!/usr/bin/perl
2 use test::helper qw($_real $_point);
3 use Test::More;
4 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);
5 @names = sort(@names);
6 plan tests => 2 * scalar @names;
7 chdir($_real);
8
9 # create entries
10 map { system("touch \"$_\"") } @names;
11
12 # make sure they exist in real dir
13 opendir(REAL,$_real);
14 my (@ents) = readdir(REAL);
15 closedir(REAL);
16 @ents = sort(@ents);
17 map {
18         shift(@ents) while($ents[0] eq '.' || $ents[0] eq '..');
19         is(shift(@ents),$_,"ent $_")
20 } @names;
21
22 # make sure they exist in fuse dir
23 opendir(POINT,$_point);
24 @ents = readdir(POINT);
25 closedir(POINT);
26 @ents = sort(@ents);
27 map {
28         shift(@ents) while($ents[0] eq '.' || $ents[0] eq '..');
29         is(shift(@ents),$_,"ent $_")
30 } @names;
31
32 # remove them
33 map { unlink } @names;