Skip to content

Commit

Permalink
tests: better diagnose test_max_dgram_size test failures
Browse files Browse the repository at this point in the history
  • Loading branch information
jnpkrn committed Nov 28, 2016
1 parent f321df7 commit 6fad6b7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/ipc_socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,13 +164,18 @@ dgram_verify_msg_size(size_t max_msg_size)
char buf[max_msg_size];

if (socketpair(AF_UNIX, SOCK_DGRAM, 0, sockets) < 0) {
qb_util_perror(LOG_DEBUG, "error calling socketpair()");
goto cleanup_socks;
}

if (set_sock_size(sockets[0], max_msg_size) != 0) {
qb_util_log(LOG_DEBUG, "error set_sock_size(sockets[0],%#x)",
max_msg_size);
goto cleanup_socks;
}
if (set_sock_size(sockets[1], max_msg_size) != 0) {
qb_util_log(LOG_DEBUG, "error set_sock_size(sockets[1],%#x)",
max_msg_size);
goto cleanup_socks;
}

Expand Down
10 changes: 10 additions & 0 deletions tests/check_ipc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1495,7 +1495,17 @@ static void test_max_dgram_size(void)
fail_if(init <= 0);
for (i = 0; i < 100; i++) {
int try = qb_ipcc_verify_dgram_max_msg_size(1000000);
#if 0
ck_assert_int_eq(init, try);
#else
/* extra troubleshooting, report also on i and errno variables;
related: https://github.com/ClusterLabs/libqb/issues/234 */
if (init != try) {
ck_abort_msg("Assertion 'init==try' failed:"
" init==%#x, try==%#x, i=%d, errno=%d",
init, try, i, errno);
}
#endif
}

qb_log_filter_ctl(QB_LOG_STDERR, QB_LOG_FILTER_ADD,
Expand Down

0 comments on commit 6fad6b7

Please sign in to comment.