/[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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 112 - (show annotations)
Thu Nov 15 09:32:08 2007 UTC (16 years, 4 months ago) by dpavlin
File MIME type: application/x-troff
File size: 926 byte(s)
patch from Chris Dolan via rt.cpan.org #30631

This patch gets Fuse.pm to half-work on MacOSX with the current release
of MacFuse (v1.1.0).  By half-work, I mean that all of the directory
actions and file read actions work, but anything that involves writing a
file fails.  This appears to be because the latest MacFUSE implements
FUSE 2.6, which prefers to call CREATE instead of MKNOD.  Nonetheless,
recommend that something like this patch be included because it makes
read-only filesystems usable on Darwin systems.  Some of my changes
(like kill() instead of system("kill")) are improvements on any system.
												    I've tested only on my PowerPC G5 iMac running 10.4.

I intend to also try MacFUSE v0.4 via Fink, but that version is                                     
reportedly less stable than the latest MacFUSE.                                                     
1 #!/usr/bin/perl -w
2 use test::helper qw($_point $_loop $_real $_pidfile);
3 use strict;
4 use Test::More tests => 3;
5
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");
13
14 if(!fork()) {
15 #close(STDIN);
16 close(STDOUT);
17 close(STDERR);
18 mkdir $_point;
19 mkdir $_real;
20 `echo $$ >test/s/mounted.pid`;
21 diag "mounting $_loop to $_point";
22 open STDOUT, '>', '/tmp/fusemnt.log';
23 open STDERR, '>&', \*STDOUT;
24 exec("perl -Iblib/lib -Iblib/arch $_loop $_point");
25 exit(1);
26 }
27
28 my ($success, $count) = (0,0);
29 while ($count++ < 50 && !$success) {
30 select(undef, undef, undef, 0.1);
31 ($success) = is_mounted();
32 }
33 diag "Mounted in ", $count/10, " secs";
34
35 ok($success,"mount succeeded");
36 system("rm -rf $_real");
37 unless($success) {
38 kill('INT',`cat $_pidfile`);
39 unlink($_pidfile);
40 } else {
41 mkdir($_real);
42 }

  ViewVC Help
Powered by ViewVC 1.1.26