bug-52.exp 3.55 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
# Test suite for lyskomd.
# Copyright (C) 2001-2002  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. 


# Check that the read-text part of a membership can be saved and
# restored.

obtain_lock

unpack_db bug-52

proc start {} {
    lyskomd_start "" "Garb: no" "" "" "" [list \
	"WARN: [pwd]/db/number.txt: No such file" \
        ] 0 0 6 21 1
    client_start 0
    talk_to client 0
    send "A3Hfoo\n"
    simple_expect "LysKOM"
    send "1000 62 5 [holl "gazonk"] 0\n"
    simple_expect ":2 9 5 1"
    simple_expect "=1000"
}

proc stop {} {
    global lyskomd_pid

    system "kill -HUP $lyskomd_pid"
    lyskomd_death {} signal
    client_death 0

    dbck_run
}

proc checkit {pos conf prio last arrsize array} {
    global any_time

    send "1 99 5 $pos 1 0\n"
    simple_expect "=1 1 { $pos $any_time $conf $prio $last $arrsize \\* 5 $any_time 00000000 }"
    send "2 99 5 $pos 1 1\n"
    simple_expect "=2 1 { $pos $any_time $conf $prio $last $arrsize $array 5 $any_time 00000000 }"
    send "3 98 5 $conf\n"
    simple_expect "=3 $pos $any_time $conf $prio $last $arrsize $array 5 $any_time 00000000"
    send "4 46 5 $pos 1 0\n"
    simple_expect "=4 1 { $any_time $conf $prio $last $arrsize \\* }"
    send "5 46 5 $pos 1 1\n"
    simple_expect "=5 1 { $any_time $conf $prio $last $arrsize $array }"
    send "6 9 5 $conf\n"
    simple_expect "=6 $any_time $conf $prio $last $arrsize $array"
}


start
checkit 0 5 255 0 0 "\\*"
checkit 1 1 100 0 0 "\\*"
checkit 2 2 100 0 0 "\\*"
checkit 3 3 100 0 0 "\\*"
checkit 4 4 100 0 0 "\\*"
stop

start
checkit 0 5 255 0 0 "\\*"
checkit 1 1 100 0 0 "\\*"
checkit 2 2 100 0 0 "\\*"
checkit 3 3 100 0 0 "\\*"
checkit 4 4 100 0 0 "\\*"

send "1000 27 5 1 { 2 }\n"
simple_expect "=1000"
send "1001 27 1 0 { }\n"
simple_expect "=1001"
send "1002 27 2 1 { 1 }\n"
simple_expect "=1002"
send "1003 27 3 2 { 1 2 }\n"
simple_expect "=1003"
send "1004 27 4 2 { 1 3 }\n"
simple_expect "=1004"

checkit 0 5 255 0 1 "{ 2 }"
checkit 1 1 100 0 0 "\\*"
checkit 2 2 100 1 0 "\\*"
checkit 3 3 100 2 0 "\\*"
checkit 4 4 100 1 1 "{ 3 }"
stop

start
checkit 0 5 255 0 1 "{ 2 }"
checkit 1 1 100 0 0 "\\*"
checkit 2 2 100 1 0 "\\*"
checkit 3 3 100 2 0 "\\*"
checkit 4 4 100 1 1 "{ 3 }"

send "1000 27 5 1 { 4 }\n"
simple_expect "=1000"
send "1001 27 1 2 { 2 4 }\n"
simple_expect "=1001"
send "1002 27 2 1 { 2 }\n"
simple_expect "=1002"
send "1003 27 3 2 { 4 3 }\n"
simple_expect "=1003"
send "1004 27 4 2 { 5 6 }\n"
simple_expect "=1004"

checkit 0 5 255 0 2 "{ 2 4 }"
checkit 1 1 100 0 2 "{ 2 4 }"
checkit 2 2 100 2 0 "\\*"
checkit 3 3 100 4 0 "\\*"
checkit 4 4 100 1 3 "{ 3 5 6 }"
stop

start
checkit 0 5 255 0 2 "{ 2 4 }"
checkit 1 1 100 0 2 "{ 2 4 }"
checkit 2 2 100 2 0 "\\*"
checkit 3 3 100 4 0 "\\*"
checkit 4 4 100 1 3 "{ 3 5 6 }"
stop

release_lock