Merge from TNG.
[samba.git] / testsuite / nsswitch / getgrent_r.exp
1 #
2 # @(#) Test multiple threads can enumerate groups correctly
3 #
4
5 load_lib util-defs.exp
6 load_lib "$srcdir/config/env.exp"
7 load_lib "$srcdir/config/default-nt-names.exp"
8
9 # Compile getgrent_r.c
10
11 set output [target_compile "$srcdir/$subdir/getgrent_r.c" \
12         "$srcdir/$subdir/getgrent_r" executable {additional_flags="-g"}]
13
14 if {$output != ""} {
15     perror "compile getgrent_r"
16     puts $output
17     return
18 }
19
20 # Clean up output from previous tests
21
22 set pid [pid]
23 file delete [glob -nocomplain "/tmp/getgrent_r-$pid.out-*"]
24
25 # Run test proggy
26
27 set output [util_start "$srcdir/$subdir/getgrent_r" "$pid" ""]
28 if {![regexp "^PASS:" $output]} {
29     perror "run getgrent_r"
30     puts $output
31     return -1
32 }
33
34 # Sort and compare output
35
36 set output [util_start "$srcdir/$subdir/getent_r.sh" "getgrent $pid" ""]
37 if {$output == ""} {
38     pass "getgrent_r"
39 } else {
40     fail "getgrent_r"
41     puts $output
42 }