Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: f34c0d8edd
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 33 lines (32 sloc) 0.968 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
#!/usr/bin/perl
package # avoid cpan indexing
test::helper;
use strict;
use Exporter;
use Config;
use POSIX qw(WEXITSTATUS);
our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS);
@ISA = "Exporter";
@EXPORT_OK = qw($_loop $_opts $_point $_pidfile $_real);
my $tmp = -d '/private' ? '/private/tmp' : '/tmp';
our($_loop, $_point, $_pidfile, $_real, $_opts) = ('examples/loopback.pl',"$tmp/fusemnt-".$ENV{LOGNAME},$ENV{'PWD'} . "/test/s/mounted.pid","$tmp/fusetest-".$ENV{LOGNAME}, '');
$_opts = '--pidfile ' . $_pidfile;
$_opts .= $Config{useithreads} ? ' --use-threads' : '';
if($0 !~ qr|s/u?mount\.t$|) {
my ($reject) = 1;
if(open my $fh, '<', $_pidfile) {
my $pid = do {local $/ = undef; <$fh>};
close $fh;
if(kill 0, $pid) {
if(`mount` =~ m{on (?:/private)?$_point }) {
$reject = 0;
} else {
kill 1, $pid;
}
}
}
system("ls $_point >/dev/null");
$reject = 1 if (POSIX::WEXITSTATUS($?));
die "not properly mounted\n" if $reject;
}
1;
Something went wrong with that request. Please try again.