Initial devel changes.
[p5sagit/p5-mst-13.2.git] / t / op / groups.t
CommitLineData
fe14fcc3 1#!./perl
2
c750a3ec 3if (-x '/usr/ucb/groups') {
4 $groups_command = '/usr/ucb/groups';
5} elsif (-x '/usr/bin/groups') {
6 $groups_command = '/usr/bin/groups';
7} else {
fe14fcc3 8 print "1..0\n";
9 exit 0;
10}
11
988174c1 12print "1..2\n";
13
14$pwgid = $( + 0;
15($pwgnam) = getgrgid($pwgid);
16@basegroup{$pwgid,$pwgnam} = (1,1);
17
18$seen{$pwgid}++;
fe14fcc3 19
20for (split(' ', $()) {
21 next if $seen{$_}++;
6e21c824 22 ($group) = getgrgid($_);
23 if (defined $group) {
24 push(@gr, $group);
25 }
26 else {
27 push(@gr, $_);
28 }
fe14fcc3 29}
988174c1 30
31$gr1 = join(' ', sort @gr);
32
c750a3ec 33$gr2 = join(' ', grep(!$basegroup{$_}++, sort split(' ',`$groups_command`)));
988174c1 34
35if ($gr1 eq $gr2) {
36 print "ok 1\n";
37}
38else {
39 print "#gr1 is <$gr1>\n";
40 print "#gr2 is <$gr2>\n";
41 print "not ok 1\n";
42}
43
44# multiple 0's indicate GROUPSTYPE is currently long but should be short
45
46if ($pwgid == 0 || $seen{0} < 2) {
47 print "ok 2\n";
48}
49else {
50 print "not ok 2 (groupstype should be type short, not long)\n";
51}