Commit 4ec6b02e authored by Per Cederqvist's avatar Per Cederqvist
Browse files

(client_start): Set up expect_active so that unexpected lines are reported.

(client_death): New proc.
parent b80cf90e
......@@ -152,8 +152,6 @@ proc lyskomd_start {} {
set pid [spawn ../lyskomd -d config/lyskomd-config]
set server_id $spawn_id
set expect_active($server_id) ""
set expect_always($server_id) ""
set expect_active($server_id) \
" -i $server_id eof { fail \"\$test (eof on lyskomd); wait\" }"
set expect_always($server_id) \
......@@ -202,10 +200,11 @@ proc client_start {nr} {
global expect_always
global expect_active
global srcdir
global deep_any
spawn python $srcdir/ localhost $clientport MRK:client$nr
set client_id($nr) $spawn_id
set expect_active($client_id($nr)) " "
set expect_active($client_id($nr)) " -i $client_id($nr) -re \"($deep_any*)$nl\" { fail \"\$test (unexpected line \$expect_out(1,string))\"; exp_continue } "
set expect_always($client_id($nr)) \
" -i $client_id($nr) eof { fail \"\$test (eof on client$nr); wait\" } -i $client_id($nr) buffer_full { fail \"\$test (buffer_full on client$nr)\" } "
......@@ -216,6 +215,34 @@ proc client_start {nr} {
simple_expect "Connected" "client connected" meta
proc client_death {nr} {
global client_id
global clientport
global spawn_id
global test
global nl
global expect_always
global expect_active
global srcdir
global deep_any
talk_to client $nr
simple_expect "EOF on socket" "client $nr got EOF from server" meta
send "die\n"
set test "client $nr closes pty"
expect {
eof { pass "$test"; wait }
unset test
unset expect_active($client_id($nr))
unset expect_always($client_id($nr))
unset spawn_id
proc talk_to {what {nr ""}} {
global spawn_id
global server_id
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment