Signed-off-by: Christophe Milard <christophe.mil...@linaro.org>
---
 .../common_plat/validation/drv/drvshmem/drvshmem.c | 37 ++++++++++++++++++++++
 .../common_plat/validation/drv/drvshmem/drvshmem.h |  1 +
 2 files changed, 38 insertions(+)

diff --git a/test/common_plat/validation/drv/drvshmem/drvshmem.c 
b/test/common_plat/validation/drv/drvshmem/drvshmem.c
index 559c55d..274aeb2 100644
--- a/test/common_plat/validation/drv/drvshmem/drvshmem.c
+++ b/test/common_plat/validation/drv/drvshmem/drvshmem.c
@@ -764,11 +764,48 @@ void drvshmem_test_stress(void)
        CU_ASSERT(odpdrv_shm_print_all("After stress tests") == base);
 }
 
+/*
+ * test basic things: shmem creation, info, share, and free
+ */
+void drvshmem_test_physical(void)
+{
+       shared_test_data_big_t *shared_test_data;
+       odpdrv_shm_t shm;
+       odpdrv_shm_capability_t capa;
+       odpdrv_phys_addr_t phy_addr;
+
+       /* query_capabilities: */
+       CU_ASSERT(odpdrv_shm_capability(&capa) == 0)
+
+       /* if we cannot handle phy queries, end of story... */
+       if (!capa.can_getphy)
+               return;
+
+       /* allocated shared mem (locked, for real physical) */
+       shm = odpdrv_shm_reserve(MEM_NAME,
+                                sizeof(shared_test_data_big_t),
+                                ALIGN_SIZE, ODPDRV_SHM_LOCK);
+       CU_ASSERT(ODPDRV_SHM_INVALID != shm);
+
+       /* query for the physical address and check its validity as we can: */
+       shared_test_data = odpdrv_shm_addr(shm);
+
+       phy_addr = odpdrv_getphy((void *)shared_test_data);
+       CU_ASSERT(phy_addr != 0);
+
+       /* Also run the debug dump function: */
+       odpdrv_dumpphy((void *)shared_test_data,
+                      sizeof(shared_test_data_big_t));
+
+       CU_ASSERT(0 == odpdrv_shm_free_by_handle(shm));
+}
+
 odp_testinfo_t drvshmem_suite[] = {
        ODP_TEST_INFO(drvshmem_test_basic),
        ODP_TEST_INFO(drvshmem_test_reserve_after_fork),
        ODP_TEST_INFO(drvshmem_test_singleva_after_fork),
        ODP_TEST_INFO(drvshmem_test_stress),
+       ODP_TEST_INFO(drvshmem_test_physical),
        ODP_TEST_INFO_NULL,
 };
 
diff --git a/test/common_plat/validation/drv/drvshmem/drvshmem.h 
b/test/common_plat/validation/drv/drvshmem/drvshmem.h
index f4c26a1..056c0de 100644
--- a/test/common_plat/validation/drv/drvshmem/drvshmem.h
+++ b/test/common_plat/validation/drv/drvshmem/drvshmem.h
@@ -14,6 +14,7 @@ void drvshmem_test_basic(void);
 void drvshmem_test_reserve_after_fork(void);
 void drvshmem_test_singleva_after_fork(void);
 void drvshmem_test_stress(void);
+void drvshmem_test_physical(void);
 
 /* test arrays: */
 extern odp_testinfo_t drvshmem_suite[];
-- 
2.7.4

Reply via email to