Skip to content

Commit

Permalink
Low: tests: Add dgram max size detection test
Browse files Browse the repository at this point in the history
  • Loading branch information
davidvossel committed Jul 23, 2013
1 parent a881c14 commit 92e7dd7
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions tests/check_ipc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1195,6 +1195,37 @@ START_TEST(test_ipc_service_ref_count_us)
}
END_TEST

static void test_max_dgram_size(void)
{
/* most implementations will not let you set a dgram buffer
* of 1 million bytes. This test verifies that the we can detect
* the max dgram buffersize regardless, and that the value we detect
* is consistent. */
int32_t init;
int32_t i;

qb_log_filter_ctl(QB_LOG_STDERR, QB_LOG_FILTER_REMOVE,
QB_LOG_FILTER_FILE, "*", LOG_TRACE);

init = qb_ipcc_verify_dgram_max_msg_size(1000000);
fail_if(init <= 0);
for (i = 0; i < 100; i++) {
int try = qb_ipcc_verify_dgram_max_msg_size(1000000);
ck_assert_int_eq(init, try);
}

qb_log_filter_ctl(QB_LOG_STDERR, QB_LOG_FILTER_ADD,
QB_LOG_FILTER_FILE, "*", LOG_TRACE);
}

START_TEST(test_ipc_max_dgram_size)
{
qb_enter();
test_max_dgram_size();
qb_leave();
}
END_TEST

static Suite *
make_shm_suite(void)
{
Expand Down Expand Up @@ -1259,6 +1290,11 @@ make_soc_suite(void)
Suite *s = suite_create("socket");
TCase *tc;

tc = tcase_create("ipc_max_dgram_size");
tcase_add_test(tc, test_ipc_max_dgram_size);
tcase_set_timeout(tc, 30);
suite_add_tcase(s, tc);

tc = tcase_create("ipc_server_fail_soc");
tcase_add_test(tc, test_ipc_server_fail_soc);
tcase_set_timeout(tc, 6);
Expand Down

0 comments on commit 92e7dd7

Please sign in to comment.