[CRIU] [PATCH] test/zdtm : shm-mp fix page size

Laurent Dufour ldufour at linux.vnet.ibm.com
Thu Jun 9 08:59:20 PDT 2016


Test should not assume that page size is 4096.

The test was failing on ppc64 where page size is usually 64K.

Signed-off-by: Laurent Dufour <ldufour at linux.vnet.ibm.com>
---
 test/zdtm/static/shm-mp.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/test/zdtm/static/shm-mp.c b/test/zdtm/static/shm-mp.c
index b297d766ddf1..e29904f3adac 100644
--- a/test/zdtm/static/shm-mp.c
+++ b/test/zdtm/static/shm-mp.c
@@ -73,7 +73,7 @@ int main(int argc, char **argv)
 		goto out;
 	}
 
-	id = shmget(key, 2 * 4096, 0777 | IPC_CREAT | IPC_EXCL);
+	id = shmget(key, 2 * PAGE_SIZE, 0777 | IPC_CREAT | IPC_EXCL);
 	if (id == -1) {
 		pr_perror("Can't make seg");
 		goto out;
@@ -86,9 +86,9 @@ int main(int argc, char **argv)
 	}
 
 	mem[0] = 'R';
-	mem[4096] = 'W';
+	mem[PAGE_SIZE] = 'W';
 
-	if (mprotect(mem, 4096, PROT_READ)) {
+	if (mprotect(mem, PAGE_SIZE, PROT_READ)) {
 		pr_perror("Can't mprotect shmem");
 		goto out_dt;
 	}
@@ -98,7 +98,7 @@ int main(int argc, char **argv)
 
 	if (check_prot(mem, 'R', PROT_READ))
 		f++;
-	if (check_prot(mem + 4096, 'W', PROT_READ | PROT_WRITE))
+	if (check_prot(mem + PAGE_SIZE, 'W', PROT_READ | PROT_WRITE))
 		f++;
 
 
-- 
1.9.1



More information about the CRIU mailing list