[CRIU] [PATCH 2/3] zdtm: update static/shm test due to ns isolation changes

Kinsbursky Stanislav skinsbursky at openvz.org
Tue Feb 7 09:21:47 EST 2012



Signed-off-by: Stanislav Kinsbursky <skinsbursky at parallels.com>

---
 test/zdtm/live/static/shm.c |   17 ++++++-----------
 1 files changed, 6 insertions(+), 11 deletions(-)

diff --git a/test/zdtm/live/static/shm.c b/test/zdtm/live/static/shm.c
index d57e2e2..1fabd6d 100644
--- a/test/zdtm/live/static/shm.c
+++ b/test/zdtm/live/static/shm.c
@@ -23,8 +23,6 @@ TEST_OPTION(shmem_size, uint, "Size of shared memory segment", 0);
 
 #define INIT_CRC	(~0)
 
-char *filename;
-
 static int fill_shm_seg(int id, size_t size)
 {
 	uint8_t *mem;
@@ -102,24 +100,22 @@ static int check_shm_key(int key, size_t size)
 	return check_shm_id(id, size);
 }
 
-static void test_fn(void)
+static int test_fn(int argc, char **argv)
 {
 	key_t key;
 	int shm;
 	int fail_count = 0;
-	int ret;
+	int ret = -1;
 
-	key = ftok(filename, 822155666);
+	key = ftok(argv[0], 822155666);
 	if (key == -1) {
 		err("Can't make key");
 		goto out;
 	}
 
 	shm = prepare_shm(key, shmem_size);
-	if (shm == -1) {
-		fail_count++;
+	if (shm == -1)
 		goto out;
-	}
 
 	test_daemon();
 	test_waitsig();
@@ -170,18 +166,17 @@ out_shm:
 	if (fail_count == 0)
 		pass();
 out:
-	return;
+	return ret;
 }
 
 
 int main(int argc, char **argv)
 {
-	filename = argv[0];
 #ifdef NEW_IPC_NS
 	test_init_ns(argc, argv, CLONE_NEWIPC, test_fn);
 #else
 	test_init(argc, argv);
-	test_fn();
+	test_fn(argc, argv);
 #endif
 	return 0;
 }



More information about the CRIU mailing list