44// file that was distributed with this source code.
55// spell-checker:ignore (words) nosuchgroup groupname
66
7+ #[ cfg( not( target_vendor = "apple" ) ) ]
8+ use rustix:: process:: getgroups;
79#[ cfg( target_os = "linux" ) ]
810use std:: os:: unix:: ffi:: OsStringExt ;
911use uucore:: process:: getegid;
@@ -299,9 +301,8 @@ fn test_big_h() {
299301#[ cfg( not( target_vendor = "apple" ) ) ]
300302fn basic_succeeds ( ) {
301303 let ( at, mut ucmd) = at_and_ucmd ! ( ) ;
302- let one_group = nix:: unistd:: getgroups ( ) . unwrap ( ) ;
303304 // if there are no groups we can't run this test.
304- if let Some ( group) = one_group . first ( ) {
305+ if let Some ( group) = getgroups ( ) . unwrap ( ) . first ( ) {
305306 at. touch ( "f1" ) ;
306307 ucmd. arg ( group. as_raw ( ) . to_string ( ) )
307308 . arg ( "f1" )
@@ -322,7 +323,7 @@ fn test_no_change() {
322323fn test_permission_denied ( ) {
323324 use std:: os:: unix:: prelude:: PermissionsExt ;
324325
325- if let Some ( group) = nix :: unistd :: getgroups ( ) . unwrap ( ) . first ( ) {
326+ if let Some ( group) = getgroups ( ) . unwrap ( ) . first ( ) {
326327 let ( at, mut ucmd) = at_and_ucmd ! ( ) ;
327328 at. mkdir ( "dir" ) ;
328329 at. touch ( "dir/file" ) ;
@@ -340,7 +341,7 @@ fn test_permission_denied() {
340341fn test_subdir_permission_denied ( ) {
341342 use std:: os:: unix:: prelude:: PermissionsExt ;
342343
343- if let Some ( group) = nix :: unistd :: getgroups ( ) . unwrap ( ) . first ( ) {
344+ if let Some ( group) = getgroups ( ) . unwrap ( ) . first ( ) {
344345 let ( at, mut ucmd) = at_and_ucmd ! ( ) ;
345346 at. mkdir ( "dir" ) ;
346347 at. mkdir ( "dir/subdir" ) ;
@@ -358,7 +359,7 @@ fn test_subdir_permission_denied() {
358359#[ cfg( not( target_vendor = "apple" ) ) ]
359360fn test_traverse_symlinks ( ) {
360361 use std:: os:: unix:: prelude:: MetadataExt ;
361- let groups = nix :: unistd :: getgroups ( ) . unwrap ( ) ;
362+ let groups = getgroups ( ) . unwrap ( ) ;
362363 if groups. len ( ) < 2 {
363364 return ;
364365 }
@@ -431,7 +432,7 @@ fn test_from_option() {
431432 use std:: os:: unix:: fs:: MetadataExt ;
432433 let scene = TestScenario :: new ( util_name ! ( ) ) ;
433434 let at = & scene. fixtures ;
434- let groups = nix :: unistd :: getgroups ( ) . unwrap ( ) ;
435+ let groups = getgroups ( ) . unwrap ( ) ;
435436 // Skip test if we don't have at least two different groups to work with
436437 if groups. len ( ) < 2 {
437438 return ;
@@ -495,7 +496,7 @@ fn test_from_with_invalid_group() {
495496fn test_verbosity_messages ( ) {
496497 let scene = TestScenario :: new ( util_name ! ( ) ) ;
497498 let at = & scene. fixtures ;
498- let groups = nix :: unistd :: getgroups ( ) . unwrap ( ) ;
499+ let groups = getgroups ( ) . unwrap ( ) ;
499500 // Skip test if we don't have at least one group to work with
500501 if groups. is_empty ( ) {
501502 return ;
@@ -519,7 +520,7 @@ fn test_from_with_reference() {
519520 use std:: os:: unix:: fs:: MetadataExt ;
520521 let scene = TestScenario :: new ( util_name ! ( ) ) ;
521522 let at = & scene. fixtures ;
522- let groups = nix :: unistd :: getgroups ( ) . unwrap ( ) ;
523+ let groups = getgroups ( ) . unwrap ( ) ;
523524 if groups. len ( ) < 2 {
524525 return ;
525526 }
@@ -562,7 +563,7 @@ fn test_numeric_group_formats() {
562563 let scene = TestScenario :: new ( util_name ! ( ) ) ;
563564 let at = & scene. fixtures ;
564565
565- let groups = nix :: unistd :: getgroups ( ) . unwrap ( ) ;
566+ let groups = getgroups ( ) . unwrap ( ) ;
566567 if groups. len ( ) < 2 {
567568 return ;
568569 }
0 commit comments