/[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 100 - (show annotations)
Sun Jul 30 17:33:14 2006 UTC (17 years, 9 months ago) by dpavlin
File MIME type: application/x-troff
File size: 797 byte(s)
changes from Nick Waterman <laptop@noseynick.com> to fix race condition in
test/s/mount.t
1 #!/usr/bin/perl -w
2 use test::helper qw($_point $_loop $_real $_pidfile);
3 use strict;
4 use Test::More tests => 3;
5 ok(!(scalar grep(/ on $_point /,`cat /proc/mounts`)),"already mounted");
6 ok(-f $_loop,"loopback exists");
7
8 if(!fork()) {
9 #close(STDIN);
10 close(STDOUT);
11 close(STDERR);
12 mkdir $_point;
13 mkdir $_real;
14 `echo $$ >test/s/mounted.pid`;
15 diag "mounting $_loop to $_point";
16 exec("perl -Iblib/lib -Iblib/arch $_loop $_point");
17 exit(1);
18 }
19
20 my ($success, $count) = (0,0);
21 while ($count++ < 50 && !$success) {
22 select(undef, undef, undef, 0.1);
23 ($success) = `cat /proc/mounts` =~ / $_point /;
24 }
25 diag "Mounted in ", $count/10, " secs";
26
27 ok($success,"mount succeeded");
28 system("rm -rf $_real");
29 unless($success) {
30 kill('INT',`cat $_pidfile`);
31 unlink($_pidfile);
32 } else {
33 mkdir($_real);
34 }

  ViewVC Help
Powered by ViewVC 1.1.26