blob: f02116e1dafcb3652a99c2849839d62d5e95b3b0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
|
#
# $Id$
#
set kill /bin/kill
set sleep /bin/sleep
set kinit $KINIT
set kdestroy $KDESTROY
set hostname [exec hostname]
# Hack around Solaris 9 kernel race condition that causes last output
# from a pty to get dropped.
if { $PRIOCNTL_HACK } {
catch {exec priocntl -s -c FX -m 30 -p 30 -i pid [getpid]}
rename spawn oldspawn
proc spawn { args } {
upvar 1 spawn_id spawn_id
set newargs {}
set inflags 1
set eatnext 0
foreach arg $args {
if { $arg == "-ignore" \
|| $arg == "-open" \
|| $arg == "-leaveopen" } {
lappend newargs $arg
set eatnext 1
continue
}
if [string match "-*" $arg] {
lappend newargs $arg
continue
}
if { $eatnext } {
set eatnext 0
lappend newargs $arg
continue
}
if { $inflags } {
set inflags 0
set newargs [concat $newargs {priocntl -e -c FX -p 0}]
}
lappend newargs $arg
}
set pid [eval oldspawn $newargs]
return $pid
}
}
if { [string length $VALGRIND] } {
rename spawn valgrind_aux_spawn
proc spawn { args } {
global VALGRIND
upvar 1 spawn_id spawn_id
set newargs {}
set inflags 1
set eatnext 0
foreach arg $args {
if { $arg == "-ignore" \
|| $arg == "-open" \
|| $arg == "-leaveopen" } {
lappend newargs $arg
set eatnext 1
continue
}
if [string match "-*" $arg] {
lappend newargs $arg
continue
}
if { $eatnext } {
set eatnext 0
lappend newargs $arg
continue
}
if { $inflags } {
set inflags 0
# Only run valgrind for local programs, not
# system ones.
#&&![string match "/bin/sh" $arg] sh is used to start kadmind!
if [string match "/" [string index $arg 0]]&&![string match "/bin/ls" $arg]&&![regexp {/kshd$} $arg] {
set newargs [concat $newargs $VALGRIND]
} elseif [string match "." [string index $arg 0]] {
set newargs [concat $newargs $VALGRIND]
}
}
lappend newargs $arg
}
set pid [eval valgrind_aux_spawn $newargs]
return $pid
}
}
# this will initialize the database and keytab
load_lib "helpers.exp"
proc rpc_test_version {} {
global CLIENT
global SERVER
clone_output "$CLIENT version <unknown>"
clone_output "$SERVER version <unknown>"
}
proc rpc_test_load {} {
#
}
# rpc_test_exit -- clean up and exit
proc rpc_test_exit {} {
global server_id
global server_pid
global server_started
global kill
if { [info exists server_started] && $server_started == 0 } {
return
}
if {[catch {
expect {
-i $server_id
eof {
fail "server exited!"
verbose $expect_out(buffer) 1
}
timeout { pass "server survived" }
}
} tmp]} {
fail "server exited! (expect failed)"
}
}
#
# rpc_test_start -- start the rpc_test server running
#
proc rpc_test_start { } {
global SERVER PROT
global server_id
global server_pid
global server_started
global env
if [info exists server_pid] { rpc_test_exit }
set env(KRB5_KTNAME) FILE:$env(RPC_TEST_SRVTAB)
verbose "% $SERVER" 1
set server_pid [spawn $SERVER $PROT]
set server_id $spawn_id
set server_started 1
unset env(KRB5_KTNAME)
set timeout 30
expect {
"running" { }
"Cannot register service" {
send_error "Server cannot register with portmap/rpcbind!!\n"
note "+++"
note "+++ These tests require the ability to register with portmap/rpcbind"
note "+++ Either the server is not running or it does not"
note "+++ allow registration using a loopback connection"
note "+++"
verbose $expect_out(buffer) 1
set server_started 0
unsupported "Server registration"
return
}
eof {
send_error "server exited!"
verbose $expect_out(buffer) 1
}
timeout {
send_error "server didn't start in $timeout seconds"
verbose $expect_out(buffer) 1
}
}
}
set MULTIPASS {
{tcp PROT=-t dummy=[rpc_test_start]}
{udp PROT=-u dummy=[rpc_test_start]}
}
|