LINUX: dcache updates for mkdir and sillyrename
[openafs.git] / tests / ptserver / pt_util-t
1 #!/usr/bin/perl
2
3 use strict;
4 use warnings;
5
6 use File::Basename;
7 use Test::More tests=>2;
8
9 my $builddir = $ENV{BUILD};
10 if (!$builddir) {
11   $builddir = dirname($0)."/..";
12 }
13
14 $builddir.="/..";
15
16 my $prdbfile = "/tmp/prdbtest.$$";
17
18 my $instructions = <<EOF;
19 admin 128/20 1 -204 -204
20 system:administrators 130/20 -204 -204 -204
21  admin 1
22 EOF
23
24 my $expected = <<EOF;
25 admin      128/20 1 -204 -204
26 anonymous  128/20 32766 -204 -204
27 system:backup 2/0 -205 -204 -204
28 system:administrators 130/20 -204 -204 -204
29    admin    1
30 system:ptsviewers 2/0 -203 -204 -204
31 system:authuser 2/0 -102 -204 -204
32 system:anyuser 2/0 -101 -204 -204
33 EOF
34
35 my $fh;
36
37 open $fh, '|-', "$builddir/src/ptserver/pt_util", '-w', '-p', $prdbfile
38    or die "Failed to start pt_util for DB creation\n";
39 print $fh $instructions;
40 close($fh)
41    or die "pt util failed while creating DB\n";
42
43 open $fh, '-|', "$builddir/src/ptserver/pt_util", '-p', $prdbfile,
44                                      '-user', '-group', '-members'
45     or die "Failed to start pt_util for DB reading\n";
46
47 my $output = join('', readline($fh));
48 close($fh)
49     or die "pt_util failed while reading from DB\n";
50 is($output, $expected, "pt_util produced expected output");
51 ok(1, "Completed sucessfully");
52
53 unlink($prdbfile);