X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=test%2Fs%2Fmount.t;h=2381734318d4e8219665c7b28dc8575f65a31d20;hb=ea6e4fd27a10f60467acd1fc3d7c458a7748a8f9;hp=b633dce4c996fa72f9a5b43468172632d230a19c;hpb=377665d81c5d789622229a76d7f4af984f5d14fb;p=perl-fuse.git diff --git a/test/s/mount.t b/test/s/mount.t index b633dce..2381734 100644 --- a/test/s/mount.t +++ b/test/s/mount.t @@ -2,7 +2,13 @@ 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"); + +sub is_mounted { + my $diag = -e '/proc/mounts' ? `cat /proc/mounts` : `mount`; + return $diag =~ m{ (?:/private)?$_point }; +} + +ok(!is_mounted(),"already mounted"); ok(-f $_loop,"loopback exists"); if(!fork()) { @@ -12,11 +18,20 @@ if(!fork()) { mkdir $_point; mkdir $_real; `echo $$ >test/s/mounted.pid`; - exec("perl $_loop $_point"); + diag "mounting $_loop to $_point"; + open STDOUT, '>', '/tmp/fusemnt.log'; + open STDERR, '>&', \*STDOUT; + exec("perl -Iblib/lib -Iblib/arch $_loop $_point"); exit(1); } -select(undef, undef, undef, 0.5); -my ($success) = `cat /proc/mounts` =~ / $_point /; + +my ($success, $count) = (0,0); +while ($count++ < 50 && !$success) { + select(undef, undef, undef, 0.1); + ($success) = is_mounted(); +} +diag "Mounted in ", $count/10, " secs"; + ok($success,"mount succeeded"); system("rm -rf $_real"); unless($success) {