criu/test/inhfd/socket.py
Pavel Emelyanov c405304fcc zdtm.py: Add inhfd tests for --inherit-fd option
This option cannot be tested using classic zdtm tests as it implies
some data created before restore and passed through criu restore down
to the restored process (descriptor in our case).

So add inhfd_test class that creates such.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2015-10-19 12:42:01 +03:00

15 lines
358 B
Python
Executable file

import socket
import os
def create_fds():
(sk1, sk2) = socket.socketpair(socket.AF_UNIX, socket.SOCK_STREAM)
return (sk1.makefile("w"), sk2.makefile("r"))
def __sock_ino(sockf):
return os.fstat(sockf.fileno()).st_ino
def filename(sockf):
return 'socket:[%d]' % __sock_ino(sockf)
def dump_opts(sockf):
return ['--ext-unix-sk=%d' % __sock_ino(sockf)]