41.exp 7.29 KB
Newer Older
Per Cederqvist's avatar
Per Cederqvist committed
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
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
# Test suite for lyskomd.
# Copyright (C) 2003  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 mail bug reports to bug-lyskom@lysator.liu.se. 

# Test async-new-motd.
#
# Persons:
#     5: admin
#     6: super: creator of 9 and 10
#     7: member: a member of 9 and 10
#     8: bystander: not a member
#
# Conferences:
#     9: public
#    10: secret
#
# Texts:
#     1: conf 1 as recipient
#     2: conf 1 as recipient
#     3: conf 10 as recipient
#     4: conf 10 as recipient

lyskomd_start

# Log in as admin, and enable.
client_start 5
send "A[holl "five"]\n"
simple_expect "LysKOM" "connected"
send "1000 80 1 { 21 }\n"
good_bad_expect "=1000" "%50 20"
send "1001 0 5 [holl "gazonk"]\n"
simple_expect "=1001"
send "1002 42 255\n"
simple_expect "=1002"

# Create person 6 and log in.
client_start 6
send "A[holl "six"]\n"
simple_expect "LysKOM" "connected"
send "1003 80 1 { 21 }\n"
good_bad_expect "=1003" "%50 20"
send "1004 89 [holl "super"] [holl "super"] 00000000 0 { }\n"
simple_expect "=1004 6"
send "1005 0 6 [holl "super"]\n"
simple_expect "=1005"

# Create person 7 and log in.
client_start 7
send "A[holl "seven"]\n"
simple_expect "LysKOM" "connected"
send "1006 80 1 { 21 }\n"
good_bad_expect "=1006" "%50 20"
send "1007 89 [holl "member"] [holl "member"] 00000000 0 { }\n"
simple_expect "=1007 7"
send "1008 0 7 [holl "member"]\n"
simple_expect "=1008"

# Create person 8 and log in.
client_start 8
send "A[holl "eight"]\n"
simple_expect "LysKOM" "connected"
send "1009 80 1 { 21 }\n"
good_bad_expect "=1009" "%50 20"
send "1010 89 [holl "bystander"] [holl "bystander"] 00000000 0 { }\n"
simple_expect "=1010 8"
send "1011 0 8 [holl "bystander"]\n"
simple_expect "=1011"

# Create conferences 9 and 10, and let person 6 and 7 join them.
talk_to client 6
send "1012 88 [holl "public"] 00000000 0 { }\n"
simple_expect "=1012 9"
send "1013 88 [holl "secret"] 10100000 0 { }\n"
simple_expect "=1013 10"
send "1014 100 9 6 200 1 00000000\n"
simple_expect "=1014"
send "1015 100 9 7 200 1 00000000\n"
lyskomd_expect "Person 7 added to conference 9 by 6\."
simple_expect "=1015"
send "1016 100 10 6 200 1 00000000\n"
simple_expect "=1016"
send "1017 100 10 7 200 1 00000000\n"
lyskomd_expect "Person 7 added to conference 10 by 6\."
simple_expect "=1017"

# Person 7 accepts the invitations.
talk_to client 7
send "1018 100 9 7 200 1 00000000\n"
simple_expect "=1018"
send "1019 100 10 7 200 1 00000000\n"
simple_expect "=1019"

# Person 6 creates the four texts that will be used as motds.
talk_to client 6
send "1020 86 [holl "text 1"] 1 { 0 1 } 0 { }\n"
simple_expect "=1020 1"
send "1021 86 [holl "text 2"] 1 { 0 1 } 0 { }\n"
simple_expect "=1021 2"
send "1022 86 [holl "text 3"] 1 { 0 10 } 0 { }\n"
simple_expect "=1022 3"
send "1023 86 [holl "text 4"] 1 { 0 10 } 0 { }\n"
simple_expect "=1023 4"

# Set text 1 as motd of conference 9.
send "1024 17 9 1\n"
simple_expect ":3 21 9 0 1"
client_expect 5 ":3 21 9 0 1"
client_expect 7 ":3 21 9 0 1"
client_expect 8 ":3 21 9 0 1"
simple_expect "=1024"

# Set text 2 as motd of conference 9.
send "1025 17 9 2\n"
simple_expect ":3 21 9 1 2"
client_expect 5 ":3 21 9 1 2"
client_expect 7 ":3 21 9 1 2"
client_expect 8 ":3 21 9 1 2"
simple_expect "=1025"

