[CRIU] [PATCH 1/2] zdtm: add a new test case, which create processes in a loop

Andrey Vagin avagin at openvz.org
Tue Jun 25 14:27:08 EDT 2013


and this processes live a short period of time. This test case is needed
for testing snapshots.

https://bugzilla.openvz.org/show_bug.cgi?id=2636
Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
 test/zdtm/live/transition/Makefile | 2 ++
 test/zdtm/live/transition/fork.c   | 6 +++++-
 test/zdtm/live/transition/fork2.c  | 1 +
 3 files changed, 8 insertions(+), 1 deletion(-)
 create mode 120000 test/zdtm/live/transition/fork2.c

diff --git a/test/zdtm/live/transition/Makefile b/test/zdtm/live/transition/Makefile
index d8e39d6..66524e3 100644
--- a/test/zdtm/live/transition/Makefile
+++ b/test/zdtm/live/transition/Makefile
@@ -10,6 +10,7 @@ TST_NOFILE	=	\
 		ptrace		\
 		epoll		\
 		fork		\
+		fork2		\
 
 TST_FILE	=	\
 		file_read 	\
@@ -59,6 +60,7 @@ $(TST):	$(LIB)
 ptrace.o:	override CFLAGS += -pthread
 ptrace:		override LDFLAGS += -pthread
 ipc:		override CFLAGS += -DNEW_IPC_NS
+fork2:		override CFLAGS += -D FORK2
 
 %: %.sh
 	cp $< $@
diff --git a/test/zdtm/live/transition/fork.c b/test/zdtm/live/transition/fork.c
index 33bfec0..9914a2e 100644
--- a/test/zdtm/live/transition/fork.c
+++ b/test/zdtm/live/transition/fork.c
@@ -29,8 +29,12 @@ int main(int argc, char **argv)
 			goto out;
 		}
 
-		if (pid == 0)
+		if (pid == 0) {
+#ifdef FORK2
+			usleep(10000);
+#endif
 			exit(0);
+		}
 
 		while ((wpid = wait(&status)) == -1 && errno == EINTR);
 
diff --git a/test/zdtm/live/transition/fork2.c b/test/zdtm/live/transition/fork2.c
new file mode 120000
index 0000000..c2e58c0
--- /dev/null
+++ b/test/zdtm/live/transition/fork2.c
@@ -0,0 +1 @@
+fork.c
\ No newline at end of file
-- 
1.8.3.1



More information about the CRIU mailing list