diff options
author | Zach Koopmans <zkoopmans@google.com> | 2020-08-27 09:50:53 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-08-27 09:52:49 -0700 |
commit | 140ffb60073c74953666be476fd0be13301a3b4d (patch) | |
tree | 42ac061c1db2106e2cb0200a78399c732416f815 /test/util/pty_util.cc | |
parent | 32e7a54f7f413ba83af8217b9bc0a367e3c30f94 (diff) |
Fix JobControl tests for open source.
ioctl calls with TIOCSCTTY fail if the calling process already has a
controlling terminal, which occurs on a 5.4 kernel like our Ubuntu 18 CI.
Thus, run tests calling ioctl TTOCSCTTY in clean subprocess.
Also, while we're here, switch out non-inclusive master/slave for main/replica.
PiperOrigin-RevId: 328756598
Diffstat (limited to 'test/util/pty_util.cc')
-rw-r--r-- | test/util/pty_util.cc | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/test/util/pty_util.cc b/test/util/pty_util.cc index c01f916aa..5fa622922 100644 --- a/test/util/pty_util.cc +++ b/test/util/pty_util.cc @@ -23,25 +23,25 @@ namespace gvisor { namespace testing { -PosixErrorOr<FileDescriptor> OpenSlave(const FileDescriptor& master) { - PosixErrorOr<int> n = SlaveID(master); +PosixErrorOr<FileDescriptor> OpenReplica(const FileDescriptor& main) { + PosixErrorOr<int> n = ReplicaID(main); if (!n.ok()) { return PosixErrorOr<FileDescriptor>(n.error()); } return Open(absl::StrCat("/dev/pts/", n.ValueOrDie()), O_RDWR | O_NONBLOCK); } -PosixErrorOr<int> SlaveID(const FileDescriptor& master) { +PosixErrorOr<int> ReplicaID(const FileDescriptor& main) { // Get pty index. int n; - int ret = ioctl(master.get(), TIOCGPTN, &n); + int ret = ioctl(main.get(), TIOCGPTN, &n); if (ret < 0) { return PosixError(errno, "ioctl(TIOCGPTN) failed"); } // Unlock pts. int unlock = 0; - ret = ioctl(master.get(), TIOCSPTLCK, &unlock); + ret = ioctl(main.get(), TIOCSPTLCK, &unlock); if (ret < 0) { return PosixError(errno, "ioctl(TIOSPTLCK) failed"); } |