/[fuse.before_github]/perl-llin/test/s/mount.t
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /perl-llin/test/s/mount.t

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 111 by dpavlin, Thu Nov 15 09:23:22 2007 UTC revision 112 by dpavlin, Thu Nov 15 09:32:08 2007 UTC
# Line 2  Line 2 
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()) {
# Line 13  if(!fork()) { Line 19  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  }  }
# Line 20  if(!fork()) { Line 28  if(!fork()) {
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    

Legend:
Removed from v.111  
changed lines
  Added in v.112

  ViewVC Help
Powered by ViewVC 1.1.26