2013-07-22 08:25:02 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Tests for MeshMS Messaging
|
|
|
|
#
|
|
|
|
# Copyright 2012 Serval Project, Inc.
|
|
|
|
#
|
|
|
|
# This program 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 2
|
|
|
|
# of the License, or (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program 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 this program; if not, write to the Free Software
|
|
|
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
|
|
|
|
source "${0%/*}/../testframework.sh"
|
|
|
|
source "${0%/*}/../testdefs.sh"
|
|
|
|
source "${0%/*}/../testdefs_rhizome.sh"
|
|
|
|
|
2016-08-17 01:58:36 +00:00
|
|
|
rexp_age="[-0-9]\+"
|
2014-07-14 01:59:49 +00:00
|
|
|
|
2013-07-25 05:19:06 +00:00
|
|
|
teardown() {
|
|
|
|
stop_all_servald_servers
|
|
|
|
kill_all_servald_processes
|
|
|
|
assert_no_servald_processes
|
2016-01-25 06:32:21 +00:00
|
|
|
report_all_servald_servers
|
2013-07-22 08:25:02 +00:00
|
|
|
}
|
|
|
|
|
Refactor manifest: specific setter functions
Replace generic rhizome_manifest_set() and rhizome_manifest_set_ll()
with per-field setter functions, eg, rhizome_manifest_set_filesize().
Struct rhizome_manifest elements for all known fields, to replace the
use of rhizome_manifest_get() and rhizome_manifest_get_ll() everywhere:
sender, recipient, service, name, date, bundle_key.
Add boolean validity flags for binary blob types, to avoid having to compare
with many bytes of all-zero to detect presence, eg, has_sender, has_recipient,
has_author, has_bundle_key. These maintained by the setter functions.
Rename existing manifest struct elements to be the same as their field
names: fileLength -> filesize, journalTail -> tail.
More use of unsigned int, size_t and uint64_t for payload sizes, offsets, byte
counts, etc. especially in rhizome_store.c and meshms.c. More uniform use of
size_t to dimension memory buffers. Fix some printf(3) style format strings
for 64-bit correctness on 32-bit systems. Use new constant RHIZOME_SIZE_UNSET
instead of -1 to indicate unknown dimension, and explicitly assert its absence
before comparisons and arithmetic, for safety.
Replace some 'int' loop variables with 'unsigned' where appropriate.
Fix bugs discovered in MeshMS bundle private/public key generation and
bundle secret key handling for export/extract commands.
Instrument the first MeshMS test case to aid debugging.
New debug config flag: debug.manifest logs all modifications to all manifest
fields by setter functions.
Rename debug config flag: debug.rhizome_bind -> debug.rhizome_sql_bind.
2013-10-30 12:52:19 +00:00
|
|
|
setup_logging() {
|
|
|
|
executeOk_servald config \
|
|
|
|
set debug.meshms on \
|
|
|
|
set log.console.level debug \
|
|
|
|
set log.console.show_time on
|
|
|
|
}
|
|
|
|
|
2016-08-17 01:58:36 +00:00
|
|
|
setup_common() {
|
2013-07-22 08:25:02 +00:00
|
|
|
setup_servald
|
|
|
|
set_instance +A
|
2016-08-17 01:58:36 +00:00
|
|
|
create_identities $1
|
Refactor manifest: specific setter functions
Replace generic rhizome_manifest_set() and rhizome_manifest_set_ll()
with per-field setter functions, eg, rhizome_manifest_set_filesize().
Struct rhizome_manifest elements for all known fields, to replace the
use of rhizome_manifest_get() and rhizome_manifest_get_ll() everywhere:
sender, recipient, service, name, date, bundle_key.
Add boolean validity flags for binary blob types, to avoid having to compare
with many bytes of all-zero to detect presence, eg, has_sender, has_recipient,
has_author, has_bundle_key. These maintained by the setter functions.
Rename existing manifest struct elements to be the same as their field
names: fileLength -> filesize, journalTail -> tail.
More use of unsigned int, size_t and uint64_t for payload sizes, offsets, byte
counts, etc. especially in rhizome_store.c and meshms.c. More uniform use of
size_t to dimension memory buffers. Fix some printf(3) style format strings
for 64-bit correctness on 32-bit systems. Use new constant RHIZOME_SIZE_UNSET
instead of -1 to indicate unknown dimension, and explicitly assert its absence
before comparisons and arithmetic, for safety.
Replace some 'int' loop variables with 'unsigned' where appropriate.
Fix bugs discovered in MeshMS bundle private/public key generation and
bundle secret key handling for export/extract commands.
Instrument the first MeshMS test case to aid debugging.
New debug config flag: debug.manifest logs all modifications to all manifest
fields by setter functions.
Rename debug config flag: debug.rhizome_bind -> debug.rhizome_sql_bind.
2013-10-30 12:52:19 +00:00
|
|
|
setup_logging
|
2013-07-22 08:25:02 +00:00
|
|
|
}
|
2016-08-17 01:58:36 +00:00
|
|
|
|
|
|
|
doc_InitiallyEmpty="Return an empty list before sending anything"
|
|
|
|
setup_InitiallyEmpty() {
|
|
|
|
setup_common 2
|
|
|
|
}
|
|
|
|
test_InitiallyEmpty() {
|
2013-07-22 08:25:02 +00:00
|
|
|
executeOk_servald meshms list messages $SIDA1 $SIDA2
|
2016-08-17 01:58:36 +00:00
|
|
|
tfw_cat --stdout
|
2016-10-26 06:33:14 +00:00
|
|
|
assertStdoutIs --stdout --line=1 -e '6\n'
|
|
|
|
assertStdoutIs --stdout --line=2 -e '_id:my_offset:their_offset:age:type:message\n'
|
2013-07-22 08:25:02 +00:00
|
|
|
assertStdoutLineCount '==' 2
|
2016-08-17 01:58:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
doc_SendAndList="Send outgoing messages and list them"
|
|
|
|
setup_SendAndList() {
|
|
|
|
setup_common 3
|
|
|
|
}
|
|
|
|
test_SendAndList() {
|
|
|
|
# create a single message and list it back
|
|
|
|
executeOk_servald meshms send message $SIDA1 $SIDA2 "Message 1"
|
|
|
|
tfw_cat --stderr
|
|
|
|
executeOk_servald meshms send message $SIDA1 $SIDA3 "Message 1"
|
|
|
|
tfw_cat --stderr
|
2013-07-22 08:25:02 +00:00
|
|
|
executeOk_servald meshms list messages $SIDA1 $SIDA2
|
2016-08-17 01:58:36 +00:00
|
|
|
tfw_cat --stderr
|
2016-10-26 06:33:14 +00:00
|
|
|
assertStdoutGrep --stdout --matches=1 "^0:12:0:$rexp_age:>:Message 1\$"
|
2016-08-17 01:58:36 +00:00
|
|
|
executeOk_servald meshms send message $SIDA1 $SIDA2 "Message 2"
|
|
|
|
tfw_cat --stderr
|
2013-07-22 08:25:02 +00:00
|
|
|
executeOk_servald meshms list messages $SIDA1 $SIDA2
|
2016-08-17 01:58:36 +00:00
|
|
|
tfw_cat --stderr
|
2016-10-26 06:33:14 +00:00
|
|
|
assertStdoutGrep --stdout --matches=1 "^0:30:0:$rexp_age:>:Message 2\$"
|
|
|
|
assertStdoutGrep --stdout --matches=1 "^1:12:0:$rexp_age:>:Message 1\$"
|
2016-08-17 01:58:36 +00:00
|
|
|
executeOk_servald meshms send message $SIDA1 $SIDA2 "Message 3"
|
|
|
|
executeOk_servald meshms list messages $SIDA1 $SIDA2
|
|
|
|
tfw_cat --stdout
|
2016-10-26 06:33:14 +00:00
|
|
|
assertStdoutGrep --stdout --matches=1 "^0:48:0:$rexp_age:>:Message 3\$"
|
|
|
|
assertStdoutGrep --stdout --matches=1 "^1:30:0:$rexp_age:>:Message 2\$"
|
|
|
|
assertStdoutGrep --stdout --matches=1 "^2:12:0:$rexp_age:>:Message 1\$"
|
2013-08-02 04:32:56 +00:00
|
|
|
assertStdoutLineCount '==' 5
|
2013-07-26 05:06:11 +00:00
|
|
|
executeOk_servald meshms list messages $SIDA2 $SIDA1
|
2016-08-17 01:58:36 +00:00
|
|
|
tfw_cat --stdout
|
2016-10-26 06:33:14 +00:00
|
|
|
assertStdoutGrep --stdout --matches=1 "^0:3:48:$rexp_age:<:Message 3\$"
|
|
|
|
assertStdoutGrep --stdout --matches=1 "^1:3:30:$rexp_age:<:Message 2\$"
|
|
|
|
assertStdoutGrep --stdout --matches=1 "^2:3:12:$rexp_age:<:Message 1\$"
|
2013-08-02 04:32:56 +00:00
|
|
|
assertStdoutLineCount '==' 5
|
2013-07-25 05:19:06 +00:00
|
|
|
}
|
|
|
|
|
Refactor manifest: specific setter functions
Replace generic rhizome_manifest_set() and rhizome_manifest_set_ll()
with per-field setter functions, eg, rhizome_manifest_set_filesize().
Struct rhizome_manifest elements for all known fields, to replace the
use of rhizome_manifest_get() and rhizome_manifest_get_ll() everywhere:
sender, recipient, service, name, date, bundle_key.
Add boolean validity flags for binary blob types, to avoid having to compare
with many bytes of all-zero to detect presence, eg, has_sender, has_recipient,
has_author, has_bundle_key. These maintained by the setter functions.
Rename existing manifest struct elements to be the same as their field
names: fileLength -> filesize, journalTail -> tail.
More use of unsigned int, size_t and uint64_t for payload sizes, offsets, byte
counts, etc. especially in rhizome_store.c and meshms.c. More uniform use of
size_t to dimension memory buffers. Fix some printf(3) style format strings
for 64-bit correctness on 32-bit systems. Use new constant RHIZOME_SIZE_UNSET
instead of -1 to indicate unknown dimension, and explicitly assert its absence
before comparisons and arithmetic, for safety.
Replace some 'int' loop variables with 'unsigned' where appropriate.
Fix bugs discovered in MeshMS bundle private/public key generation and
bundle secret key handling for export/extract commands.
Instrument the first MeshMS test case to aid debugging.
New debug config flag: debug.manifest logs all modifications to all manifest
fields by setter functions.
Rename debug config flag: debug.rhizome_bind -> debug.rhizome_sql_bind.
2013-10-30 12:52:19 +00:00
|
|
|
check_meshms_bundles() {
|
|
|
|
# Dump the MeshMS bundles to the log and check consistency
|
|
|
|
# The only "file" bundle should be the conversation list
|
|
|
|
executeOk_servald rhizome list file
|
2014-02-19 05:05:08 +00:00
|
|
|
unpack_stdout_list X
|
2013-12-27 18:56:22 +00:00
|
|
|
assert --stdout --stderr [ $XNROWS -eq 1 ]
|
2014-02-19 05:05:08 +00:00
|
|
|
assert --stdout --stderr [ ${XID[0]} = $CONV_BID ]
|
Refactor manifest: specific setter functions
Replace generic rhizome_manifest_set() and rhizome_manifest_set_ll()
with per-field setter functions, eg, rhizome_manifest_set_filesize().
Struct rhizome_manifest elements for all known fields, to replace the
use of rhizome_manifest_get() and rhizome_manifest_get_ll() everywhere:
sender, recipient, service, name, date, bundle_key.
Add boolean validity flags for binary blob types, to avoid having to compare
with many bytes of all-zero to detect presence, eg, has_sender, has_recipient,
has_author, has_bundle_key. These maintained by the setter functions.
Rename existing manifest struct elements to be the same as their field
names: fileLength -> filesize, journalTail -> tail.
More use of unsigned int, size_t and uint64_t for payload sizes, offsets, byte
counts, etc. especially in rhizome_store.c and meshms.c. More uniform use of
size_t to dimension memory buffers. Fix some printf(3) style format strings
for 64-bit correctness on 32-bit systems. Use new constant RHIZOME_SIZE_UNSET
instead of -1 to indicate unknown dimension, and explicitly assert its absence
before comparisons and arithmetic, for safety.
Replace some 'int' loop variables with 'unsigned' where appropriate.
Fix bugs discovered in MeshMS bundle private/public key generation and
bundle secret key handling for export/extract commands.
Instrument the first MeshMS test case to aid debugging.
New debug config flag: debug.manifest logs all modifications to all manifest
fields by setter functions.
Rename debug config flag: debug.rhizome_bind -> debug.rhizome_sql_bind.
2013-10-30 12:52:19 +00:00
|
|
|
executeOk_servald rhizome extract bundle $CONV_BID manifest.conv payload.conv $CONV_SECRET
|
|
|
|
tfw_cat -v manifest.conv --hexdump payload.conv
|
|
|
|
# The only "MeshMS2" bundles should be the two ply bundles
|
|
|
|
executeOk_servald rhizome list MeshMS2
|
2014-02-19 05:05:08 +00:00
|
|
|
unpack_stdout_list X
|
2013-12-27 18:56:22 +00:00
|
|
|
assert --stdout [ $XNROWS -eq 2 ]
|
Refactor manifest: specific setter functions
Replace generic rhizome_manifest_set() and rhizome_manifest_set_ll()
with per-field setter functions, eg, rhizome_manifest_set_filesize().
Struct rhizome_manifest elements for all known fields, to replace the
use of rhizome_manifest_get() and rhizome_manifest_get_ll() everywhere:
sender, recipient, service, name, date, bundle_key.
Add boolean validity flags for binary blob types, to avoid having to compare
with many bytes of all-zero to detect presence, eg, has_sender, has_recipient,
has_author, has_bundle_key. These maintained by the setter functions.
Rename existing manifest struct elements to be the same as their field
names: fileLength -> filesize, journalTail -> tail.
More use of unsigned int, size_t and uint64_t for payload sizes, offsets, byte
counts, etc. especially in rhizome_store.c and meshms.c. More uniform use of
size_t to dimension memory buffers. Fix some printf(3) style format strings
for 64-bit correctness on 32-bit systems. Use new constant RHIZOME_SIZE_UNSET
instead of -1 to indicate unknown dimension, and explicitly assert its absence
before comparisons and arithmetic, for safety.
Replace some 'int' loop variables with 'unsigned' where appropriate.
Fix bugs discovered in MeshMS bundle private/public key generation and
bundle secret key handling for export/extract commands.
Instrument the first MeshMS test case to aid debugging.
New debug config flag: debug.manifest logs all modifications to all manifest
fields by setter functions.
Rename debug config flag: debug.rhizome_bind -> debug.rhizome_sql_bind.
2013-10-30 12:52:19 +00:00
|
|
|
local bid
|
2014-02-19 05:05:08 +00:00
|
|
|
for bid in ${XID[*]}; do
|
Refactor manifest: specific setter functions
Replace generic rhizome_manifest_set() and rhizome_manifest_set_ll()
with per-field setter functions, eg, rhizome_manifest_set_filesize().
Struct rhizome_manifest elements for all known fields, to replace the
use of rhizome_manifest_get() and rhizome_manifest_get_ll() everywhere:
sender, recipient, service, name, date, bundle_key.
Add boolean validity flags for binary blob types, to avoid having to compare
with many bytes of all-zero to detect presence, eg, has_sender, has_recipient,
has_author, has_bundle_key. These maintained by the setter functions.
Rename existing manifest struct elements to be the same as their field
names: fileLength -> filesize, journalTail -> tail.
More use of unsigned int, size_t and uint64_t for payload sizes, offsets, byte
counts, etc. especially in rhizome_store.c and meshms.c. More uniform use of
size_t to dimension memory buffers. Fix some printf(3) style format strings
for 64-bit correctness on 32-bit systems. Use new constant RHIZOME_SIZE_UNSET
instead of -1 to indicate unknown dimension, and explicitly assert its absence
before comparisons and arithmetic, for safety.
Replace some 'int' loop variables with 'unsigned' where appropriate.
Fix bugs discovered in MeshMS bundle private/public key generation and
bundle secret key handling for export/extract commands.
Instrument the first MeshMS test case to aid debugging.
New debug config flag: debug.manifest logs all modifications to all manifest
fields by setter functions.
Rename debug config flag: debug.rhizome_bind -> debug.rhizome_sql_bind.
2013-10-30 12:52:19 +00:00
|
|
|
executeOk_servald rhizome extract bundle $bid manifest.$bid payload.$bid
|
|
|
|
tfw_cat -v manifest.$bid --hexdump payload.$bid
|
|
|
|
done
|
2013-07-25 05:19:06 +00:00
|
|
|
}
|
|
|
|
|
2013-07-26 05:06:11 +00:00
|
|
|
has_unread_messages() {
|
|
|
|
executeOk_servald meshms list conversations $1
|
2013-07-30 06:56:01 +00:00
|
|
|
if ! grep ":unread:" $_tfw_tmp/stdout; then
|
2013-07-26 05:06:11 +00:00
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2013-07-26 05:10:06 +00:00
|
|
|
messages_delivered() {
|
|
|
|
executeOk_servald meshms list messages $1 $2
|
2013-08-02 04:32:56 +00:00
|
|
|
if ! grep ":ACK:" $_tfw_tmp/stdout; then
|
2013-07-26 05:10:06 +00:00
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
Refactor manifest: specific setter functions
Replace generic rhizome_manifest_set() and rhizome_manifest_set_ll()
with per-field setter functions, eg, rhizome_manifest_set_filesize().
Struct rhizome_manifest elements for all known fields, to replace the
use of rhizome_manifest_get() and rhizome_manifest_get_ll() everywhere:
sender, recipient, service, name, date, bundle_key.
Add boolean validity flags for binary blob types, to avoid having to compare
with many bytes of all-zero to detect presence, eg, has_sender, has_recipient,
has_author, has_bundle_key. These maintained by the setter functions.
Rename existing manifest struct elements to be the same as their field
names: fileLength -> filesize, journalTail -> tail.
More use of unsigned int, size_t and uint64_t for payload sizes, offsets, byte
counts, etc. especially in rhizome_store.c and meshms.c. More uniform use of
size_t to dimension memory buffers. Fix some printf(3) style format strings
for 64-bit correctness on 32-bit systems. Use new constant RHIZOME_SIZE_UNSET
instead of -1 to indicate unknown dimension, and explicitly assert its absence
before comparisons and arithmetic, for safety.
Replace some 'int' loop variables with 'unsigned' where appropriate.
Fix bugs discovered in MeshMS bundle private/public key generation and
bundle secret key handling for export/extract commands.
Instrument the first MeshMS test case to aid debugging.
New debug config flag: debug.manifest logs all modifications to all manifest
fields by setter functions.
Rename debug config flag: debug.rhizome_bind -> debug.rhizome_sql_bind.
2013-10-30 12:52:19 +00:00
|
|
|
doc_MessageThreading="Messages sent at the same time, thread differently"
|
|
|
|
setup_MessageThreading() {
|
|
|
|
setup_servald
|
|
|
|
foreach_instance +A +B create_single_identity
|
|
|
|
foreach_instance +A +B setup_logging
|
|
|
|
set_instance +A
|
|
|
|
executeOk_servald meshms send message $SIDA $SIDB "Hello can you hear me"
|
|
|
|
executeOk_servald meshms send message $SIDA $SIDB "Still waiting"
|
|
|
|
set_instance +B
|
|
|
|
executeOk_servald meshms send message $SIDB $SIDA "Help Im trapped in a test case factory"
|
|
|
|
executeOk_servald meshms send message $SIDB $SIDA "Never mind"
|
|
|
|
start_servald_instances +A +B
|
|
|
|
}
|
2013-07-26 05:06:11 +00:00
|
|
|
test_MessageThreading() {
|
2013-07-25 05:19:06 +00:00
|
|
|
set_instance +B
|
2013-07-26 05:06:11 +00:00
|
|
|
wait_until has_unread_messages $SIDB
|
2013-07-25 05:19:06 +00:00
|
|
|
executeOk_servald meshms list messages $SIDB $SIDA
|
2016-10-26 06:33:14 +00:00
|
|
|
assertStdoutGrep --stdout --matches=1 "^0:69:46:$rexp_age:<:Still waiting\$"
|
|
|
|
assertStdoutGrep --stdout --matches=1 "^1:69:24:$rexp_age:<:Hello can you hear me\$"
|
|
|
|
assertStdoutGrep --stdout --matches=1 "^2:60:0:$rexp_age:>:Never mind\$"
|
|
|
|
assertStdoutGrep --stdout --matches=1 "^3:41:0:$rexp_age:>:Help Im trapped in a test case factory\$"
|
2013-07-25 05:19:06 +00:00
|
|
|
assertStdoutLineCount '==' 6
|
|
|
|
set_instance +A
|
2013-07-26 05:06:11 +00:00
|
|
|
wait_until has_unread_messages $SIDA
|
2013-07-26 05:10:06 +00:00
|
|
|
wait_until messages_delivered $SIDA $SIDB
|
2013-07-25 05:19:06 +00:00
|
|
|
executeOk_servald meshms list messages $SIDA $SIDB
|
2016-10-26 06:33:14 +00:00
|
|
|
assertStdoutGrep --stdout --matches=1 "^0:55:60:$rexp_age:<:Never mind\$"
|
|
|
|
assertStdoutGrep --stdout --matches=1 "^1:55:41:$rexp_age:<:Help Im trapped in a test case factory\$"
|
|
|
|
assertStdoutGrep --stdout --matches=1 "^2:46:69:$rexp_age:ACK:delivered\$"
|
|
|
|
assertStdoutGrep --stdout --matches=1 "^3:46:0:$rexp_age:>:Still waiting\$"
|
|
|
|
assertStdoutGrep --stdout --matches=1 "^4:24:0:$rexp_age:>:Hello can you hear me\$"
|
2013-08-02 04:32:56 +00:00
|
|
|
assertStdoutLineCount '==' 7
|
2013-07-25 05:19:06 +00:00
|
|
|
}
|
|
|
|
|
2014-10-27 00:38:02 +00:00
|
|
|
doc_reorderList="New incoming messages force the conversation to the top"
|
|
|
|
setup_reorderList() {
|
|
|
|
setup_servald
|
|
|
|
set_instance +A
|
|
|
|
create_identities 5
|
|
|
|
setup_logging
|
2016-08-17 01:58:36 +00:00
|
|
|
# ensure conversations are known
|
|
|
|
executeOk_servald meshms send message $SIDA1 $SIDA2 "Start"
|
|
|
|
executeOk_servald meshms send message $SIDA1 $SIDA3 "Start"
|
|
|
|
executeOk_servald meshms send message $SIDA1 $SIDA4 "Start"
|
2014-10-27 00:38:02 +00:00
|
|
|
}
|
|
|
|
test_reorderList() {
|
|
|
|
# new incoming messages should bump to the top
|
|
|
|
executeOk_servald meshms send message $SIDA4 $SIDA1 "Bump"
|
|
|
|
executeOk_servald meshms list conversations $SIDA1
|
|
|
|
assertStdoutGrep --stderr --matches=1 "^0:$SIDA4:unread:"
|
|
|
|
executeOk_servald meshms send message $SIDA3 $SIDA1 "Bump"
|
|
|
|
executeOk_servald meshms list conversations $SIDA1
|
|
|
|
assertStdoutGrep --stderr --matches=1 "^0:$SIDA3:unread:"
|
|
|
|
assertStdoutGrep --stderr --matches=1 "^1:$SIDA4:unread:"
|
|
|
|
executeOk_servald meshms send message $SIDA2 $SIDA1 "Bump"
|
|
|
|
executeOk_servald meshms list conversations $SIDA1
|
|
|
|
assertStdoutGrep --stderr --matches=1 "^0:$SIDA2:unread:"
|
|
|
|
assertStdoutGrep --stderr --matches=1 "^1:$SIDA3:unread:"
|
|
|
|
assertStdoutGrep --stderr --matches=1 "^2:$SIDA4:unread:"
|
|
|
|
executeOk_servald meshms send message $SIDA4 $SIDA1 "Bump"
|
|
|
|
executeOk_servald meshms list conversations $SIDA1
|
|
|
|
assertStdoutGrep --stderr --matches=1 "^0:$SIDA4:unread:"
|
|
|
|
assertStdoutGrep --stderr --matches=1 "^1:$SIDA2:unread:"
|
|
|
|
assertStdoutGrep --stderr --matches=1 "^2:$SIDA3:unread:"
|
|
|
|
}
|
|
|
|
|
2013-07-25 05:19:06 +00:00
|
|
|
doc_listConversations="List multiple conversations, with different numbers of messages"
|
|
|
|
setup_listConversations() {
|
|
|
|
setup_servald
|
|
|
|
set_instance +A
|
|
|
|
create_identities 5
|
Refactor manifest: specific setter functions
Replace generic rhizome_manifest_set() and rhizome_manifest_set_ll()
with per-field setter functions, eg, rhizome_manifest_set_filesize().
Struct rhizome_manifest elements for all known fields, to replace the
use of rhizome_manifest_get() and rhizome_manifest_get_ll() everywhere:
sender, recipient, service, name, date, bundle_key.
Add boolean validity flags for binary blob types, to avoid having to compare
with many bytes of all-zero to detect presence, eg, has_sender, has_recipient,
has_author, has_bundle_key. These maintained by the setter functions.
Rename existing manifest struct elements to be the same as their field
names: fileLength -> filesize, journalTail -> tail.
More use of unsigned int, size_t and uint64_t for payload sizes, offsets, byte
counts, etc. especially in rhizome_store.c and meshms.c. More uniform use of
size_t to dimension memory buffers. Fix some printf(3) style format strings
for 64-bit correctness on 32-bit systems. Use new constant RHIZOME_SIZE_UNSET
instead of -1 to indicate unknown dimension, and explicitly assert its absence
before comparisons and arithmetic, for safety.
Replace some 'int' loop variables with 'unsigned' where appropriate.
Fix bugs discovered in MeshMS bundle private/public key generation and
bundle secret key handling for export/extract commands.
Instrument the first MeshMS test case to aid debugging.
New debug config flag: debug.manifest logs all modifications to all manifest
fields by setter functions.
Rename debug config flag: debug.rhizome_bind -> debug.rhizome_sql_bind.
2013-10-30 12:52:19 +00:00
|
|
|
setup_logging
|
2013-07-26 05:43:22 +00:00
|
|
|
# create 3 threads, with all permutations of incoming and outgoing messages
|
2013-07-25 05:19:06 +00:00
|
|
|
executeOk_servald meshms send message $SIDA1 $SIDA2 "Message1"
|
|
|
|
executeOk_servald meshms send message $SIDA3 $SIDA1 "Message2"
|
|
|
|
executeOk_servald meshms send message $SIDA1 $SIDA4 "Message3"
|
|
|
|
executeOk_servald meshms send message $SIDA4 $SIDA1 "Message4"
|
|
|
|
}
|
|
|
|
test_listConversations() {
|
2016-08-10 01:49:22 +00:00
|
|
|
executeOk_servald meshms list conversations --include-message $SIDA1
|
2013-07-30 06:56:01 +00:00
|
|
|
tfw_cat --stdout
|
2016-08-10 01:49:22 +00:00
|
|
|
assertStdoutIs --stderr --line=1 -e '6\n'
|
|
|
|
assertStdoutIs --stderr --line=2 -e '_id:recipient:read:last_message:read_offset:message\n'
|
|
|
|
assertStdoutGrep --stderr --matches=1 ":$SIDA2::0:0:\$"
|
|
|
|
assertStdoutGrep --stderr --matches=1 ":$SIDA3:unread:11:0:Message2\$"
|
2016-08-17 01:58:36 +00:00
|
|
|
assertStdoutGrep --stderr --matches=1 ":$SIDA4:unread:14:0:Message4\$"
|
2013-07-25 05:19:06 +00:00
|
|
|
assertStdoutLineCount '==' 5
|
|
|
|
executeOk_servald meshms list conversations $SIDA1 1
|
|
|
|
assertStdoutLineCount '==' 4
|
|
|
|
executeOk_servald meshms list conversations $SIDA1 1 1
|
|
|
|
assertStdoutLineCount '==' 3
|
2013-07-26 05:43:22 +00:00
|
|
|
# mark all incoming messages as read
|
|
|
|
executeOk_servald meshms read messages $SIDA1
|
2016-08-17 01:58:36 +00:00
|
|
|
# explicitly mark sida3 as known
|
|
|
|
executeOk_servald meshms read messages $SIDA1 $SIDA3
|
2013-07-26 05:43:22 +00:00
|
|
|
executeOk_servald meshms list conversations $SIDA1
|
2013-07-30 06:56:01 +00:00
|
|
|
assertStdoutGrep --stderr --matches=1 ":$SIDA2::0:0\$"
|
|
|
|
assertStdoutGrep --stderr --matches=1 ":$SIDA3::11:11\$"
|
2016-08-17 01:58:36 +00:00
|
|
|
assertStdoutGrep --stderr --matches=1 ":$SIDA4::14:14\$"
|
2013-07-26 05:43:22 +00:00
|
|
|
assertStdoutLineCount '==' 5
|
2014-02-12 04:38:24 +00:00
|
|
|
executeOk_servald meshms list messages $SIDA1 $SIDA2
|
|
|
|
executeOk_servald meshms list messages $SIDA1 $SIDA4
|
2013-07-22 08:25:02 +00:00
|
|
|
}
|
|
|
|
|
2014-02-06 07:07:35 +00:00
|
|
|
doc_sendNoIdentity="Send message from unknown identity"
|
|
|
|
setup_sendNoIdentity() {
|
|
|
|
setup_servald
|
|
|
|
set_instance +A
|
|
|
|
create_identities 2
|
|
|
|
setup_logging
|
|
|
|
SIDX=0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF
|
|
|
|
}
|
|
|
|
test_sendNoIdentity() {
|
|
|
|
executeOk_servald meshms send message $SIDA1 $SIDX "First message"
|
|
|
|
execute $servald meshms send message $SIDX $SIDA1 "First reply"
|
|
|
|
assertExitStatus --stderr == 2
|
|
|
|
executeOk_servald meshms list messages $SIDA1 $SIDX
|
|
|
|
execute $servald meshms list messages $SIDX $SIDA1
|
|
|
|
assertExitStatus --stderr == 2
|
|
|
|
}
|
|
|
|
|
2013-07-22 08:25:02 +00:00
|
|
|
runTests "$@"
|