1 |
#!/usr/bin/perl |
2 |
package test::helper; |
3 |
use strict; |
4 |
use Exporter; |
5 |
our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS); |
6 |
@ISA = "Exporter"; |
7 |
@EXPORT_OK = qw($_loop $_point $_pidfile $_real); |
8 |
our($_loop, $_point, $_pidfile, $_real) = ("examples/loopback.pl","/mnt","test/s/mounted.pid","/tmp/fusetest"); |
9 |
if($0 !~ qr|s/u?mount\.t$|) { |
10 |
my ($reject) = 1; |
11 |
if(-f $_pidfile) { |
12 |
unless(system("ps `cat $_pidfile` | grep \"$_loop $_point\" >/dev/null")>>8) { |
13 |
if(`mount | grep "on $_point"`) { |
14 |
$reject = 0; |
15 |
} else { |
16 |
system("kill `cat $_pidfile`"); |
17 |
} |
18 |
} |
19 |
} |
20 |
$reject = 1 if (system("ls $_point >&/dev/null") >> 8); |
21 |
die "not properly mounted\n" if $reject; |
22 |
} |
23 |
1; |