File: pt_util-t

package info (click to toggle)
openafs 1.8.14-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 42,972 kB
  • sloc: ansic: 455,934; xml: 66,858; perl: 11,967; makefile: 10,038; sh: 7,955; objc: 6,354; java: 5,638; cpp: 2,268; asm: 1,214; yacc: 441; tcl: 249; lex: 201; csh: 85
file content (53 lines) | stat: -rwxr-xr-x 1,227 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/perl

use strict;
use warnings;

use File::Basename;
use Test::More tests=>2;

my $builddir = $ENV{C_TAP_BUILD};
if (!$builddir) {
  $builddir = dirname($0)."/..";
}

$builddir.="/..";

my $prdbfile = "/tmp/prdbtest.$$";

my $instructions = <<EOF;
admin 128/20 1 -204 -204
system:administrators 130/20 -204 -204 -204
 admin 1
EOF

my $expected = <<EOF;
admin      128/20 1 -204 -204
anonymous  128/20 32766 -204 -204
system:backup 2/0 -205 -204 -204
system:administrators 130/20 -204 -204 -204
   admin    1
system:ptsviewers 2/0 -203 -204 -204
system:authuser 2/0 -102 -204 -204
system:anyuser 2/0 -101 -204 -204
EOF

my $fh;

open $fh, '|-', "$builddir/src/ptserver/pt_util", '-w', '-p', $prdbfile
   or die "Failed to start pt_util for DB creation\n";
print $fh $instructions;
close($fh)
   or die "pt util failed while creating DB\n";

open $fh, '-|', "$builddir/src/ptserver/pt_util", '-p', $prdbfile,
				     '-user', '-group', '-members'
    or die "Failed to start pt_util for DB reading\n";

my $output = join('', readline($fh));
close($fh)
    or die "pt_util failed while reading from DB\n";
is($output, $expected, "pt_util produced expected output");
ok(1, "Completed sucessfully");

unlink($prdbfile);