[CRIU] [PATCH 1/2] zdtm: transition/ipc test update

Kinsbursky Stanislav skinsbursky at openvz.org
Wed Feb 15 03:49:43 EST 2012


Added cloning to new IPC ns depends on built option.

Signed-off-by: Stanislav Kinsbursky <skinsbursky at openvz.org>

---
 test/zdtm/live/transition/Makefile |    1 +
 test/zdtm/live/transition/ipc.c    |   18 +++++++++++++++---
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/test/zdtm/live/transition/Makefile b/test/zdtm/live/transition/Makefile
index 20fbb12..64e004b 100644
--- a/test/zdtm/live/transition/Makefile
+++ b/test/zdtm/live/transition/Makefile
@@ -56,6 +56,7 @@ $(TST):	$(LIB)
 
 ptrace.o:	override CFLAGS += -pthread
 ptrace:		override LDFLAGS += -pthread
+ipc:		override CFLAGS += -DNEW_IPC_NS
 
 %: %.sh
 	cp $< $@
diff --git a/test/zdtm/live/transition/ipc.c b/test/zdtm/live/transition/ipc.c
index 643e4c6..5910f13 100644
--- a/test/zdtm/live/transition/ipc.c
+++ b/test/zdtm/live/transition/ipc.c
@@ -1,3 +1,6 @@
+#define _GNU_SOURCE
+#include <sched.h>
+
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
@@ -77,7 +80,7 @@ static int child(key_t key)
 	return res;
 }
 
-int main(int argc, char **argv)
+static int test_fn(int argc, char **argv)
 {
 	key_t key;
 	int sem, shm, pid1, pid2;
@@ -86,8 +89,6 @@ int main(int argc, char **argv)
 	uint32_t crc;
 	int ret;
 
-	test_init(argc, argv);
-
 	key = ftok(argv[0], 822155650);
 	if (key == -1) {
 		err("Can't make key");
@@ -197,3 +198,14 @@ out_sem:
 out:
 	return 0;
 }
+
+int main(int argc, char **argv)
+{
+#ifdef NEW_IPC_NS
+	test_init_ns(argc, argv, CLONE_NEWIPC, test_fn);
+#else
+	test_init(argc, argv);
+	test_fn(argc, argv);
+#endif
+	return 0;
+}



More information about the CRIU mailing list