From df0be41e05c6c82509dbe07009df34b92fbaa514 Mon Sep 17 00:00:00 2001 From: Andrew Vagin Date: Fri, 25 Dec 2015 19:23:00 +0300 Subject: [PATCH] zdtm: add a new test to check inherited tty-s v2: set a control terminal Signed-off-by: Andrew Vagin Signed-off-by: Pavel Emelyanov --- test/inhfd/tty.py | 17 +++++++++++++++++ test/inhfd/tty.py.desc | 1 + test/zdtm.py | 3 +++ 3 files changed, 21 insertions(+) create mode 100755 test/inhfd/tty.py create mode 100644 test/inhfd/tty.py.desc diff --git a/test/inhfd/tty.py b/test/inhfd/tty.py new file mode 100755 index 000000000..a158baef4 --- /dev/null +++ b/test/inhfd/tty.py @@ -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)] diff --git a/test/inhfd/tty.py.desc b/test/inhfd/tty.py.desc new file mode 100644 index 000000000..10666c823 --- /dev/null +++ b/test/inhfd/tty.py.desc @@ -0,0 +1 @@ +{ 'flavor': 'h' } diff --git a/test/zdtm.py b/test/zdtm.py index eb59290a9..89395fd95 100755 --- a/test/zdtm.py +++ b/test/zdtm.py @@ -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)