Commit 8f262175 authored by Per Cederqvist's avatar Per Cederqvist
Browse files

New test suite. Test that nothing is read from a disabled client, and

that the output queue fills up properly.
parent eacba863
# Test suite for lyskomd.
# Copyright (C) 2005 Lysator Academic Computer Association.
#
# This file is part of the LysKOM server.
#
# LysKOM is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 1, or (at your option)
# any later version.
#
# LysKOM is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
# You should have received a copy of the GNU General Public License
# along with LysKOM; see the file COPYING. If not, write to
# Lysator, c/o ISY, Linkoping University, S-581 83 Linkoping, SWEDEN,
# or the Free Software Foundation, Inc., 675 Mass Ave, Cambridge,
# MA 02139, USA.
#
# Please report bugs at http://bugzilla.lysator.liu.se/.
# Test that nothing is read from a disabled client, and that the
# output queue fills up properly.
# Start lyskomd.
lyskomd_start
if {$debug_calls == 0} {
kill_lyskomd
unsupported "enable testing with configure --with-debug-calls"
} else {
# Connect session 1.
client_start 1
send "A[holl "one"]\n"
simple_expect "LysKOM" "connected"
send "1000 80 1 { 12 }\n"
simple_expect "=1000"
send "1001 89 [holl "Tester"] [holl "gazonkII"] 00000000 0 { }\n"
simple_expect "=1001 6"
send "1002 0 6 [holl "gazonkII"]\n"
simple_expect "=1002"
# Connect session 2
client_start 2
send "A[holl "two"]\n"
simple_expect "LysKOM" "connected"
send "1003 80 0 { }\n"
simple_expect "=1003"
send "1004 0 5 [holl "gazonk"]\n"
simple_expect "=1004"
# Send a message to session 1, just to make sure it works.
send "1005 53 6 [holl "testing"]\n"
simple_expect "=1005"
talk_to client 1
simple_expect ":3 12 6 5 [holl "testing"]"
# Disable session 1. Stop reading from session 1. Send stuff to it
# until we have a pending queue of output.
talk_to client 2
send "1006 1009 1 1\n"
simple_expect "=1006"
talk_to client 1
if {1} {
# Issue a get-time request.
send "850 35\n"
}
send "#suspend socket\n"
simple_expect "suspended" "" meta
talk_to client 2
set queuesize 0
set messages 0
while {$queuesize < 1000} {
send "900 53 6 [holl "this is a lengthy line of junk, that is supposed to fill the TCP buffer of client one as soon as possible while not being too long. This is message number $messages."]\n"
simple_expect "=900"
send "901 112 [holl "send-queue-bytes"]\n"
extracting_expect "=901 $any_num { ($any_num) $any* }" queuesize 1
set messages [expr 1 + $messages]
}
send_user "TCP buffer filled up after $messages messages.\n"
talk_to client 2
send "1007 1009 1 0\n"
simple_expect "=1007"
talk_to client 1
send "#resume socket\n"
simple_expect "resumed" "" meta
for {set msg 0} {$msg < $messages} {set msg [expr 1 + $msg]} {
simple_expect ":3 12 6 5 [holl "this is a lengthy line of junk, that is supposed to fill the TCP buffer of client one as soon as possible while not being too long. This is message number $msg."]"
}
if {1} {
simple_expect "=850 $any_time"
}
# Shut down.
talk_to client 2
send "1008 42 255\n"
simple_expect "=1008"
send "1009 44 0\n"
simple_expect "=1009"
client_death 1
client_death 2
lyskomd_death
}
Markdown is supported
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