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

Added lots of tests and a second client.

parent 4ec6b02e
# Test get_map and local_to_global.
# As a side effect a lot of other things are also tested.
# The following texts are created by this test case:
#
# Author Text_no Recipients
# 5 1 1<1>
# 5 2 2<1>
# 5 3 1<2> 3<1>
# 6 4 1<3>
# 6 5 1<4>
# 5 6 1<5>
# 5 7 1<6>
# 5 8 1<7>
# 5 9 1<8>
# 5 10 1<9>
lyskomd_start
client_start 0
talk_to client 0
send "A3Hfoo\n"
simple_expect "LysKOM" "connected"
......@@ -56,10 +74,449 @@ simple_expect "%1013 16 2" "one map (old-style 2)"
send "1014 103 1 2 50\n"
simple_expect "%1014 16 2" "one map (new-style 2)"
send "1015 42 255\n"
simple_expect "=1015" "42=enable succeeded"
send "1016 44 0\n"
simple_expect "=1016" "44=shutdown-kom succeeded"
simple_expect ":2 13 5 1" "auto-logout after 44=shutdown-kom"
# Create yet another text in a conference we are not subscribed to.
# Make sure that no async message arrives.
send "1015 28 [holl text002] 1 { 0 2 }\n"
simple_expect "=1015 2" "text 2 created"
# Create text 3. Make sure that loc_no is ignored.
send "1016 28 [holl text0003] 4 { 0 1 6 99 1 3 6 32 }\n"
simple_expect ":16 0 3 $any_time 5 0 8 0 4 { 0 1 6 2 1 3 6 1 }" \
"async text 3 created"
simple_expect "=1016 3" "text 3 created"
# Get the map using 34=get-map and 103=local-to-global
send "1017 34 1 0 50\n"
simple_expect "=1017 1 2 { 1 3 }" "one map (old-style 0)"
send "1018 103 1 0 50\n"
simple_expect "%1018 17 0" "one map (new-style 0)"
send "1019 34 1 1 50\n"
simple_expect "=1019 1 2 { 1 3 }" "one map (old-style)"
send "1020 103 1 1 50\n"
simple_expect "=1020 0 1 1 2 { 1 3 }" "one map (new-style)"
send "1021 34 1 3 50\n"
simple_expect "%1021 16 3" "one map (old-style 3)"
send "1022 103 1 3 50\n"
simple_expect "%1022 16 3" "one map (new-style 3)"
send "1023 34 1 2 50\n"
simple_expect "=1023 2 1 { 3 }" "one map (old-style 2)"
send "1024 103 1 2 50\n"
simple_expect "=1024 0 1 2 1 { 3 }" "one map (new-style 2)"
send "1025 34 1 1 2\n"
simple_expect "=1025 1 2 { 1 3 }" "one map (old-style)"
send "1026 103 1 1 2\n"
simple_expect "=1026 0 1 1 2 { 1 3 }" "one map (new-style)"
send "1027 34 1 1 1\n"
simple_expect "=1027 1 1 { 1 }" "one map (old-style)"
send "1028 103 1 1 1\n"
simple_expect "=1028 1 1 1 1 { 1 }" "one map (new-style)"
send "1029 34 1 1 0\n"
simple_expect "=1029 1 0 \\*" "one map (old-style)"
send "1030 103 1 1 0\n"
simple_expect "=1030 1 0 0 \\*" "one map (new-style)"
# Connect a second client that is aux-info-aware
client_start 1
talk_to client 1
send "A3Hbar\n"
simple_expect "LysKOM" "connected"
# Enable new-style async messages.
send "1031 81\n"
simple_expect "=1031 8 { 0 5 7 8 9 11 12 13 }" "the default list of async messages"
send "1032 80 10 { 5 6 8 9 11 12 13 14 15 9999 }\n"
simple_expect "%1032 50 9999" "async-message 9999 does not exist"
send "1033 81\n"
simple_expect "=1033 9 { 5 6 8 9 11 12 13 14 15 }" "the failed call succeeded"
send "1034 80 10 { 5 6 8 9 11 12 7 13 14 15 }\n"
simple_expect "=1034" "setting wanted async"
send "1035 81\n"
simple_expect "=1035 10 { 5 6 7 8 9 11 12 13 14 15 }" "setting async"
# Create the person "Eskil Block, FOA"
# lookup
send "1036 76 [holl "Eskil Block, FOA"] 0 1\n"
simple_expect "=1036 0 \\*" "No Eskil Block yet"
# FIXME: why do we pass aux_no? The "99" and "98" should be removed
# if the protocol is changed.
send "1037 89 [holl "Eskil Block, FOA"] [holl "liksE"] 2 { 99 9 00000000 1 [holl "simulated compface data"] 98 12 00000000 1 [holl "simulated pgp public key"] }\n"
simple_expect ":2 9 6 2" "Eskil logged in (async c1)"
simple_expect "=1037 6" "created Eskil, got 6"
talk_to client 0
simple_expect ":2 9 6 2" "Eskil logged in (async c0)"
talk_to client 1
# Check that Eskil is a member of his letterbox and nothing else.
send "1038 99 6 0 9 0\n"
simple_expect "=1038 1 { $any_time 6 255 0 0 \\* 0 $any_time 00000000 }" "Eskil is a member of his letterbox (only)"
# Eskil joins conf 1 and creates a text.
send "1039 2 1\n"
simple_expect "%1039 13 1" "Eskil not member yet; thus cannot change conference"
send "1040 100 1 6 100 0 00000000\n"
simple_expect "=1040" "Eskil joins ok"
send "1041 2 1\n"
simple_expect ":5 6 6 1 2 [holl ""] [holl "bar@localhost"]" "Eskil changed conference"
simple_expect "=1041" "Eskil member; thus can change conference"
send "1042 86 [holl "text0004"] 1 { 0 1 } 0 { }\n"
simple_expect ":18 15 4 $any_time 6 0 8 0 2 { 0 1 6 3 } 0 \\*" "async to c1"
simple_expect "=1042 4" "Eskil created text 4"
talk_to client 0
simple_expect ":16 0 4 $any_time 6 0 8 0 2 { 0 1 6 3 }" "async to c0"
send "1043 34 1 0 50\n"
simple_expect "=1043 1 3 { 1 3 4 }" "one map (old-style 0)"
send "1044 103 1 0 50\n"
simple_expect "%1044 17 0" "one map (new-style 0)"
send "1045 34 1 1 50\n"
simple_expect "=1045 1 3 { 1 3 4 }" "one map (old-style)"
send "1046 103 1 1 50\n"
simple_expect "=1046 0 1 1 3 { 1 3 4 }" "one map (new-style)"
send "1047 34 1 4 50\n"
simple_expect "%1047 16 4" "one map (old-style 3)"
send "1048 103 1 4 50\n"
simple_expect "%1048 16 4" "one map (new-style 3)"
send "1049 34 1 2 50\n"
simple_expect "=1049 2 2 { 3 4 }" "one map (old-style 2)"
send "1050 103 1 2 50\n"
simple_expect "=1050 0 1 2 2 { 3 4 }" "one map (new-style 2)"
send "1051 34 1 1 2\n"
simple_expect "=1051 1 2 { 1 3 }" "one map (old-style)"
send "1052 103 1 1 2\n"
simple_expect "=1052 1 1 1 2 { 1 3 }" "one map (new-style)"
send "1053 34 1 1 1\n"
simple_expect "=1053 1 1 { 1 }" "one map (old-style)"
send "1054 103 1 1 1\n"
simple_expect "=1054 1 1 1 1 { 1 }" "one map (new-style)"
send "1055 34 1 3 0\n"
simple_expect "=1055 3 0 \\*" "one map (old-style)"
send "1056 103 1 3 0\n"
simple_expect "=1056 1 0 0 \\*" "one map (new-style)"
talk_to client 1
# FIXME: why do we pass aux_no? The "99" should be removed
# if the protocol is changed.
send "1057 86 [holl "text0005 failed attempt"] 1 { 0 1 } 1 { 99 9 00000000 1 [holl "simulated compface data"] }\n"
simple_expect "%1057 49 0" "not allowed to add compface to texts"
# FIXME: why do we pass aux_no? The "99" should be removed
# if the protocol is changed.
send "1058 86 [holl "text0005"] 1 { 0 1 } 1 { 99 1 00000000 1 [holl "text/plain"] }\n"
simple_expect ":18 15 5 $any_time 6 0 8 0 2 { 0 1 6 4 } 1 { 1 1 6 $any_time 00000000 1 [holl "text/plain"] }" "async to c1"
simple_expect "=1058 5" "Eskil created text 5"
talk_to client 0
simple_expect ":16 0 5 $any_time 6 0 8 0 2 { 0 1 6 4 }" "async to c0"
# Create some more texts
send "1059 28 [holl text0006] 1 { 0 1 }\n"
simple_expect ":16 0 6 $any_time 5 0 8 0 2 { 0 1 6 5 }" "async text 6 created"
simple_expect "=1059 6"
talk_to client 1
simple_expect ":18 15 6 $any_time 5 0 8 0 2 { 0 1 6 5 } 0 \\*" "async to c1"
talk_to client 0
send "1060 28 [holl text0007] 1 { 0 1 }\n"
simple_expect ":16 0 7 $any_time 5 0 8 0 2 { 0 1 6 6 }" "async text 7 created"
simple_expect "=1060 7"
talk_to client 1
simple_expect ":18 15 7 $any_time 5 0 8 0 2 { 0 1 6 6 } 0 \\*" "async to c1"
talk_to client 0
send "1061 28 [holl text0008] 1 { 0 1 }\n"
simple_expect ":16 0 8 $any_time 5 0 8 0 2 { 0 1 6 7 }" "async text 8 created"
simple_expect "=1061 8"
talk_to client 1
simple_expect ":18 15 8 $any_time 5 0 8 0 2 { 0 1 6 7 } 0 \\*" "async to c1"
talk_to client 0
send "1062 28 [holl text0009] 1 { 0 1 }\n"
simple_expect ":16 0 9 $any_time 5 0 8 0 2 { 0 1 6 8 }" "async text 9 created"
simple_expect "=1062 9"
talk_to client 1
simple_expect ":18 15 9 $any_time 5 0 8 0 2 { 0 1 6 8 } 0 \\*" "async to c1"
talk_to client 0
send "1063 28 [holl text0010] 1 { 0 1 }\n"
simple_expect ":16 0 10 $any_time 5 0 8 0 2 { 0 1 6 9 }" "async text 10 created"
simple_expect "=1063 10"
talk_to client 1
simple_expect ":18 15 10 $any_time 5 0 8 0 2 { 0 1 6 9 } 0 \\*" "async to c1"
# We now have 9 texts in conference 1. Check get_map.
send "1064 34 1 0 50\n"
simple_expect "=1064 1 9 { 1 3 4 5 6 7 8 9 10 }"
send "1065 34 1 1 50\n"
simple_expect "=1065 1 9 { 1 3 4 5 6 7 8 9 10 }"
send "1066 34 1 2 50\n"
simple_expect "=1066 2 8 { 3 4 5 6 7 8 9 10 }"
send "1067 34 1 3 50\n"
simple_expect "=1067 3 7 { 4 5 6 7 8 9 10 }"
send "1068 34 1 4 50\n"
simple_expect "=1068 4 6 { 5 6 7 8 9 10 }"
send "1069 34 1 5 50\n"
simple_expect "=1069 5 5 { 6 7 8 9 10 }"
send "1070 34 1 6 50\n"
simple_expect "=1070 6 4 { 7 8 9 10 }"
send "1071 34 1 7 50\n"
simple_expect "=1071 7 3 { 8 9 10 }"
send "1072 34 1 8 50\n"
simple_expect "=1072 8 2 { 9 10 }"
send "1073 34 1 9 50\n"
simple_expect "=1073 9 1 { 10 }"
send "1074 34 1 10 50\n"
simple_expect "%1074 16 10"
send "1075 34 1 0 11\n"
simple_expect "=1075 1 9 { 1 3 4 5 6 7 8 9 10 }"
send "1076 34 1 0 10\n"
simple_expect "=1076 1 9 { 1 3 4 5 6 7 8 9 10 }"
send "1077 34 1 0 9\n"
simple_expect "=1077 1 8 { 1 3 4 5 6 7 8 9 }"
send "1078 34 1 1 10\n"
simple_expect "=1078 1 9 { 1 3 4 5 6 7 8 9 10 }"
send "1079 34 1 1 9\n"
simple_expect "=1079 1 9 { 1 3 4 5 6 7 8 9 10 }"
send "1080 34 1 1 8\n"
simple_expect "=1080 1 8 { 1 3 4 5 6 7 8 9 }"
send "1081 34 1 8 2\n"
simple_expect "=1081 8 2 { 9 10 }"
send "1082 34 1 9 1\n"
simple_expect "=1082 9 1 { 10 }"
# Check local_to_global
send "1083 103 1 0 50\n"
simple_expect "%1083 17 0"
send "1084 103 1 1 50\n"
simple_expect "=1084 0 1 1 9 { 1 3 4 5 6 7 8 9 10 }"
send "1085 103 1 2 50\n"
simple_expect "=1085 0 1 2 8 { 3 4 5 6 7 8 9 10 }"
send "1086 103 1 3 50\n"
simple_expect "=1086 0 1 3 7 { 4 5 6 7 8 9 10 }"
send "1087 103 1 4 50\n"
simple_expect "=1087 0 1 4 6 { 5 6 7 8 9 10 }"
send "1088 103 1 5 50\n"
simple_expect "=1088 0 1 5 5 { 6 7 8 9 10 }"
send "1089 103 1 6 50\n"
simple_expect "=1089 0 1 6 4 { 7 8 9 10 }"
send "1090 103 1 7 50\n"
simple_expect "=1090 0 1 7 3 { 8 9 10 }"
send "1091 103 1 8 50\n"
simple_expect "=1091 0 1 8 2 { 9 10 }"
send "1092 103 1 9 50\n"
simple_expect "=1092 0 1 9 1 { 10 }"
send "1093 103 1 10 50\n"
simple_expect "%1093 16 10"
send "1094 103 1 0 11\n"
simple_expect "%1094 17 0"
send "1095 103 1 0 10\n"
simple_expect "%1095 17 0"
send "1096 103 1 0 9\n"
simple_expect "%1096 17 0"
send "1097 103 1 1 10\n"
simple_expect "=1097 0 1 1 9 { 1 3 4 5 6 7 8 9 10 }"
send "1098 103 1 1 9\n"
simple_expect "=1098 0 1 1 9 { 1 3 4 5 6 7 8 9 10 }"
send "1099 103 1 1 8\n"
simple_expect "=1099 1 1 1 8 { 1 3 4 5 6 7 8 9 }"
send "1100 103 1 3 5\n"
simple_expect "=1100 1 1 3 5 { 4 5 6 7 8 }"
send "1101 103 1 8 2\n"
simple_expect "=1101 0 1 8 2 { 9 10 }"
send "1102 103 1 9 1\n"
simple_expect "=1102 0 1 9 1 { 10 }"
# Remove a few texts to provoke sparse maps.
send "1103 29 4\n"
simple_expect ":18 14 4 $any_time 6 0 8 0 2 { 0 1 6 3 } 0 \\*"
simple_expect "=1103"
send "1104 31 5 1\n"
simple_expect "=1104"
# Now, these local text numbers exist:
# lno: 1 2 . . 5 6 7 8 9
# tno: 1 3 . . 6 7 8 9 10
send "1105 34 1 1 50\n"
simple_expect "=1105 1 9 { 1 3 0 0 6 7 8 9 10 }"
send "1106 34 1 2 50\n"
simple_expect "=1106 2 8 { 3 0 0 6 7 8 9 10 }"
send "1107 34 1 3 50\n"
simple_expect "=1107 3 7 { 0 0 6 7 8 9 10 }"
send "1108 34 1 4 50\n"
simple_expect "=1108 4 6 { 0 6 7 8 9 10 }"
send "1109 34 1 5 50\n"
simple_expect "=1109 5 5 { 6 7 8 9 10 }"
send "1110 34 1 6 50\n"
simple_expect "=1110 6 4 { 7 8 9 10 }"
send "1111 103 1 3 1\n"
simple_expect "=1111 1 1 5 1 { 6 }"
send "1112 103 1 4 1\n"
simple_expect "=1112 1 1 5 1 { 6 }"
send "1113 103 1 5 1\n"
simple_expect "=1113 1 1 5 1 { 6 }"
send "1114 103 1 2 1\n"
simple_expect "=1114 1 1 2 1 { 3 }"
send "1115 103 1 2 2\n"
simple_expect "=1115 1 0 2 { 2 3 5 6 }"
send "1116 103 1 2 3\n"
simple_expect "=1116 1 1 2 5 { 3 0 0 6 7 }"
# Remove some more
talk_to client 0
send "1117 29 6\n"
simple_expect "=1117"
send "1118 29 7\n"
simple_expect "=1118"
send "1119 29 8\n"
simple_expect "=1119"
send "1120 29 9\n"
simple_expect "=1120"
talk_to client 1
simple_expect ":18 14 6 $any_time 5 0 8 0 2 { 0 1 6 5 } 0 \\*"
simple_expect ":18 14 7 $any_time 5 0 8 0 2 { 0 1 6 6 } 0 \\*"
simple_expect ":18 14 8 $any_time 5 0 8 0 2 { 0 1 6 7 } 0 \\*"
simple_expect ":18 14 9 $any_time 5 0 8 0 2 { 0 1 6 8 } 0 \\*"
# Now, these local text numbers exist:
# lno: 1 2 . . . . . . 9
# tno: 1 3 . . . . . . 10
send "1121 103 1 1 2\n"
simple_expect "=1121 1 1 1 2 { 1 3 }"
send "1122 103 1 2 2\n"
simple_expect "=1122 0 0 2 { 2 3 9 10 }"
send "1123 103 1 2 3\n"
simple_expect "=1123 0 0 2 { 2 3 9 10 }"
send "1124 103 1 1 3\n"
simple_expect "=1124 0 0 3 { 1 1 2 3 9 10 }"
send "1125 103 1 1 4\n"
simple_expect "=1125 0 0 3 { 1 1 2 3 9 10 }"
send "1126 103 1 1 50\n"
simple_expect "=1126 0 0 3 { 1 1 2 3 9 10 }"
send "1127 103 1 6 50\n"
simple_expect "=1127 0 1 9 1 { 10 }"
send "1128 34 1 6 50\n"
simple_expect "=1128 6 4 { 0 0 0 10 }"
send "1129 34 1 1 50\n"
simple_expect "=1129 1 9 { 1 3 0 0 0 0 0 0 10 }"
# Shut down the server.
talk_to client 0
send "1130 42 255\n"
simple_expect "=1130" "42=enable succeeded"
send "1131 44 0\n"
simple_expect "=1131" "44=shutdown-kom succeeded"
simple_expect ":2 13 6 2" "c0 sees auto-logout of c1 after 44=shutdown-kom"
simple_expect ":2 13 5 1" "c0 sees auto-logout of c0 after 44=shutdown-kom"
client_death 0
talk_to client 1
simple_expect ":2 13 6 2" "c1 sees auto-logout of c1 after 44=shutdown-kom"
client_death 1
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