diff mbox series

[API-NEXT,v4,7/8] validation: pool: add packet info test

Message ID 1509091212-14398-8-git-send-email-odpbot@yandex.ru
State New
Headers show
Series [API-NEXT,v4,1/8] api: pool: relax packet pool param num | expand

Commit Message

Github ODP bot Oct. 27, 2017, 8 a.m. UTC
From: Petri Savolainen <petri.savolainen@linaro.org>


Added odp_pool_info() test for packet pools.

Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org>

---
/** Email created from pull request 234 (psavol:next-pool-param)
 ** https://github.com/Linaro/odp/pull/234
 ** Patch: https://github.com/Linaro/odp/pull/234.patch
 ** Base sha: d61d32590d1772b70b8dcd0d0ec44d29029d7443
 ** Merge commit sha: 436021e0a0bff8bda38fa420ebbc4545c97a7fc8
 **/
 test/validation/api/pool/pool.c | 28 ++++++++++++++++++++++++++++
 test/validation/api/pool/pool.h |  1 +
 2 files changed, 29 insertions(+)
diff mbox series

Patch

diff --git a/test/validation/api/pool/pool.c b/test/validation/api/pool/pool.c
index 461715cc9..84c17720d 100644
--- a/test/validation/api/pool/pool.c
+++ b/test/validation/api/pool/pool.c
@@ -191,12 +191,40 @@  void pool_test_alloc_packet_subparam(void)
 	CU_ASSERT(odp_pool_destroy(pool) == 0);
 }
 
+void pool_test_info_packet(void)
+{
+	odp_pool_t pool;
+	odp_pool_info_t info;
+	odp_pool_param_t param;
+	const char pool_name[] = "test_pool_name";
+
+	odp_pool_param_init(&param);
+
+	param.type     = ODP_POOL_PACKET;
+	param.pkt.num  = PKT_NUM;
+	param.pkt.len  = PKT_LEN;
+
+	pool = odp_pool_create(pool_name, &param);
+	CU_ASSERT_FATAL(pool != ODP_POOL_INVALID);
+
+	CU_ASSERT_FATAL(odp_pool_info(pool, &info) == 0);
+
+	CU_ASSERT(strncmp(pool_name, info.name, sizeof(pool_name)) == 0);
+	CU_ASSERT(info.params.type    == ODP_POOL_PACKET);
+	CU_ASSERT(info.params.pkt.num == param.pkt.num);
+	CU_ASSERT(info.params.pkt.len == param.pkt.len);
+	CU_ASSERT(info.pkt.max_num    >= param.pkt.num);
+
+	CU_ASSERT(odp_pool_destroy(pool) == 0);
+}
+
 odp_testinfo_t pool_suite[] = {
 	ODP_TEST_INFO(pool_test_create_destroy_buffer),
 	ODP_TEST_INFO(pool_test_create_destroy_packet),
 	ODP_TEST_INFO(pool_test_create_destroy_timeout),
 	ODP_TEST_INFO(pool_test_alloc_packet),
 	ODP_TEST_INFO(pool_test_alloc_packet_subparam),
+	ODP_TEST_INFO(pool_test_info_packet),
 	ODP_TEST_INFO(pool_test_lookup_info_print),
 	ODP_TEST_INFO_NULL,
 };
diff --git a/test/validation/api/pool/pool.h b/test/validation/api/pool/pool.h
index 3f8f5ebce..b284524e4 100644
--- a/test/validation/api/pool/pool.h
+++ b/test/validation/api/pool/pool.h
@@ -16,6 +16,7 @@  void pool_test_create_destroy_timeout(void);
 void pool_test_lookup_info_print(void);
 void pool_test_alloc_packet(void);
 void pool_test_alloc_packet_subparam(void);
+void pool_test_info_packet(void);
 
 /* test arrays: */
 extern odp_testinfo_t pool_suite[];