Checking that the block size returned by odp_shm_info() matches
the exported block length.

Signed-off-by: Christophe Milard <christophe.mil...@linaro.org>
---
 test/linux-generic/validation/api/shmem/shmem_odp2.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/test/linux-generic/validation/api/shmem/shmem_odp2.c 
b/test/linux-generic/validation/api/shmem/shmem_odp2.c
index e39dc76..7d8c682 100644
--- a/test/linux-generic/validation/api/shmem/shmem_odp2.c
+++ b/test/linux-generic/validation/api/shmem/shmem_odp2.c
@@ -28,6 +28,7 @@ int main(int argc, char *argv[])
        odp_instance_t odp1;
        odp_instance_t odp2;
        odp_shm_t shm;
+       odp_shm_info_t  info;
        test_shared_data_t *test_shared_data;
 
        /* odp init: */
@@ -59,6 +60,13 @@ int main(int argc, char *argv[])
                return 1;
        }
 
+       /* check that the read size matches the allocated size (in other ODP):*/
+       if ((odp_shm_info(shm, &info)) ||
+           (info.size != sizeof(*test_shared_data))) {
+               fprintf(stderr, "error: odp_shm_info failed.\n");
+               return 1;
+       }
+
        test_shared_data = odp_shm_addr(shm);
        if (test_shared_data == NULL) {
                fprintf(stderr, "error: odp_shm_addr failed.\n");
-- 
2.7.4

Reply via email to