[CRIU] [PATCH] zdtm: add a test with a dead thread leader and alive threads

Andrey Vagin avagin at openvz.org
Thu Apr 23 01:14:11 PDT 2015


This case is not supported now
[root at avagin-fc19-cr criu]# bash test/zdtm.sh -r static/pthread02
Execute static/pthread02
./pthread02 --pidfile=pthread02.pid --outfile=pthread02.out
Dump 3186
WARNING: pthread02 returned 1 and left running for debug needs
Test: zdtm/live/static/pthread02, Result: FAIL
==================================== ERROR ====================================
Test: zdtm/live/static/pthread02, Namespace:
Dump log   : /root/git/locks/criu/test/dump/static/pthread02/3186/1/dump.log
--------------------------------- grep Error ---------------------------------
(00.033195) Error (cr-dump.c:886): Zombies with threads are not supported
(00.033256) Error (cr-dump.c:1943): Dumping FAILED.
------------------------------------- END -------------------------------------
================================= ERROR OVER =================================

Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
 test/zdtm/live/static/Makefile    |  2 ++
 test/zdtm/live/static/pthread02.c | 43 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 45 insertions(+)
 create mode 100644 test/zdtm/live/static/pthread02.c

diff --git a/test/zdtm/live/static/Makefile b/test/zdtm/live/static/Makefile
index c4bed4f..33a91f1 100644
--- a/test/zdtm/live/static/Makefile
+++ b/test/zdtm/live/static/Makefile
@@ -46,6 +46,7 @@ TST_NOFILE	=				\
 		pipe02				\
 		pthread00			\
 		pthread01			\
+		pthread02			\
 		vdso00				\
 		vdso01				\
 		utsname				\
@@ -291,6 +292,7 @@ unlink_largefile:	override CFLAGS += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURC
 inotify_system_nodel:	override CFLAGS += -DNODEL
 pthread00:		override LDLIBS += -pthread
 pthread01:		override LDLIBS += -pthread
+pthread02:		override LDLIBS += -pthread
 sigpending:		override LDLIBS += -pthread
 sigaltstack:		override LDLIBS += -pthread
 shm:			override CFLAGS += -DNEW_IPC_NS
diff --git a/test/zdtm/live/static/pthread02.c b/test/zdtm/live/static/pthread02.c
new file mode 100644
index 0000000..186271b
--- /dev/null
+++ b/test/zdtm/live/static/pthread02.c
@@ -0,0 +1,43 @@
+/*
+ * A simple testee program with threads
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include <pthread.h>
+
+#include "zdtmtst.h"
+
+const char *test_doc	= "Create a thread with a dead leader\n";
+const char *test_author	= "Andrew Vagin <avagin at openvz.org";
+
+
+static void *thread_func(void *args)
+{
+	test_waitsig();
+	pass();
+	exit(0);
+}
+
+int main(int argc, char *argv[])
+{
+	pthread_t th1;
+	int ret;
+
+	test_init(argc, argv);
+
+
+	ret = pthread_create(&th1, NULL, &thread_func, NULL);
+
+	if (ret) {
+		fail("Can't pthread_create");
+		exit(1);
+	}
+
+	test_daemon();
+
+	pthread_exit(NULL);
+	return 0;
+}
-- 
2.1.0



More information about the CRIU mailing list