mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-07-17 16:47:50 +00:00
zdtm: add a new test to check inherited tty-s
v2: set a control terminal Signed-off-by: Andrew Vagin <avagin@virtuozzo.com> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
parent
4bab48fb39
commit
df0be41e05
3 changed files with 21 additions and 0 deletions
17
test/inhfd/tty.py
Executable file
17
test/inhfd/tty.py
Executable file
|
|
@ -0,0 +1,17 @@
|
|||
import os, pty
|
||||
import termios, fcntl
|
||||
|
||||
def child_prep(fd):
|
||||
fcntl.ioctl(fd.fileno(), termios.TIOCSCTTY, 1)
|
||||
|
||||
def create_fds():
|
||||
(fd1, fd2) = pty.openpty()
|
||||
return (os.fdopen(fd2, "w"), os.fdopen(fd1, "r"))
|
||||
|
||||
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)]
|
||||
1
test/inhfd/tty.py.desc
Normal file
1
test/inhfd/tty.py.desc
Normal file
|
|
@ -0,0 +1 @@
|
|||
{ 'flavor': 'h' }
|
||||
|
|
@ -454,6 +454,9 @@ class inhfd_test:
|
|||
self.__peer_pid = os.fork()
|
||||
if self.__peer_pid == 0:
|
||||
os.setsid()
|
||||
|
||||
getattr(self.__fdtyp, "child_prep", lambda fd : None)(peer_file)
|
||||
|
||||
os.close(0)
|
||||
os.close(1)
|
||||
os.close(2)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue