Problem: missing information on assertion failure

Solution: include sent and received counts on assertion failure
This commit is contained in:
Simon Giesecke 2019-04-02 18:52:48 +02:00
parent d328f90bb7
commit b9041bf78c

View File

@ -153,13 +153,16 @@ int test_blocking (int send_hwm_, int msg_cnt_, const char *endpoint)
} else if (-1 == rc) { } else if (-1 == rc) {
// if the PUB socket blocks due to HWM, errno should be EAGAIN: // if the PUB socket blocks due to HWM, errno should be EAGAIN:
blocked_count++; blocked_count++;
TEST_ASSERT_EQUAL_INT (EAGAIN, errno); TEST_ASSERT_FAILURE_ERRNO (EAGAIN, -1);
recv_count += receive (sub_socket, &is_termination); recv_count += receive (sub_socket, &is_termination);
} }
} }
// if send_hwm_ < msg_cnt_, we should block at least once: // if send_hwm_ < msg_cnt_, we should block at least once:
TEST_ASSERT_GREATER_THAN_INT (0, blocked_count); char counts_string[128];
snprintf (counts_string, sizeof counts_string - 1,
"sent = %i, received = %i", send_count, recv_count);
TEST_ASSERT_GREATER_THAN_INT_MESSAGE (0, blocked_count, counts_string);
// dequeue SUB socket again, to make sure XPUB has space to send the termination message // dequeue SUB socket again, to make sure XPUB has space to send the termination message
recv_count += receive (sub_socket, &is_termination); recv_count += receive (sub_socket, &is_termination);