/[fuse.before_github]/perl-llin/test/helper.pm
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/helper.pm

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

revision 105 by dpavlin, Wed Nov 29 13:23:28 2006 UTC revision 112 by dpavlin, Thu Nov 15 09:32:08 2007 UTC
# Line 7  use POSIX qw(WEXITSTATUS); Line 7  use POSIX qw(WEXITSTATUS);
7  our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS);  our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS);
8  @ISA = "Exporter";  @ISA = "Exporter";
9  @EXPORT_OK = qw($_loop $_point $_pidfile $_real);  @EXPORT_OK = qw($_loop $_point $_pidfile $_real);
10  our($_loop, $_point, $_pidfile, $_real) = ("","/tmp/fusemnt-".$ENV{LOGNAME},"test/s/mounted.pid","/tmp/fusetest-".$ENV{LOGNAME});  my $tmp = -d '/private' ? '/private/tmp' : '/tmp';
11  $_loop = $Config{useithreads} ? "examples/loopback_t.pl" : "examples/loopback.pl";  our($_loop, $_point, $_pidfile, $_real) = ("","$tmp/fusemnt-".$ENV{LOGNAME},"test/s/mounted.pid","$tmp/fusetest-".$ENV{LOGNAME});
12    $_loop = $^O ne 'darwin' && $Config{useithreads} ? "examples/loopback_t.pl" : "examples/loopback.pl";
13  if($0 !~ qr|s/u?mount\.t$|) {  if($0 !~ qr|s/u?mount\.t$|) {
14          my ($reject) = 1;          my ($reject) = 1;
15          if(-f $_pidfile) {          if(open my $fh, '<', $_pidfile) {
16                  unless(POSIX::WEXITSTATUS(system("ps `cat $_pidfile` | grep \"$_loop $_point\" >/dev/null"))) {                  my $pid = do {local $/ = undef; <$fh>};
17                          if(`mount | grep "on $_point"`) {                  close $fh;
18                    if(kill 0, $pid) {
19                            if(`mount` =~ m{on (?:/private)?$_point }) {
20                                  $reject = 0;                                  $reject = 0;
21                          } else {                          } else {
22                                  system("kill `cat $_pidfile`");                                  kill 1, $pid;
23                          }                          }
24                  }                  }
25          }          }

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

  ViewVC Help
Powered by ViewVC 1.1.26