diff mbox

[API-NEXT,2/3] test: api: shm: test using the same block name multiple times

Message ID 1478598570-2846-3-git-send-email-christophe.milard@linaro.org
State Accepted
Commit 4ee154864b47712a45cfdb23ea6c22b46bfb1abf
Headers show

Commit Message

Christophe Milard Nov. 8, 2016, 9:49 a.m. UTC
Make sure that many memory blocks can be created with the name.

Signed-off-by: Christophe Milard <christophe.milard@linaro.org>

---
 test/common_plat/validation/api/shmem/shmem.c | 9 +++++++++
 1 file changed, 9 insertions(+)

-- 
2.7.4
diff mbox

Patch

diff --git a/test/common_plat/validation/api/shmem/shmem.c b/test/common_plat/validation/api/shmem/shmem.c
index 6ea92d9..0e757a7 100644
--- a/test/common_plat/validation/api/shmem/shmem.c
+++ b/test/common_plat/validation/api/shmem/shmem.c
@@ -111,6 +111,7 @@  void shmem_test_basic(void)
 {
 	pthrd_arg thrdarg;
 	odp_shm_t shm;
+	odp_shm_t shm2;
 	shared_test_data_t *shared_test_data;
 	odp_cpumask_t unused;
 
@@ -120,7 +121,15 @@  void shmem_test_basic(void)
 	CU_ASSERT(odp_shm_to_u64(shm) !=
 					odp_shm_to_u64(ODP_SHM_INVALID));
 
+	/* also check that another reserve with same name is accepted: */
+	shm2 = odp_shm_reserve(MEM_NAME,
+			       sizeof(shared_test_data_t), ALIGN_SIZE, 0);
+	CU_ASSERT(ODP_SHM_INVALID != shm2);
+	CU_ASSERT(odp_shm_to_u64(shm2) !=
+					odp_shm_to_u64(ODP_SHM_INVALID));
+
 	CU_ASSERT(0 == odp_shm_free(shm));
+	CU_ASSERT(0 == odp_shm_free(shm2));
 	CU_ASSERT(ODP_SHM_INVALID == odp_shm_lookup(MEM_NAME));
 
 	shm = odp_shm_reserve(MEM_NAME,