Commit a96d2298 authored by Andrey Vagin's avatar Andrey Vagin Committed by Andrei Vagin

test/inhfd: fix lint warnings

Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@gmail.com>
parent d13ff7e3
import os, tempfile
import os
import tempfile
id_str = ""
def create_fds():
tdir = tempfile.mkdtemp("zdtm.inhfd.XXXXXX")
if os.system("mount -t tmpfs zdtm.inhfd %s" % tdir) != 0:
......@@ -15,10 +17,10 @@ def create_fds():
mnt_id = -1
with open("/proc/self/fdinfo/%d" % fd1.fileno()) as f:
for l in f:
l = l.split()
if l[0] == "mnt_id:":
mnt_id = int(l[1])
for line in f:
line = line.split()
if line[0] == "mnt_id:":
mnt_id = int(line[1])
break
else:
raise Exception("Unable to find mnt_id")
......@@ -28,8 +30,10 @@ def create_fds():
return (fd2, fd1)
def filename(pipef):
return id_str
def dump_opts(sockf):
return [ "--external", id_str ]
return ["--external", id_str]
import os
def create_fds():
(fd1, fd2) = os.pipe()
return (os.fdopen(fd2, "wb"), os.fdopen(fd1, "rb"))
def filename(pipef):
return 'pipe:[%d]' % os.fstat(pipef.fileno()).st_ino
def dump_opts(sockf):
return [ ]
return []
import socket
import os
def create_fds():
(sk1, sk2) = socket.socketpair(socket.AF_UNIX, socket.SOCK_STREAM)
return (sk1.makefile("wb"), sk2.makefile("rb"))
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 ['--external', 'unix[%d]' % __sock_ino(sockf)]
import os, pty
import termios, fcntl
import fcntl
import os
import pty
import termios
def child_prep(fd):
fcntl.ioctl(fd.fileno(), termios.TIOCSCTTY, 1)
def create_fds():
(fd1, fd2) = pty.openpty()
return (os.fdopen(fd2, "wb"), os.fdopen(fd1, "rb"))
def filename(pipef):
st = os.fstat(pipef.fileno())
return 'tty[%x:%x]' % (st.st_rdev, st.st_dev)
def dump_opts(sockf):
st = os.fstat(sockf.fileno())
return ["--external", 'tty[%x:%x]' % (st.st_rdev, st.st_dev)]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment