Commit 3fce5a27 authored by Federico Vaga's avatar Federico Vaga

tst: improve test for async_recv

- check immediately if the total number of received message is correct
- we should not receive None as message
Signed-off-by: Federico Vaga's avatarFederico Vaga <federico.vaga@cern.ch>
parent 2aa706b3
......@@ -119,21 +119,24 @@ class TestHmq(object):
trtl_cpu.load_application_file(trtl_binary_hmq_async_recv)
trtl_cpu.enable()
time.sleep(0.1)
time.sleep(0.5)
for hmq in trtl_cpu.hmq:
tot = trtl_cpu.trtl_dev.rom.hmq[trtl_cpu.idx_cpu][hmq.idx_hmq].entries
sa = hmq.get_stats()
assert sb[hmq]["message_received"] + tot == sa["message_received"]
for hmq in trtl_cpu.hmq:
tot = trtl_cpu.trtl_dev.rom.hmq[trtl_cpu.idx_cpu][hmq.idx_hmq].entries
for n in range(tot):
msg = hmq.recv_msg()
assert msg is not None
payload = list(msg.payload)
for i, val in enumerate(payload):
if i >= msg.header.len:
break
assert i == val
sa = hmq.get_stats()
assert sb[hmq]["message_received"] + tot == sa["message_received"]
def __do_sync_msg(self, hmq, trtl_msg):
msg_r_a = []
# I do not understand why I can't make Pool() working.
......
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