diff options
-rw-r--r-- | tests/test_smaf.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/test_smaf.c b/tests/test_smaf.c index 0f3d206..5656a23 100644 --- a/tests/test_smaf.c +++ b/tests/test_smaf.c @@ -91,6 +91,9 @@ static void test_create_non_page_aligned_mmap(void) int ret; int fd; void *data; + char reference[LENGTH+1]; + char *pt; + int i; ret = smaf_create_buffer(LENGTH+1, O_CLOEXEC | O_RDWR, "smaf-optee-allocator", &fd); @@ -100,6 +103,16 @@ static void test_create_non_page_aligned_mmap(void) } data = mmap(0, LENGTH+1, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); + pt = (char *)data; + + for (i=0; i<LENGTH+1; i++) + reference[i] = i; + memcpy(pt, reference, LENGTH+1); + while (!memcmp(pt, reference, LENGTH+1)) { + printf("Data did not changed\n"); + sleep(10); + } + printf("Data Changed !!! Wrong\n"); munmap(data, LENGTH+1); close(fd); |