Commit 1c8ee7d7 authored by Per Cederqvist's avatar Per Cederqvist
Browse files

New file. Test keep-commented handling.

parent cbbdc497
# 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 keep-commented.
#
# Persons:
# 5: admin
#
# Conferences:
# 6: garb_nice=77, keep_commented=6
# 7: garb_nice=77, keep_commented=7
# 8: garb_nice=77, keep_commented=8
# 9: garb_nice=77, keep_commented=9
# 10: garb_nice=77, keep_commented=0
#
# Texts:
# 1: recip={6, 8}
# 2: recip={6, 9}, comm_to=1
# 3: recip={9, 6}, comm_to=1, sent later
# 4: recip={10}
# 5: recip={10}, footn_to=4
# 6: recip={10}, comm_to=4, sent later
# 7: recip={10}
# 8: recip={7}, comm_to=7
# 9: recip={7}
# 10: recip={10}, comm_to=9
# 11: recip={10}
# 12: recip={7}, comm_to=11, sent later
# 13: recip={7}
# 14: recip={10}, footn_to=13, sent later
# 15: recip={10}
# 16: recip={10}, footn_to=15
#
# "sent later" means that the comment link has a sent_at item.
proc run_garb {removed} {
global any
global any_time
# Run the garb and make sure that the texts mentioned in REMVOED
# are removed.
send "999 1003\n"
lyskomd_expect "MSG: garb restarted."
simple_expect "=999"
lyskomd_expect "MSG: garb started."
lyskomd_expect "MSG: garb ready. [llength $removed] texts deleted."
foreach r $removed {
simple_expect ":18 14 $r $any*"
}
simple_expect ":1 1000 [llength $removed]"
# Check that no other async messages were produced.
send "998 35\n"
simple_expect "=998 $any_time"
}
lyskomd_start
# Log in as admin.
client_start 0
send "A[holl "foo"]\n"
simple_expect "LysKOM" "connected"
if {$debug_calls} {
send "1000 80 2 { 14 1000 }\n"
simple_expect "=1000"
}
send "1000 0 5 [holl "gazonk"]\n"
simple_expect "=1000"
# Create conferences.
send "1001 88 [holl "6"] 00000000 0 { }\n"
simple_expect "=1001 6"
send "1002 88 [holl "7"] 10100000 0 { }\n"
simple_expect "=1002 7"
send "1003 88 [holl "8"] 00000000 0 { }\n"
simple_expect "=1003 8"
send "1004 88 [holl "9"] 10100000 0 { }\n"
simple_expect "=1004 9"
send "1005 88 [holl "10"] 10100000 0 { }\n"
simple_expect "=1005 10"
# Set keep_commented.
send "1006 105 6 6\n"
simple_expect "=1006"
send "1007 105 7 7\n"
simple_expect "=1007"
send "1008 105 8 8\n"
simple_expect "=1008"
send "1009 105 9 9\n"
simple_expect "=1009"
send "1010 105 10 0\n"
simple_expect "=1010"
# Join the conferences.
send "1011 100 6 5 200 1 00000000\n"
simple_expect "=1011"
send "1012 100 7 5 200 2 00000000\n"
simple_expect "=1012"
send "1013 100 8 5 200 3 00000000\n"
simple_expect "=1013"
send "1014 100 9 5 200 4 00000000\n"
simple_expect "=1014"
send "1015 100 10 5 200 5 00000000\n"
simple_expect "=1015"
# Create the texts.
send "1016 86 [holl "text 1"] 2 { 0 6 0 8 } 0 { }\n"
simple_expect "=1016 1"
send "1017 86 [holl "text 2"] 3 { 0 6 0 9 2 1 } 0 { }\n"
simple_expect "=1017 2"
send "1018 86 [holl "text 3"] 2 { 0 9 0 6 } 0 { }\n"
simple_expect "=1018 3"
send "1019 86 [holl "text 4"] 1 { 0 10 } 0 { }\n"
simple_expect "=1019 4"
send "1020 86 [holl "text 5"] 2 { 0 10 4 4 } 0 { }\n"
simple_expect "=1020 5"
send "1021 86 [holl "text 6"] 1 { 0 10 } 0 { }\n"
simple_expect "=1021 6"
send "1022 86 [holl "text 7"] 1 { 0 10 } 0 { }\n"
simple_expect "=1022 7"
send "1023 86 [holl "text 8"] 2 { 0 7 2 7 } 0 { }\n"
simple_expect "=1023 8"
send "1024 86 [holl "text 9"] 1 { 0 7 } 0 { }\n"
simple_expect "=1024 9"
send "1025 86 [holl "text 10"] 2 { 0 10 2 9 } 0 { }\n"
simple_expect "=1025 10"
send "1026 86 [holl "text 11"] 1 { 0 10 } 0 { }\n"
simple_expect "=1026 11"
send "1027 86 [holl "text 12"] 1 { 0 7 } 0 { }\n"
simple_expect "=1027 12"
send "1028 86 [holl "text 13"] 1 { 0 7 } 0 { }\n"
simple_expect "=1028 13"
send "1029 86 [holl "text 14"] 1 { 0 10 } 0 { }\n"
simple_expect "=1029 14"
send "1030 86 [holl "text 15"] 1 { 0 10 } 0 { }\n"
simple_expect "=1030 15"
send "1031 86 [holl "text 16"] 2 { 0 10 4 15 } 0 { }\n"
simple_expect "=1031 16"
# Add links.
send "1032 32 3 1\n"
simple_expect "=1032"
send "1033 32 6 4\n"
simple_expect "=1033"
send "1034 32 12 11\n"
simple_expect "=1034"
send "1035 37 14 13\n"
simple_expect "=1035"
if {$debug_calls} {
set leafs {2 3 5 6 8 10 12 14 16}
run_garb {}
# Backdate the root texts (texts 1, 4, 7, 9, 11, 13, 15), so that
# they would be removed by the garb, if not for keep-commented.
send "1036 1002 1 [expr {78 * 24 * 3600}]\n"
simple_expect "=1036"
send "1037 1002 4 [expr {78 * 24 * 3600}]\n"
simple_expect "=1037"
send "1038 1002 7 [expr {78 * 24 * 3600}]\n"
simple_expect "=1038"
send "1039 1002 9 [expr {78 * 24 * 3600}]\n"
simple_expect "=1039"
send "1040 1002 11 [expr {78 * 24 * 3600}]\n"
simple_expect "=1040"
send "1041 1002 13 [expr {78 * 24 * 3600}]\n"
simple_expect "=1041"
send "1042 1002 15 [expr {78 * 24 * 3600}]\n"
simple_expect "=1042"
run_garb {}
# Backdate the leaf texts (the other texts) 1 day + 1 second.
# This isn't enough to make the garb remove them, but text 15 will
# no longer be protected by its footnote.
foreach t $leafs {
send "1043 1002 $t [expr {1 * 24 * 3600 + 1}]\n"
simple_expect "=1043"
}
run_garb {15}
# Backdate the leaf texts (the other texts) four more days, for a
# total of at least 5 days + 1 second.
# This isn't enough to make the garb remove them.
foreach t $leafs {
send "1044 1002 $t [expr {4 * 24 * 3600}]\n"
simple_expect "=1044"
}
run_garb {}
# Backdate the leaf texts (the other texts) one more day, for a
# total of at least 6 days + 1 second.
# This isn't enough to make the garb remove any text.
foreach t $leafs {
send "1045 1002 $t [expr {1 * 24 * 3600}]\n"
simple_expect "=1045"
}
run_garb {}
# Backdate the leaf texts (the other texts) one more day, for a
# total of at least 7 days + 1 second.
# This will cause 7 and 9 to be deleted.
foreach t $leafs {
send "1046 1002 $t [expr {1 * 24 * 3600}]\n"
simple_expect "=1046"
}
run_garb {7 9}
# Backdate the leaf texts (the other texts) one more day, for a
# total of at least 8 days + 1 second.
# Nothing new will be deleted.
foreach t $leafs {
send "1047 1002 $t [expr {1 * 24 * 3600}]\n"
simple_expect "=1047"
}
run_garb {}
# Backdate the leaf texts (the other texts) one more day, for a
# total of at least 9 days + 1 second.
# Nothing new will be deleted.
foreach t $leafs {
send "1048 1002 $t [expr {1 * 24 * 3600}]\n"
simple_expect "=1048"
}
run_garb {}
# Backdate the sent_at links just enough that the texts are still
# protected.
send "1049 1007 1 3 [expr {8 * 24 * 3600 + 1}]\n"
simple_expect "=1049"
send "1050 1007 4 6 [expr {0 * 24 * 3600 + 1}]\n"
simple_expect "=1050"
send "1051 1007 11 12 [expr {6 * 24 * 3600 + 1}]\n"
simple_expect "=1051"
send "1052 1007 13 14 [expr {6 * 24 * 3600 + 1}]\n"
simple_expect "=1052"
run_garb {}
# Backdate the sent_at links one more day. They no longer offer any
# protection, so all remaining roots are removed.
send "1053 1007 1 3 [expr {1 * 24 * 3600}]\n"
simple_expect "=1053"
send "1054 1007 4 6 [expr {1 * 24 * 3600}]\n"
simple_expect "=1054"
send "1055 1007 11 12 [expr {1 * 24 * 3600}]\n"
simple_expect "=1055"
send "1056 1007 13 14 [expr {1 * 24 * 3600}]\n"
simple_expect "=1056"
run_garb {1 4 11 13}
# Nothing should happen if we run the garb again.
run_garb {}
} else {
unsupported "testing the keep-commented -- use configure --with-debug-calls to enable"
}
# Shut down.
send "1057 42 255\n"
simple_expect "=1057"
send "1058 44 0\n"
simple_expect "=1058"
client_death 0
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