2 |
use test::helper qw($_point $_loop $_real $_pidfile); |
use test::helper qw($_point $_loop $_real $_pidfile); |
3 |
use strict; |
use strict; |
4 |
use Test::More tests => 3; |
use Test::More tests => 3; |
5 |
ok(!(scalar grep(/ on $_point /,`cat /proc/mounts`)),"already mounted"); |
|
6 |
|
sub is_mounted { |
7 |
|
my $diag = -d '/proc' ? `cat /proc/mounts` : `mount`; |
8 |
|
return $diag =~ m{ (?:/private)?$_point }; |
9 |
|
} |
10 |
|
|
11 |
|
ok(!is_mounted(),"already mounted"); |
12 |
ok(-f $_loop,"loopback exists"); |
ok(-f $_loop,"loopback exists"); |
13 |
|
|
14 |
if(!fork()) { |
if(!fork()) { |
19 |
mkdir $_real; |
mkdir $_real; |
20 |
`echo $$ >test/s/mounted.pid`; |
`echo $$ >test/s/mounted.pid`; |
21 |
diag "mounting $_loop to $_point"; |
diag "mounting $_loop to $_point"; |
22 |
|
open STDOUT, '>', '/tmp/fusemnt.log'; |
23 |
|
open STDERR, '>&', \*STDOUT; |
24 |
exec("perl -Iblib/lib -Iblib/arch $_loop $_point"); |
exec("perl -Iblib/lib -Iblib/arch $_loop $_point"); |
25 |
exit(1); |
exit(1); |
26 |
} |
} |
28 |
my ($success, $count) = (0,0); |
my ($success, $count) = (0,0); |
29 |
while ($count++ < 50 && !$success) { |
while ($count++ < 50 && !$success) { |
30 |
select(undef, undef, undef, 0.1); |
select(undef, undef, undef, 0.1); |
31 |
($success) = `mount` =~ / $_point /; |
($success) = is_mounted(); |
32 |
} |
} |
33 |
diag "Mounted in ", $count/10, " secs"; |
diag "Mounted in ", $count/10, " secs"; |
34 |
|
|