s3:modules: s/event_add_timed/tevent_add_timer
[Samba/gebeck_regimport.git] / testsuite / nsswitch / getgrgid.exp
blobc53749f26291bb198000b97b39c19522f653bb0c
2 # @(#) Test reverse lookup of group ids from getent match getgrgid() output
5 load_lib util-defs.exp
6 load_lib compile.exp
8 # Compile getgruid.c
10 simple_compile "getgrgid"
12 # Get list of gids using getent
14 set output [util_start "getent" "group" ""]
15 set got_entries 0
17 verbose $output
19 foreach {line} [split $output "\n"] {
21 # Process user
23 set grp_entry [split $line ":"]
24 set group [lindex $grp_entry 0]
26 if {[regexp {^[^/]+/} $group]} {
28 set got_entries 1
30 # Only lookup winbindd users
32 set gid [lindex $grp_entry 2]
34 # Test lookup of gid succeeds
36 set output [util_start "$srcdir/$subdir/getgrgid" "$gid" ""]
37 verbose $output
39 if {[regexp "PASS:" $output]} {
40 pass "getgrgid $gid ($group)"
41 } else {
42 fail "getgrgid $gid ($group)"
48 if {!$got_entries} {
49 perror "No domain groups returned from getent"