/[fuse.before_github]/perl/trunk/test/chown.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/trunk/test/chown.t

Parent Directory Parent Directory | Revision Log Revision Log


Revision 10 - (show annotations)
Sun Mar 20 00:36:05 2005 UTC (17 years, 3 months ago) by dpavlin
File MIME type: application/x-troff
File size: 449 byte(s)
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
2 use test::helper qw($_real $_point);
3 use Test::More;
4 use English;
5 plan tests => 4;
6
7 my (@stat);
8 chdir($_point);
9 system("echo frog >file");
10
11 SKIP: {
12 skip('Need root to give away ownership', 4) unless ($UID == 0);
13
14 ok(chown(0,0,"file"),"set 0,0");
15 @stat = stat("file");
16 ok($stat[4] == 0 && $stat[5] == 0,"0,0");
17 ok(chown(1,1,"file"),"set 1,1");
18 @stat = stat("file");
19 ok($stat[4] == 1 && $stat[5] == 1,"1,1");
20 }
21
22 unlink("file");

  ViewVC Help
Powered by ViewVC 1.1.26