[CRIU] [PATCH 1/5] zdtm: check one end of socketpair with data (v2)
Andrey Vagin
avagin at openvz.org
Sun Aug 2 22:27:41 PDT 2015
This test fails currently, because these data are not restored.
v2: remove the test from the execution list.
Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
test/zdtm/live/static/Makefile | 1 +
test/zdtm/live/static/socket_close_data.c | 43 +++++++++++++++++++++++++++++++
2 files changed, 44 insertions(+)
create mode 100644 test/zdtm/live/static/socket_close_data.c
diff --git a/test/zdtm/live/static/Makefile b/test/zdtm/live/static/Makefile
index fe636d6..7575f7d 100644
--- a/test/zdtm/live/static/Makefile
+++ b/test/zdtm/live/static/Makefile
@@ -33,6 +33,7 @@ TST_NOFILE = \
socket6_udp \
socket_udplite \
socket_aio \
+ socket_close_data \
packet_sock \
packet_sock_mmap \
sock_filter \
diff --git a/test/zdtm/live/static/socket_close_data.c b/test/zdtm/live/static/socket_close_data.c
new file mode 100644
index 0000000..a23eff6
--- /dev/null
+++ b/test/zdtm/live/static/socket_close_data.c
@@ -0,0 +1,43 @@
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+
+#include "zdtmtst.h"
+
+const char *test_doc = "Check one end of socketpair with data";
+const char *test_author = "Andrew Vagin <avagin at openvz.org";
+
+#define MSG "hello"
+int main(int argc, char **argv)
+{
+ int sks[2], ret;
+ char buf[1024];
+
+ test_init(argc, argv);
+
+ if (socketpair(PF_UNIX, SOCK_DGRAM | SOCK_NONBLOCK, 0, sks) < 0) {
+ err("socketpair");
+ return 1;
+ }
+
+ if (write(sks[1], MSG, sizeof(MSG)) != sizeof(MSG)) {
+ err("write");
+ return 1;
+ }
+ close(sks[1]);
+
+ test_daemon();
+ test_waitsig();
+
+ ret = read(sks[0], buf, sizeof(MSG));
+ buf[ret > 0 ? ret : 0] = 0;
+ if (ret != sizeof(MSG)) {
+ fail("%d: %s", ret, buf);
+ return 1;
+ }
+
+ pass();
+ return 0;
+}
--
2.1.0
More information about the CRIU
mailing list