Commit 9af39922 authored by David Byers's avatar David Byers
Browse files

New file

parent 0cfe0807
# Test of protocol 10 async messages
#
# Preconditions:
# Person 5 exists, can enable to 255 and has password "gazonk"
# Membership functions work
#
read_versions
source "config/prot-a.exp"
# ----------------------------------------------------------------------
# startup_06 sets up the database and starts client 0
#
# The sample database
#
# Person 6 "P6"; supervisor 6; password pw1
# Person 7 "P7"; supervisor 6; password pw2
# Person 8 "P8"; supervisor 7; password pw3
# Person 13 "P13"; supervisor 8; password pw4
# Person 14 "P14"; supervisor 14; password pw5
# Set supervisor of P8 to P14
#
# Conference 9 "C9"; created by 7; rd_prot
# Conference 10 "C10"; created by 7; secret
# Conference 11 "C11"; created by 7; forbid_secret
# Conference 12 "C12"; created by 7; no flags
#
# Person 8 is a member of conference 12
# Person 13 is a passive member of conference 12
#
# Client 0 is logged on as person 8
# Client 1 is logged on as person 13
# Client 2 is logged on as person 5 with all bits enabled
# Client 3 is logged on as person 8
#
# No clients are accepting async messages
# ----------------------------------------------------------------------
proc startup_06 {} {
client_start 0
talk_to client 0
send "A[holl "DejaGnu test suite 1"]\n"
simple_expect "LysKOM"
kom_accept_async "0 { }"
# Set up some users
kom_create_person "P6" "pw1" "0 { }"
kom_create_person "P7" "pw2" "0 { }"
kom_logout
kom_create_person "P8" "pw3" "0 { }"
# Set up conferences
kom_logout
kom_login 7 "pw2" 0
kom_create_conference "C9" "10000000" "0 { }"
kom_create_conference "C10" "10100000" "0 { }"
kom_create_conference "C11" "00000100" "0 { }"
kom_create_conference "C12" "00000000" "0 { }"
# Set up more users
kom_logout
kom_login 8 "pw3" 0
kom_create_person "P13" "pw4" "0 { }"
kom_logout
kom_create_person "P14" "pw5" "0 { }"
kom_logout
kom_login 5 "gazonk" 0
kom_enable 255
kom_set_supervisor 8 14
# Set up memberships
kom_logout
kom_login 8 "pw3" 0
kom_add_member 12 8 200 0 "00000000"
kom_logout
kom_login 13 "pw4" 0
kom_add_member 12 13 200 0 "01000000"
# Set up the clients
# talk_to client 0
kom_logout
kom_login 8 "pw3" 0
client_start 1
talk_to client 1
send "A[holl "DejaGnu test suite 2"]\n"
simple_expect "LysKOM"
kom_accept_async "0 { }"
kom_login 13 "pw4" 0
client_start 2
talk_to client 2
send "A[holl "DejaGnu test suite 3"]\n"
simple_expect "LysKOM"
kom_accept_async "0 { }"
kom_login 5 "gazonk" 0
kom_enable 255
client_start 3
talk_to client 3
send "A[holl "DejaGnu test suite 2"]\n"
simple_expect "LysKOM"
kom_accept_async "0 { }"
kom_login 8 "pw3" 0
}
proc shutdown_06 {} {
talk_to client 0
kom_accept_async "0 { }"
talk_to client 1
kom_accept_async "0 { }"
talk_to client 2
kom_accept_async "0 { }"
talk_to client 3
kom_accept_async "0 { }"
talk_to client 1
kom_logout
talk_to client 2
kom_logout
talk_to client 3
kom_logout
talk_to client 0
kom_logout
kom_login 5 "gazonk" 0
kom_enable 255
send "9999 44 0\n"
simple_expect "=9999"
client_death 0
client_death 1
client_death 2
client_death 3
lyskomd_death
}
lyskomd_start
startup_06
# ======================================================================
# Test new-text message
# ----------------------------------------------------------------------
# Set up accept-async
talk_to client 0
kom_accept_async "13 { 5 6 7 8 9 11 12 13 14 15 16 17 18 }\n"
talk_to client 1
kom_accept_async "13 { 5 6 7 8 9 11 12 13 14 15 16 17 18 }\n"
talk_to client 2
kom_accept_async "13 { 5 6 7 8 9 11 12 13 14 15 16 17 18 }\n"
talk_to client 3
kom_accept_async "12 { 5 6 7 8 9 11 12 13 14 16 17 18 }\n"
# ----------------------------------------------------------------------
# Create a text in client 2
# Check that message is not sent to non-member
talk_to client 2
send "1000 86 [holl "Async test 1"] 1 { 0 12 } 0 { }\n"
simple_expect "=1000 1"
# Check that message is not sent to passive member
talk_to client 1
kom_ping_server
# Check that message is sent to active member
# Check that it uses a new-style text-stat FIXME
# Check that aux-items are OK FIXME
talk_to client 0
simple_expect ":18 15 1 $any_time 5 0 12 0 2 { 0 12 6 1 } 0 \\*"
kom_ping_server
# Check that message is blocked by accept-async
talk_to client 3
kom_ping_server
# ======================================================================
# Test new-text-old message
# ----------------------------------------------------------------------
# Set up accept-async
talk_to client 0
kom_accept_async "13 { 0 5 6 7 8 9 11 12 13 14 16 17 18 }\n"
talk_to client 1
kom_accept_async "13 { 0 5 6 7 8 9 11 12 13 14 16 17 18 }\n"
talk_to client 2
kom_accept_async "13 { 0 5 6 7 8 9 11 12 13 14 16 17 18 }\n"
talk_to client 3
kom_accept_async "12 { 5 6 7 8 9 11 12 13 14 16 17 18 }\n"
# ----------------------------------------------------------------------
# Create a text in client 2
# Check that message is not sent to non-member
talk_to client 2
send "1010 86 [holl "Async test 1"] 1 { 0 12 } 0 { }\n"
simple_expect "=1010 2"
# Check that message is not sent to passive member
talk_to client 1
kom_ping_server
# Check that message is sent to active member
# Check that it uses a new-style text-stat FIXME
# Check that aux-items are OK FIXME
talk_to client 0
simple_expect ":16 0 2 $any_time 5 0 12 0 2 { 0 12 6 2 }"
kom_ping_server
# Check that message is blocked by accept-async
talk_to client 3
kom_ping_server
# ======================================================================
# Test new-text-old message
# ----------------------------------------------------------------------
# Set up accept-async
talk_to client 0
kom_accept_async "14 { 0 5 6 7 8 9 11 12 13 14 15 16 17 18 }\n"
talk_to client 1
kom_accept_async "14 { 0 5 6 7 8 9 11 12 13 14 15 16 17 18 }\n"
talk_to client 2
kom_accept_async "14 { 0 5 6 7 8 9 11 12 13 14 15 16 17 18 }\n"
talk_to client 3
kom_accept_async "13 { 0 5 6 7 8 9 11 12 13 15 16 17 18 }\n"
# ----------------------------------------------------------------------
# Delete a text in client 2
# Check that the message is not sent to a non-member
talk_to client 2
send "1020 29 1\n"
simple_expect "=1020"
# Check that the message is not sent to a passive member
talk_to client 1
kom_ping_server
# Check that message is sent to active member
# Check the contents FIXME
talk_to client 0
simple_expect ":18 14 1 $any_time 5 0 12 0 2 { 0 12 6 1 } 0 \\*"
kom_ping_server
# Check that message is blocked by accept-async
talk_to client 3
kom_ping_server
# ======================================================================
# Test new-recipient message
# ----------------------------------------------------------------------
# Set up accept-async
talk_to client 0
kom_accept_async "14 { 0 5 6 7 8 9 11 12 13 14 15 16 17 18 }\n"
talk_to client 1
kom_accept_async "14 { 0 5 6 7 8 9 11 12 13 14 15 16 17 18 }\n"
talk_to client 2
kom_accept_async "14 { 0 5 6 7 8 9 11 12 13 14 15 16 17 18 }\n"
talk_to client 3
kom_accept_async "13 { 0 5 6 7 8 9 11 12 13 14 15 17 18 }\n"
# ----------------------------------------------------------------------
# Add a recipient to text 1 in client 2
# Check that the message is not sent to a non-member
talk_to client 2
send "1030 30 2 9 0\n"
simple_expect "=1030"
# Check that the message is not sent to a passive member
talk_to client 1
kom_ping_server
# Check that message is sent to active member
# Check the contents FIXME
talk_to client 0
simple_expect ":3 16 2 9 0"
kom_ping_server
# Check that message is blocked by accept-async
talk_to client 3
kom_ping_server
# ----------------------------------------------------------------------
# Change recipient type of conference 9 / text 1 in client 2
# Check that the message is not sent to a non-member
talk_to client 2
send "1031 30 2 9 1\n"
simple_expect "=1031"
# Check that the message is not sent to a passive member
talk_to client 1
kom_ping_server
# Check that message is sent to active member
# Check the contents FIXME
talk_to client 0
simple_expect ":3 16 2 9 1"
kom_ping_server
# Check that message is blocked by accept-async
talk_to client 3
kom_ping_server
# ======================================================================
# Test sub-recipient message
# ----------------------------------------------------------------------
# Set up accept-async
talk_to client 0
kom_accept_async "14 { 0 5 6 7 8 9 11 12 13 14 15 16 17 18 }\n"
talk_to client 1
kom_accept_async "14 { 0 5 6 7 8 9 11 12 13 14 15 16 17 18 }\n"
talk_to client 2
kom_accept_async "14 { 0 5 6 7 8 9 11 12 13 14 15 16 17 18 }\n"
talk_to client 3
kom_accept_async "13 { 0 5 6 7 8 9 11 12 13 14 15 16 18 }\n"
# ----------------------------------------------------------------------
# Remove a recipient of text 1 in client 2
# Check that the message is not sent to a non-member
talk_to client 2
send "1040 31 2 9\n"
simple_expect "=1040"
# Check that the message is not sent to a passive member
talk_to client 1
kom_ping_server
# Check that message is sent to active member
# Check the contents FIXME
talk_to client 0
simple_expect ":3 17 2 9 1"
kom_ping_server
# Check that message is blocked by accept-async
talk_to client 3
kom_ping_server
# ======================================================================
# Test new-membership message
# ----------------------------------------------------------------------
# Set up accept-async
talk_to client 0
kom_accept_async "14 { 0 5 6 7 8 9 11 12 13 14 15 16 17 18 }\n"
talk_to client 1
kom_accept_async "14 { 0 5 6 7 8 9 11 12 13 14 15 16 17 18 }\n"
talk_to client 2
kom_accept_async "14 { 0 5 6 7 8 9 11 12 13 14 15 16 17 18 }\n"
talk_to client 3
kom_accept_async "13 { 0 5 6 7 8 9 11 12 13 14 15 16 17 }\n"
# ----------------------------------------------------------------------
# Admin adds a membership to person 8
# Check that no async message is sent to others
talk_to client 2
send "1050 100 9 8 201 0 00000000\n"
simple_expect "=1050"
# Check that async message is not sent to supervisor
talk_to client 1
kom_ping_server
# Check that async message is sent to person
talk_to client 0
simple_expect ":2 18 8 9"
kom_ping_server
# Check that accept-async can block the message
talk_to client 3
kom_ping_server
# ----------------------------------------------------------------------
# Admin changes membership of person 8 in conference 12
# Check that no async message is sent to others
talk_to client 2
send "1051 100 9 8 202 0 00000000\n"
simple_expect "=1051"
# Check that async message is not sent to supervisor
talk_to client 1
kom_ping_server
# Check that async message is sent to person
talk_to client 0
simple_expect ":2 18 8 9"
kom_ping_server
# Check that accept-async can block the message
talk_to client 3
kom_ping_server
# ======================================================================
shutdown_06
#
# Memory leaks test suite
#
1000 : A (any) { }
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