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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 112 - (hide annotations)
Thu Nov 15 09:32:08 2007 UTC (16 years, 5 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 mszeredi 4 #!/usr/bin/perl -w
2     use test::helper qw($_point $_loop $_real $_pidfile);
3     use strict;
4     use Test::More tests => 3;
5 dpavlin 112
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 mszeredi 4 ok(-f $_loop,"loopback exists");
13    
14     if(!fork()) {
15     #close(STDIN);
16     close(STDOUT);
17     close(STDERR);
18 dpavlin 10 mkdir $_point;
19     mkdir $_real;
20 mszeredi 4 `echo $$ >test/s/mounted.pid`;
21 dpavlin 89 diag "mounting $_loop to $_point";
22 dpavlin 112 open STDOUT, '>', '/tmp/fusemnt.log';
23     open STDERR, '>&', \*STDOUT;
24 dpavlin 19 exec("perl -Iblib/lib -Iblib/arch $_loop $_point");
25 mszeredi 4 exit(1);
26     }
27 dpavlin 100
28     my ($success, $count) = (0,0);
29     while ($count++ < 50 && !$success) {
30     select(undef, undef, undef, 0.1);
31 dpavlin 112 ($success) = is_mounted();
32 dpavlin 100 }
33     diag "Mounted in ", $count/10, " secs";
34    
35 mszeredi 4 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