# Set text 3 as motd of conference 9.  Since it isn't visible
# to the bystander, the bystander will think the motd has been
# removed.
send "1026 17 9 3\n"
simple_expect ":3 21 9 2 3"
client_extracting_expect 5 ":3 21 9 2 (0|3)" seen 1
setup_xfail "*-*-*" "Bug 178"
set test "administrator sees proper text"
if {$seen == 3} {
    pass "$test"
} else {
    fail "$test (filtered)"
}
unset test
client_expect 7 ":3 21 9 2 3"
client_expect 8 ":3 21 9 2 0"
simple_expect "=1026"

# Set text 4 as presentation of conference 9.  This text is also not
# visible to the bystander.  In the view of the bystander, the
# presentation changes from 0 to 0.  That is no change, so no async
# message is sent to the bystander.
send "1027 17 9 4\n"
simple_expect ":3 21 9 3 4"

# FIXME (bug 178): Due to bug 178, this message never appears.
#client_expect 5 ":3 21 9 3 4"
setup_xfail "*-*-*" "Bug 178"
fail "admin sees message"

client_expect 7 ":3 21 9 3 4"
simple_expect "=1027"

# View the conf-stat of conference 9.
send "1028 91 9\n"
simple_expect "=1028 [holl "public"] 00000000 $any_time $any_time 6 0 6 0 6 4 77 77 2 1 0 0 0 \\*"
talk_to client 5
send "1029 91 9\n"
simple_expect "=1029 [holl "public"] 00000000 $any_time $any_time 6 0 6 0 6 4 77 77 2 1 0 0 0 \\*"
talk_to client 7
send "1030 91 9\n"
simple_expect "=1030 [holl "public"] 00000000 $any_time $any_time 6 0 6 0 6 4 77 77 2 1 0 0 0 \\*"

talk_to client 8
send "1031 91 9\n"
extracting_expect "=1031 [holl "public"] 00000000 $any_time $any_time 6 0 6 0 6 ($any_num) 77 77 2 1 0 0 0 \\*" motd 1
setup_xfail "*-*-*" "Bug 1074"
set test "Unreadable motd filtered"
if {$motd == 0} {
    pass "$test"
} else {
    fail "$test (motd visible)"
    if {$motd != 4} {
	fail "$test (strange result $motd)"
    }
}
unset test

# Set text 1 as motd of conference 10.
talk_to client 6
send "1032 17 10 1\n"
simple_expect ":3 21 10 0 1"
client_expect 5 ":3 21 10 0 1"
client_expect 7 ":3 21 10 0 1"
simple_expect "=1032"

# Set text 2 as motd of conference 10.
send "1033 17 10 2\n"
simple_expect ":3 21 10 1 2"
client_expect 5 ":3 21 10 1 2"
client_expect 7 ":3 21 10 1 2"
simple_expect "=1033"

# Set text 3 as motd of conference 10.
# removed.
send "1034 17 10 3\n"
simple_expect ":3 21 10 2 3"
client_extracting_expect 5 ":3 21 10 2 (0|3)" seen 1
setup_xfail "*-*-*" "Bug 178"
set test "administrator sees proper text"
if {$seen == 3} {
    pass "$test"
} else {
    fail "$test (filtered)"
}
unset test
client_expect 7 ":3 21 10 2 3"
simple_expect "=1034"

# Set text 4 as motd of conference 10.
send "1035 17 10 4\n"
simple_expect ":3 21 10 3 4"

# FIXME (bug 178): Due to bug 178, this message never appears.
#client_expect 5 ":3 21 10 3 4"
setup_xfail "*-*-*" "Bug 178"
fail "admin sees message"

client_expect 7 ":3 21 10 3 4"
simple_expect "=1035"

# View the conf-stat of conference 10.
send "1036 91 10\n"
simple_expect "=1036 [holl "secret"] 10100000 $any_time $any_time 6 0 6 0 6 4 77 77 2 1 2 0 0 \\*"
talk_to client 5
send "1037 91 10\n"
simple_expect "=1037 [holl "secret"] 10100000 $any_time $any_time 6 0 6 0 6 4 77 77 2 1 2 0 0 \\*"
talk_to client 7
send "1038 91 10\n"
simple_expect "=1038 [holl "secret"] 10100000 $any_time $any_time 6 0 6 0 6 4 77 77 2 1 2 0 0 \\*"

talk_to client 8
send "1039 91 10\n"
simple_expect "%1039 9 10"

# Shut down.
talk_to client 5
send "1040 44 0\n"
simple_expect "=1040"
client_death 5
client_death 6
client_death 7
client_death 8

lyskomd_death