Skip to content

Commit 3121d45

Browse files
manuelmtonycoz
authored andcommitted
Add test for perl #134169
1 parent 79e302e commit 3121d45

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

t/op/groups.t

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ sub Test {
5151
my %basegroup = basegroups( $pwgid, $pwgnam );
5252
my @extracted_supplementary_groups = remove_basegroup( \ %basegroup, \ @extracted_groups );
5353

54-
plan 2;
54+
plan 3;
5555

5656

5757
# Test: The supplementary groups in $( should match the
@@ -121,6 +121,26 @@ sub Test {
121121
$gid_count->{0} //= 0;
122122
ok 0 == $pwgid || $gid_count->{0} < 2, "groupstype should be type short, not long";
123123

124+
SKIP: {
125+
# try to add a group as supplementary group
126+
my $root_uid = 0;
127+
skip "uid!=0", 1 if $< != $root_uid and $> != $root_uid;
128+
my @groups = split ' ', $);
129+
my @sup_group;
130+
setgrent;
131+
while(my @ent = getgrent) {
132+
next if grep { $_ == $ent[2] } @groups;
133+
@sup_group = @ent;
134+
last;
135+
}
136+
endgrent;
137+
skip "No group found we could add as a supplementary group", 1
138+
if (!@sup_group);
139+
$) = "$) @sup_group[2]";
140+
my $ok = grep { $_ == $sup_group[2] } split ' ', $);
141+
ok $ok, "Group `$sup_group[0]' added as supplementary group";
142+
}
143+
124144
return;
125145
}
126146

0 commit comments

Comments
 (0)