Parent Directory | Revision Log
From: Richard Dawe <rich(at)phekda(dot)gotadsl(dot)co(dot)uk> Please find attached a patch that allows Fuse.pm's test suite to run as a non-root user. It will skip all the tests that require root priveleges (giving away ownership using chown, mknod of character and block devices). The patch creates a test root and mount point per user. The patch also uses POSIX::WEXITSTATUS instead of the less portable "$? >> 8" idiom.
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 | exec("perl $_loop $_point"); |
16 | exit(1); |
17 | } |
18 | select(undef, undef, undef, 0.5); |
19 | my ($success) = `cat /proc/mounts` =~ / $_point /; |
20 | ok($success,"mount succeeded"); |
21 | system("rm -rf $_real"); |
22 | unless($success) { |
23 | kill('INT',`cat $_pidfile`); |
24 | unlink($_pidfile); |
25 | } else { |
26 | mkdir($_real); |
27 | } |
ViewVC Help | |
Powered by ViewVC 1.1.26 |