Commit f0713860 authored by Per Cederqvist's avatar Per Cederqvist
Browse files

Expand the test suite and prepare it for range-based information commands.

(lazy_expand): New variable.
(mark_as_read_atomic): New variable.
(do_restart): New variable.  This is currently set to 0 to hide
	known errors...
(restart): New proc.
(checkit): New argument: ranges.
parent 4c19affd
......@@ -25,6 +25,25 @@
# Check that the read-text part of a membership can be saved and
# restored.
# Set to 1 if testing version 2.0.7 or earlier, where the check for
# deleted texts only is performed at the end of the first interval.
set lazy_expand 0
# Set to 0 if testing version 2.0.7 or earlier, where mark-as-read
# processed each local number in turn, without checking for errors
# first.
set mark_as_read_atomic 1
# Set to 1 to repeatedly stop and start lyskomd, thus testing that we
# can save and restore the information about read texts. Set to 0 to
# speed up the test, at the cost of not testing everything that needs
# to be tested.
set do_restart 0
if {$do_restart == 0} {
untested "saving read-ranges to disk (Bug 52)"
}
obtain_lock
unpack_db bug-52
......@@ -52,38 +71,47 @@ proc stop {} {
dbck_run
}
proc checkit {pos conf prio last arrsize array} {
proc restart {} {
global do_restart
if {$do_restart} {
stop
start
}
}
proc checkit {pos conf prio last arrsize array ranges} {
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 }"
simple_expect "=1 1 { $pos $any_time $conf $prio $last $arrsize \\* 5 $any_time 00000000 }" "$last $arrsize $array"
send "2 99 5 $pos 1 1\n"
simple_expect "=2 1 { $pos $any_time $conf $prio $last $arrsize $array 5 $any_time 00000000 }"
simple_expect "=2 1 { $pos $any_time $conf $prio $last $arrsize $array 5 $any_time 00000000 }" "$last $arrsize $array"
send "3 98 5 $conf\n"
simple_expect "=3 $pos $any_time $conf $prio $last $arrsize $array 5 $any_time 00000000"
simple_expect "=3 $pos $any_time $conf $prio $last $arrsize $array 5 $any_time 00000000" "$last $arrsize $array"
send "4 46 5 $pos 1 0\n"
simple_expect "=4 1 { $any_time $conf $prio $last $arrsize \\* }"
simple_expect "=4 1 { $any_time $conf $prio $last $arrsize \\* }" "$last $arrsize $array"
send "5 46 5 $pos 1 1\n"
simple_expect "=5 1 { $any_time $conf $prio $last $arrsize $array }"
simple_expect "=5 1 { $any_time $conf $prio $last $arrsize $array }" "$last $arrsize $array"
send "6 9 5 $conf\n"
simple_expect "=6 $any_time $conf $prio $last $arrsize $array"
simple_expect "=6 $any_time $conf $prio $last $arrsize $array" "$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
checkit 0 5 255 0 0 "\\*" "0 \\*"
checkit 1 1 100 0 0 "\\*" "0 \\*"
checkit 2 2 100 0 0 "\\*" "0 \\*"
checkit 3 3 100 0 0 "\\*" "0 \\*"
checkit 4 4 100 0 0 "\\*" "0 \\*"
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 "\\*"
restart
checkit 0 5 255 0 0 "\\*" "0 \\*"
checkit 1 1 100 0 0 "\\*" "0 \\*"
checkit 2 2 100 0 0 "\\*" "0 \\*"
checkit 3 3 100 0 0 "\\*" "0 \\*"
checkit 4 4 100 0 0 "\\*" "0 \\*"
send "1000 27 5 1 { 2 }\n"
simple_expect "=1000"
......@@ -96,44 +124,300 @@ 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
checkit 0 5 255 0 1 "{ 2 }" "1 { 2 2 }"
checkit 1 1 100 0 0 "\\*" "0 \\*"
checkit 2 2 100 1 0 "\\*" "1 { 1 1 }"
checkit 3 3 100 2 0 "\\*" "1 { 1 2 }"
checkit 4 4 100 1 1 "{ 3 }" "2 { 1 1 3 3 }"
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 }"
restart
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 1 "{ 2 }" "1 { 2 2 }"
checkit 1 1 100 0 0 "\\*" "0 \\*"
checkit 2 2 100 1 0 "\\*" "1 { 1 1 }"
checkit 3 3 100 2 0 "\\*" "1 { 1 2 }"
checkit 4 4 100 1 1 "{ 3 }" "2 { 1 1 3 3 }"
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
send "1005 27 5 1 { 4 }\n"
simple_expect "=1005"
send "1006 27 1 2 { 2 4 }\n"
simple_expect "=1006"
send "1007 27 2 1 { 2 }\n"
simple_expect "=1007"
send "1008 27 3 2 { 4 3 }\n"
simple_expect "=1008"
send "1009 27 4 2 { 5 6 }\n"
simple_expect "=1009"
checkit 0 5 255 0 2 "{ 2 4 }" "2 { 2 2 4 4 }"
checkit 1 1 100 0 2 "{ 2 4 }" "2 { 2 2 4 4 }"
checkit 2 2 100 2 0 "\\*" "1 { 1 2 }"
checkit 3 3 100 4 0 "\\*" "1 { 1 4 }"
checkit 4 4 100 1 3 "{ 3 5 6 }" "3 { 1 1 3 3 5 6 }"
restart
checkit 0 5 255 0 2 "{ 2 4 }" "2 { 2 2 4 4 }"
checkit 1 1 100 0 2 "{ 2 4 }" "2 { 2 2 4 4 }"
checkit 2 2 100 2 0 "\\*" "1 { 1 2 }"
checkit 3 3 100 4 0 "\\*" "1 { 1 4 }"
checkit 4 4 100 1 3 "{ 3 5 6 }" "3 { 1 1 3 3 5 6 }"
send "1010 27 5 1 { 3 }\n"
simple_expect "=1010"
send "1011 27 1 2 { 8 6 }\n"
simple_expect "=1011"
send "1012 27 2 1 { 3 }\n"
simple_expect "=1012"
send "1013 27 3 7 { 7 8 9 11 12 14 18 }\n"
simple_expect "=1013"
send "1014 27 4 1 { 2 }\n"
simple_expect "=1014"
checkit 0 5 255 0 3 "{ 2 3 4 }" "1 { 2 4 }"
checkit 1 1 100 0 4 "{ 2 4 6 8 }" "4 { 2 2 4 4 6 6 8 8 }"
checkit 2 2 100 3 0 "\\*" "1 { 1 3 }"
checkit 3 3 100 4 7 "{ 7 8 9 11 12 14 18 }" "5 { 1 4 7 9 11 12 14 14 18 18 }"
checkit 4 4 100 3 2 "{ 5 6 }" "2 { 1 3 5 6 }"
restart
checkit 0 5 255 0 3 "{ 2 3 4 }" "1 { 2 4 }"
checkit 1 1 100 0 4 "{ 2 4 6 8 }" "4 { 2 2 4 4 6 6 8 8 }"
checkit 2 2 100 3 0 "\\*" "1 { 1 3 }"
checkit 3 3 100 4 7 "{ 7 8 9 11 12 14 18 }" "5 { 1 4 7 9 11 12 14 14 18 18 }"
checkit 4 4 100 3 2 "{ 5 6 }" "2 { 1 3 5 6 }"
send "1015 27 5 1 { 1 }\n"
simple_expect "=1015"
send "1016 27 1 1 { 1 }\n"
simple_expect "=1016"
send "1017 27 2 1 { 2 }\n"
simple_expect "=1017"
send "1018 27 3 1 { 13 }\n"
simple_expect "=1018"
send "1019 27 4 1 { 4 }\n"
simple_expect "=1019"
checkit 0 5 255 4 0 "\\*" "1 { 1 4 }"
checkit 1 1 100 2 3 "{ 4 6 8 }" "4 { 1 2 4 4 6 6 8 8 }"
checkit 2 2 100 3 0 "\\*" "1 { 1 3 }"
checkit 3 3 100 4 8 "{ 7 8 9 11 12 13 14 18 }" "4 { 1 4 7 9 11 14 18 18 }"
checkit 4 4 100 6 0 "\\*" "1 { 1 6 }"
restart
checkit 0 5 255 4 0 "\\*" "1 { 1 4 }"
checkit 1 1 100 2 3 "{ 4 6 8 }" "4 { 1 2 4 4 6 6 8 8 }"
checkit 2 2 100 3 0 "\\*" "1 { 1 3 }"
checkit 3 3 100 4 8 "{ 7 8 9 11 12 13 14 18 }" "4 { 1 4 7 9 11 14 18 18 }"
checkit 4 4 100 6 0 "\\*" "1 { 1 6 }"
send "1020 27 5 1 { 7 }\n"
simple_expect "=1020"
send "1021 27 1 3 { 3 5 7 }\n"
simple_expect "=1021"
send "1022 27 2 1 { 8 }\n"
simple_expect "=1022"
send "1023 27 3 1 { 16 }\n"
simple_expect "=1023"
send "1024 40 4 20\n"
simple_expect "=1024"
checkit 0 5 255 4 1 "{ 7 }" "2 { 1 4 7 7 }"
checkit 1 1 100 8 0 "\\*" "1 { 1 8 }"
checkit 2 2 100 3 1 "{ 8 }" "2 { 1 3 8 8 }"
checkit 3 3 100 4 9 "{ 7 8 9 11 12 13 14 16 18 }" \
"5 { 1 4 7 9 11 14 16 16 18 18 }"
checkit 4 4 100 0 0 "\\*" "0 \\*"
restart
checkit 0 5 255 4 1 "{ 7 }" "2 { 1 4 7 7 }"
checkit 1 1 100 8 0 "\\*" "1 { 1 8 }"
checkit 2 2 100 3 1 "{ 8 }" "2 { 1 3 8 8 }"
checkit 3 3 100 4 9 "{ 7 8 9 11 12 13 14 16 18 }" \
"5 { 1 4 7 9 11 14 16 16 18 18 }"
checkit 4 4 100 0 0 "\\*" "0 \\*"
send "1025 27 5 1 { 6 }\n"
simple_expect "=1025"
send "1026 77 1 0\n"
simple_expect "=1026"
send "1027 77 2 1\n"
simple_expect "=1027"
send "1028 27 3 1 { 6 }\n"
simple_expect "=1028"
send "1029 27 4 1 { 3 }\n"
simple_expect "=1029"
checkit 0 5 255 4 2 "{ 6 7 }" "2 { 1 4 6 7 }"
checkit 1 1 100 0 0 "\\*" "0 \\*"
checkit 2 2 100 1 0 "\\*" "1 { 1 1 }"
checkit 3 3 100 4 10 "{ 6 7 8 9 11 12 13 14 16 18 }" \
"4 { 1 4 6 9 11 14 16 16 18 18 }"
checkit 4 4 100 0 1 "{ 3 }" "1 { 3 3 }"
restart
checkit 0 5 255 4 2 "{ 6 7 }" "2 { 1 4 6 7 }"
checkit 1 1 100 0 0 "\\*" "0 \\*"
checkit 2 2 100 1 0 "\\*" "1 { 1 1 }"
checkit 3 3 100 4 10 "{ 6 7 8 9 11 12 13 14 16 18 }" \
"5 { 1 4 6 9 11 14 16 16 18 18 }"
checkit 4 4 100 0 1 "{ 3 }" "1 { 3 3 }"
send "1030 27 5 1 { 5 }\n"
simple_expect "=1030"
send "1031 77 1 2\n"
simple_expect "=1031"
send "1032 40 2 19\n"
simple_expect "=1032"
send "1033 27 3 1 { 5 }\n"
simple_expect "=1033"
send "1034 27 4 1 { 2 }\n"
simple_expect "=1034"
checkit 0 5 255 7 0 "\\*" "1 { 1 7 }"
checkit 1 1 100 2 0 "\\*" "1 { 1 2 }"
checkit 2 2 100 1 0 "\\*" "1 { 1 1 }"
checkit 3 3 100 9 6 "{ 11 12 13 14 16 18 }" "4 { 1 9 11 14 16 16 18 18 }"
checkit 4 4 100 0 2 "{ 2 3 }" "1 { 2 3 }"
restart
checkit 0 5 255 7 0 "\\*" "1 { 1 7 }"
checkit 1 1 100 2 0 "\\*" "1 { 1 2 }"
checkit 2 2 100 1 0 "\\*" "1 { 1 1 }"
checkit 3 3 100 9 6 "{ 11 12 13 14 16 18 }" "4 { 1 9 11 14 16 16 18 18 }"
checkit 4 4 100 0 2 "{ 2 3 }" "1 { 2 3 }"
send "1035 27 5 1 { 20 }\n"
simple_expect "=1035"
send "1036 27 5 1 { 21 }\n"
simple_expect "%1036 16 0"
send "1037 40 2 18\n"
simple_expect "=1037"
send "1038 27 3 1 { 15 }\n"
simple_expect "=1038"
send "1039 27 4 1 { 1 }\n"
simple_expect "=1039"
checkit 0 5 255 7 1 "{ 20 }" "1 { 1 7 }"
checkit 1 1 100 2 0 "\\*" "1 { 1 2 }"
checkit 2 2 100 2 0 "\\*" "1 { 1 2 }"
checkit 3 3 100 9 7 "{ 11 12 13 14 15 16 18 }" "3 { 1 9 11 16 18 18 }"
checkit 4 4 100 3 0 "\\*" "1 { 1 3 }"
restart
checkit 0 5 255 7 1 "{ 20 }" "2 { 1 7 20 20 }"
checkit 1 1 100 2 0 "\\*" "1 { 1 2 }"
checkit 2 2 100 2 0 "\\*" "1 { 1 2 }"
checkit 3 3 100 9 7 "{ 11 12 13 14 15 16 18 }" "3 { 1 9 11 16 18 18 }"
checkit 4 4 100 3 0 "\\*" "1 { 1 3 }"
# Subtract text 3 from conference 2.
send "1042 31 3 2\n"
simple_expect "=1042"
send "1040 27 5 2 { 19 21 }\n"
simple_expect "%1040 16 1"
send "1041 27 1 2 { 21 19 }\n"
simple_expect "%1041 16 0"
send "1043 27 2 0 { }\n"
simple_expect "=1043"
send "1044 27 3 1 { 10 }\n"
simple_expect "=1044"
send "1045 27 4 1 { 18 }\n"
simple_expect "=1045"
if {$mark_as_read_atomic} {
checkit 0 5 255 7 1 "{ 20 }" "2 { 1 7 19 19 }"
} else {
setup_xfail "*-*-*" "mark-as-read processes some stuff and returns error"
fail "mark-as-read"
checkit 0 5 255 7 2 "{ 19 20 }" "2 { 1 7 19 20 }"
}
checkit 1 1 100 2 0 "\\*" "1 { 1 2 }"
checkit 2 2 100 3 0 "\\*" "1 { 1 3 }"
checkit 3 3 100 16 1 "{ 18 }" "2 { 1 16 18 18 }"
checkit 4 4 100 3 1 "{ 18 }" "2 { 1 3 18 18 }"
restart
if {$mark_as_read_atomic} {
checkit 0 5 255 7 1 "{ 20 }" "2 { 1 7 19 19 }"
} else {
checkit 0 5 255 7 2 "{ 19 20 }" "2 { 1 7 19 20 }"
}
checkit 1 1 100 2 0 "\\*" "1 { 1 2 }"
checkit 2 2 100 3 0 "\\*" "1 { 1 3 }"
checkit 3 3 100 16 1 "{ 18 }" "2 { 1 16 18 18 }"
checkit 4 4 100 3 1 "{ 18 }" "2 { 1 3 18 18 }"
# Subtract texts 10-12, 14-15 from conference 1.
send "1047 31 10 1\n"
simple_expect "=1047"
send "1048 31 11 1\n"
simple_expect "=1048"
send "1049 31 12 1\n"
simple_expect "=1049"
send "1050 31 14 1\n"
simple_expect "=1050"
send "1051 31 15 1\n"
simple_expect "=1051"
# Subtract text 4 from conference 2.
send "1053 31 4 2\n"
simple_expect "=1053"
send "1046 27 5 1 { 19 }\n"
simple_expect "=1046"
send "1052 27 1 1 { 8 }\n"
simple_expect "=1052"
send "1055 27 2 0 { }\n"
simple_expect "=1055"
send "1056 27 3 1 { 17 }\n"
simple_expect "=1056"
send "1057 27 4 1 { 17 }\n"
simple_expect "=1057"
checkit 0 5 255 7 2 "{ 19 20 }" "2 { 1 7 19 20 }"
checkit 1 1 100 2 1 "{ 8 }" "2 { 1 2 8 8 }"
checkit 2 2 100 4 0 "\\*" "1 { 1 4 }"
checkit 3 3 100 18 0 "\\*" "1 { 1 18 }"
checkit 4 4 100 3 2 "{ 17 18 }" "2 { 1 3 17 18 }"
restart
checkit 0 5 255 7 2 "{ 19 20 }" "2 { 1 7 19 20 }"
checkit 1 1 100 2 1 "{ 8 }" "2 { 1 2 8 8 }"
checkit 2 2 100 4 0 "\\*" "1 { 1 4 }"
checkit 3 3 100 18 0 "\\*" "1 { 1 18 }"
checkit 4 4 100 3 2 "{ 17 18 }" "2 { 1 3 17 18 }"
send "1046 27 5 1 { 18 }\n"
simple_expect "=1046"
send "1052 27 1 1 { 9 }\n"
simple_expect "=1052"
send "1055 27 2 1 { 4 }\n"
simple_expect "=1055"
send "1056 27 3 1 { 20 }\n"
simple_expect "=1056"
send "1057 27 4 1 { 19 }\n"
simple_expect "=1057"
checkit 0 5 255 7 3 "{ 18 19 20 }" "2 { 1 7 18 20 }"
if {$lazy_expand} {
checkit 1 1 100 2 2 "{ 8 9 }" "2 { 1 2 8 9 }"
} else {
checkit 1 1 100 2 5 "{ 8 9 10 11 12 }" "2 { 1 2 8 12 }"
}
checkit 2 2 100 4 0 "\\*" "1 { 1 4 }"
checkit 3 3 100 18 1 "{ 20 }" "2 { 1 18 20 20 }"
checkit 4 4 100 3 3 "{ 17 18 19 }" "2 { 1 3 17 19 }"
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
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