[CRIU] [PATCH] zdtm: check one end of socketpair with data (v2)

Andrey Vagin avagin at openvz.org
Wed Jul 29 21:32:01 PDT 2015


29.07.2015 23:49 пользователь "Pavel Emelyanov" <xemul at parallels.com>
написал:
>
> On 07/29/2015 11:24 PM, Andrey Vagin wrote:
>
> Does it pass?

No, it doesn't. We don't restore data in a socket.

>
> > v2: add SOCK_NONBLOCK
> > Signed-off-by: Andrey Vagin <avagin at openvz.org>
> > ---
> >  test/zdtm.sh                              |  1 +
> >  test/zdtm/live/static/Makefile            |  1 +
> >  test/zdtm/live/static/socket_close_data.c | 43
+++++++++++++++++++++++++++++++
> >  3 files changed, 45 insertions(+)
> >  create mode 100644 test/zdtm/live/static/socket_close_data.c
> >
> > diff --git a/test/zdtm.sh b/test/zdtm.sh
> > index e7c0e6f..6666ac9 100755
> > --- a/test/zdtm.sh
> > +++ b/test/zdtm.sh
> > @@ -86,6 +86,7 @@ generate_test_list()
> >               static/sock_filter
> >               static/socket6_udp
> >               static/socket_udplite
> > +             static/socket_close_data
> >               static/selfexe00
> >               static/link10
> >               static/unlink_fstat00
> > diff --git a/test/zdtm/live/static/Makefile
b/test/zdtm/live/static/Makefile
> > index 8e98ac8..b901296 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;
> > +}
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openvz.org/pipermail/criu/attachments/20150730/36adf2b9/attachment.html>


More information about the CRIU mailing list