UT/sock.c:add test of spdk_group_get_ctx()
Signed-off-by: KanKuo <kuox.kan@intel.com> Change-Id: Ib38415b378d099d30dc165dd785948e681b70b5d Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15578 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: wanghailiang <hailiangx.e.wang@intel.com> Reviewed-by: Xiaoxiang Zhang <xiaoxiangx.zhang@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Community-CI: Mellanox Build Bot
This commit is contained in:
parent
e5ed83fe8b
commit
8a1f5ccf07
@ -1216,6 +1216,25 @@ override_impl_opts(void)
|
||||
spdk_sock_close(&csock);
|
||||
}
|
||||
|
||||
static void
|
||||
ut_sock_group_get_ctx(void)
|
||||
{
|
||||
void *test_ctx = (void *)0xff0000000;
|
||||
void *test_ctx1 = (void *)0xfff000000;
|
||||
void *test_ctx2 = (void *)0xffff00000;
|
||||
struct spdk_sock_group group;
|
||||
|
||||
/* The return should be NULL */
|
||||
test_ctx = spdk_sock_group_get_ctx(NULL);
|
||||
CU_ASSERT(test_ctx == NULL);
|
||||
|
||||
/* The group.ctx should be changed */
|
||||
group.ctx = test_ctx1;
|
||||
test_ctx2 = spdk_sock_group_get_ctx(&group);
|
||||
|
||||
CU_ASSERT(test_ctx1 == test_ctx2);
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
@ -1238,6 +1257,7 @@ main(int argc, char **argv)
|
||||
CU_ADD_TEST(suite, posix_sock_impl_get_set_opts);
|
||||
CU_ADD_TEST(suite, ut_sock_map);
|
||||
CU_ADD_TEST(suite, override_impl_opts);
|
||||
CU_ADD_TEST(suite, ut_sock_group_get_ctx);
|
||||
|
||||
CU_basic_set_mode(CU_BRM_VERBOSE);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user