Merge pull request #2662 from sigiesec/fix-hwm-tests-race-2

Problem: occasional test failures due to messages not (yet) received in test assertion
This commit is contained in:
Luca Boccassi 2017-08-07 10:51:11 +01:00 committed by GitHub
commit 2564c8e5b9
2 changed files with 7 additions and 3 deletions

View File

@ -53,9 +53,12 @@ int test_defaults ()
// Send until we block // Send until we block
int send_count = 0; int send_count = 0;
while (send_count < MAX_SENDS && zmq_send (connect_socket, NULL, 0, ZMQ_DONTWAIT) == 0) while (send_count < MAX_SENDS
&& zmq_send (connect_socket, NULL, 0, ZMQ_DONTWAIT) == 0)
++send_count; ++send_count;
msleep (SETTLE_TIME);
// Now receive all sent messages // Now receive all sent messages
int recv_count = 0; int recv_count = 0;
while (zmq_recv (bind_socket, NULL, 0, ZMQ_DONTWAIT) == 0) while (zmq_recv (bind_socket, NULL, 0, ZMQ_DONTWAIT) == 0)

View File

@ -58,10 +58,11 @@ int test_defaults (int send_hwm, int msgCnt)
while (send_count < msgCnt && zmq_send (pub_socket, NULL, 0, ZMQ_DONTWAIT) == 0) while (send_count < msgCnt && zmq_send (pub_socket, NULL, 0, ZMQ_DONTWAIT) == 0)
++send_count; ++send_count;
msleep (SETTLE_TIME);
// Now receive all sent messages // Now receive all sent messages
int recv_count = 0; int recv_count = 0;
while (0 == zmq_recv (sub_socket, NULL, 0, ZMQ_DONTWAIT)) while (0 == zmq_recv (sub_socket, NULL, 0, ZMQ_DONTWAIT)) {
{
++recv_count; ++recv_count;
} }