diff options
author | Tim Potter <tpot@samba.org> | 2001-05-09 04:59:49 +0000 |
---|---|---|
committer | Tim Potter <tpot@samba.org> | 2001-05-09 04:59:49 +0000 |
commit | dcc39ea43984fe9f9c683e48423794793a923e28 (patch) | |
tree | cfccda702e3f50fa6da408c42937f1007abee49e /testsuite/nsswitch/getent.exp | |
parent | 9de17c5c3892930d6d1d349df63e2c4206787ceb (diff) | |
download | samba-dcc39ea43984fe9f9c683e48423794793a923e28.tar.gz samba-dcc39ea43984fe9f9c683e48423794793a923e28.tar.xz samba-dcc39ea43984fe9f9c683e48423794793a923e28.zip |
Cleaned up bitrot in nsswitch testsuite. Merged tests across from TNG
branch.
(This used to be commit acef477383e5739292e764c17cef87822a09f13b)
Diffstat (limited to 'testsuite/nsswitch/getent.exp')
-rw-r--r-- | testsuite/nsswitch/getent.exp | 141 |
1 files changed, 126 insertions, 15 deletions
diff --git a/testsuite/nsswitch/getent.exp b/testsuite/nsswitch/getent.exp index fcd98670b8..72bf2ea1eb 100644 --- a/testsuite/nsswitch/getent.exp +++ b/testsuite/nsswitch/getent.exp @@ -3,35 +3,146 @@ # load_lib util-defs.exp -load_lib "$srcdir/config/env.exp" -load_lib "$srcdir/config/default-nt-names.exp" +load_lib compile.exp +load_lib $srcdir/lib/nsswitch-config.exp # -# Test getent passwd +# @(#) Test getent passwd returns domain users # -set output [util_start "getent" "passwd" ""] +set wbinfo_output [util_start "bin/wbinfo" "-u"] +set getent_output [util_start "getent" "passwd" ""] -# Test output for domain users +if { ![regexp "$domain/" $getent_output] } { + fail "no domain users in getent passwd" + return +} + +if { [regexp "Error" $wbinfo_output] } { + fail "wbinfo -u failed" + return +} + +# +# @(#) Test each user in the output of wbinfo is also in the output of +# @(#) getent. +# + +# Test wbinfo user names are in getent user names + +foreach { user } [split $wbinfo_output "\n"] { + + verbose "looking for $user" + + set test_desc "getent passwd does not contain $user" + + if { ![regexp "$user" $getent_output] } { + fail $test_desc + } else { + pass $test_desc + } +} + +# Test getent user names are in wbinfo user names + +foreach { user } [split $getent_output "\n"] { + + set user_info [split $user ":"] + set username [lindex $user_info 0] + + if { [regexp {^[^/]+/} $username] } { + + set test_desc "wbinfo -u does not contain $username" + + if { ![regexp "$username" $wbinfo_output] } { + fail $test_desc + } else { + pass $test_desc + } + } else { + verbose "ignoring non-domain user $username" + } +} + +# +# @(#) Test each group in the output of wbinfo is also in the output of +# @(#) getent. +# + +set wbinfo_output [util_start "bin/wbinfo" "-g"] +set getent_output [util_start "getent" "group" ""] + +if { ![regexp "$domain/" $getent_output] } { + fail "no domain groups in getent passwd" + return +} + +if { [regexp "Error" $wbinfo_output] } { + fail "wbinfo -g failed" + return +} + +# Test wbinfo group names are in getent group names + +foreach { group } [split $wbinfo_output "\n"] { + + verbose "looking for $group" + + set test_desc "getent group does not contain $group" + + if { ![regexp "$group" $getent_output] } { + fail $test_desc + } else { + pass $test_desc + } +} + +# Test getent group names are in wbinfo group names + +foreach { group } [split $getent_output "\n"] { + + set group_info [split $group ":"] + set groupname [lindex $group_info 0] -foreach {user} $domain_users { - if {![regexp "$user" $output]} { - fail "getent passwd $user" + if { [regexp {^[^/]+/} $groupname] } { + + set test_desc "wbinfo -g does not contain $groupname" + + if { ![regexp "$groupname" $wbinfo_output] } { + fail $test_desc + } else { + pass $test_desc + } } else { - pass "getent passwd $user" + verbose "ignoring non-domain group $groupname" } } # -# Test getent group +# @(#) Test out of order and repeat calls of pwent functions +# @(#) Test out of order and repeat calls of grent functions # -set output [util_start "getent" "group" ""] +set getent_tests [list \ + { "out of order pwent operations" "getent_pwent" } \ + { "out of order grent operations" "getent_grent" } \ + ] + +# Compile and run each test -foreach {group} $domain_groups { - if {![regexp "$group" $output]} { - fail "getent group $group" +foreach { test } $getent_tests { + set test_desc [lindex $test 0] + set test_file [lindex $test 1] + + simple_compile $test_file + set output [util_start "$srcdir/$subdir/$test_file" ] + + if { [regexp "PASS" $output] } { + pass $test_desc + file delete "$srcdir/$subdir/$test_file" "$srcdir/$subdir/$test_file.o" } else { - pass "getent group $group" + fail $test_desc + puts $output } + } |