Commit 80a5e6db authored by Per Cederqvist's avatar Per Cederqvist
Browse files

Test for bug 1121: mark-as-read mishandles read texts in some

circumstances.  Also test that lyskomd can repair the problems
introduced by this bug.
parent c6911d36
# Test suite for lyskomd.
# Copyright (C) 1999, 2002-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 report bugs at http://bugzilla.lysator.liu.se/.
# Test for bug 1121: mark-as-read mishandles read texts in some
# circumstances. Also test that lyskomd can repair the problems
# introduced by this bug.
lyskomd_start
client_start 0
talk_to client 0
send "A3Hfoo\n"
simple_expect "LysKOM" "connected"
# Log in as administrator.
send "1000 80 0 { }\n"
simple_expect "=1000"
send "1001 62 5 [holl "gazonk"] 1\n"
simple_expect "=1001"
# Create a few texts.
send "1002 86 [holl "Text"] 1 { 0 5 } 0 { }\n"
simple_expect "=1002 1"
send "1003 86 [holl "Text"] 1 { 0 5 } 0 { }\n"
simple_expect "=1003 2"
send "1004 86 [holl "Text"] 1 { 0 5 } 0 { }\n"
simple_expect "=1004 3"
send "1005 86 [holl "Text"] 1 { 0 5 } 0 { }\n"
simple_expect "=1005 4"
send "1006 86 [holl "Text"] 1 { 0 5 } 0 { }\n"
simple_expect "=1006 5"
send "1007 86 [holl "Text"] 1 { 0 5 } 0 { }\n"
simple_expect "=1007 6"
send "1008 86 [holl "Text"] 1 { 0 5 } 0 { }\n"
simple_expect "=1008 7"
send "1009 86 [holl "Text"] 1 { 0 5 } 0 { }\n"
simple_expect "=1009 8"
# Check what is read.
send "1010 107 5 5 1 0\n"
simple_expect "=1010 0 $any_time 5 255 0 \\* 5 $any_time 00000000"
# Mark texts.
send "1011 27 5 4 { 1 3 4 8 }\n"
simple_expect "=1011"
send "1012 107 5 5 1 0\n"
simple_expect "=1012 0 $any_time 5 255 3 { 1 1 3 4 8 8 } 5 $any_time 00000000"
# Mark texts again. This triggers the bug.
send "1013 27 5 4 { 5 6 7 8 }\n"
simple_expect "=1013"
send "1014 107 5 5 1 0\n"
simple_expect "=1014 0 $any_time 5 255 2 { 1 1 3 8 } 5 $any_time 00000000"
# Save the database.
send "1015 42 255\n"
simple_expect "=1015"
# Shut down.
send "1016 42 255\n"
simple_expect "=1016"
send "1017 44 0\n"
simple_expect "=1017"
client_death 0
lyskomd_death
# Make sure we can read a broken database with no problem.
unpack_db bug-1121
dbck_run {
"fparse_read_range_0: discarded out-of-order local number 8 probably introduced by bug 1121"
}
lyskomd_start "" "" "" "" "" [list \
"WARN: [pwd]/db/number.txt: No such file" \
] 0 0 6 9 0 {
"fparse_read_range_0: discarded out-of-order local number 8 probably introduced by bug 1121"
}
# Log in as person 5. This reads the broken data into the core
# memory, and marks it as read, so that it is saved back once lyskomd
# terminates. The dbck that is run from lyskomd_death won't find any
# problems.
client_start 1
talk_to client 1
send "A3Hfoo\n"
simple_expect "LysKOM"
send "1018 80 0 { }\n"
simple_expect "=1018"
send "1019 0 5 [holl "gazonk"]\n"
lyskomd_expect "fparse_read_range_0: discarded out-of-order local number 8 probably introduced by bug 1121"
simple_expect "=1019"
system "kill -TERM $lyskomd_pid"
lyskomd_death "" signal
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