Fixed bug in canned results list for checking the error code of wbinfo.
[ira/wip.git] / testsuite / nsswitch / getgrgid.exp
1 #
2 # @(#) Test reverse lookup of group ids from getent match getgrgid() output
3 #
4
5 load_lib util-defs.exp
6 load_lib compile.exp
7
8 # Compile getgruid.c
9
10 simple_compile "getgrgid"
11
12 # Get list of gids using getent
13
14 set output [util_start "getent" "group" ""]
15 set got_entries 0
16
17 verbose $output
18
19 foreach {line} [split $output "\n"] {
20
21     # Process user
22
23     set grp_entry [split $line ":"]
24     set group [lindex $grp_entry 0]
25
26     if {[regexp {^[^/]+/} $group]} {
27
28         set got_entries 1
29
30         # Only lookup winbindd users
31
32         set gid [lindex $grp_entry 2]
33
34         # Test lookup of gid succeeds
35
36         set output [util_start "$srcdir/$subdir/getgrgid" "$gid" ""]
37         verbose $output
38
39         if {[regexp "PASS:" $output]} {
40             pass "getgrgid $gid ($group)"
41         } else {
42             fail "getgrgid $gid ($group)"
43         }            
44     }
45
46 }
47
48 if {!$got_entries} {
49     perror "No domain groups returned from getent"
50 }