diff mbox

[API-NEXT,2/2] test: shm: checking exported vs imported block length

Message ID 1482318693-5086-2-git-send-email-christophe.milard@linaro.org
State Accepted
Commit 4d0b7588251ed6a5de781f9220c3ace2831a68b2
Headers show

Commit Message

Christophe Milard Dec. 21, 2016, 11:11 a.m. UTC
Checking that the block size returned by odp_shm_info() matches
the exported block length.

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

---
 test/linux-generic/validation/api/shmem/shmem_odp2.c | 8 ++++++++
 1 file changed, 8 insertions(+)

-- 
2.7.4
diff mbox

Patch

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");