[CRIU] [PATCH] [POC] zdtm: check in-flight connections
Andrey Vagin
avagin at openvz.org
Wed Jun 15 12:14:43 PDT 2016
From: Andrew Vagin <avagin at virtuozzo.com>
Signed-off-by: Andrew Vagin <avagin at virtuozzo.com>
---
test/zdtm/static/Makefile | 2 ++
test/zdtm/static/socket_listen.c | 15 +++++++++++++++
test/zdtm/static/socket_listen02.c | 1 +
test/zdtm/static/socket_listen02.desc | 1 +
4 files changed, 19 insertions(+)
create mode 120000 test/zdtm/static/socket_listen02.c
create mode 100644 test/zdtm/static/socket_listen02.desc
diff --git a/test/zdtm/static/Makefile b/test/zdtm/static/Makefile
index 681d5fa..8063744 100644
--- a/test/zdtm/static/Makefile
+++ b/test/zdtm/static/Makefile
@@ -28,6 +28,7 @@ TST_NOFILE = \
sched_prio00 \
sched_policy00 \
socket_listen \
+ socket_listen02 \
socket_listen6 \
socket_udp \
socket6_udp \
@@ -389,6 +390,7 @@ socket-tcp6-local: override CFLAGS += -D ZDTM_TCP_LOCAL -D ZDTM_IPV6
socket-tcp-local: override CFLAGS += -D ZDTM_TCP_LOCAL
socket-tcp-nfconntrack: override CFLAGS += -D ZDTM_TCP_LOCAL -DZDTM_CONNTRACK
socket_listen6: override CFLAGS += -D ZDTM_IPV6
+socket_listen02: override CFLAGS += -D ZDTM_IN_FLIGHT_CONNECTION
sigpending: override LDLIBS += -lrt
vdso01: override LDLIBS += -lrt
mntns_link_remap: override CFLAGS += -DZDTM_LINK_REMAP
diff --git a/test/zdtm/static/socket_listen.c b/test/zdtm/static/socket_listen.c
index f11d379..fc3e430 100644
--- a/test/zdtm/static/socket_listen.c
+++ b/test/zdtm/static/socket_listen.c
@@ -21,6 +21,7 @@ const char *test_author = "Stanislav Kinsbursky <skinsbursky at openvz.org>";
#include <stdlib.h>
#include <wait.h>
#include <netinet/tcp.h>
+#include <fcntl.h>
static int port = 8880;
@@ -48,9 +49,23 @@ int main(int argc, char **argv)
return 1;
}
+#ifdef ZDTM_IN_FLIGHT_CONNECTION
+ fd = tcp_init_client(ZDTM_FAMILY, "localhost", port);
+ if (fd < 0)
+ return 1;
+#endif
+
test_daemon();
test_waitsig();
+#ifdef ZDTM_IN_FLIGHT_CONNECTION
+ fcntl(fd_s, F_SETFL, O_NONBLOCK);
+ fd = tcp_accept_server(fd_s);
+ if (fd < 0)
+ pr_err("Skip in-flight connection\n");
+ fcntl(fd_s, F_SETFL, 0);
+#endif
+
sigemptyset(&sa.sa_mask);
if (sigaction(SIGCHLD, &sa, NULL))
pr_perror("Can't set SIGCHLD handler");
diff --git a/test/zdtm/static/socket_listen02.c b/test/zdtm/static/socket_listen02.c
new file mode 120000
index 0000000..d026b3b
--- /dev/null
+++ b/test/zdtm/static/socket_listen02.c
@@ -0,0 +1 @@
+socket_listen.c
\ No newline at end of file
diff --git a/test/zdtm/static/socket_listen02.desc b/test/zdtm/static/socket_listen02.desc
new file mode 100644
index 0000000..b3122bc
--- /dev/null
+++ b/test/zdtm/static/socket_listen02.desc
@@ -0,0 +1 @@
+{'opts' : '--tcp-established --skip-in-flight'}
--
2.7.4
More information about the CRIU
mailing list