summaryrefslogtreecommitdiffhomepage
path: root/test/syscalls/linux/pty.cc
diff options
context:
space:
mode:
authorFabricio Voznika <fvoznika@google.com>2021-02-18 10:17:07 -0800
committergVisor bot <gvisor-bot@google.com>2021-02-18 10:19:04 -0800
commit582f7bf6c0ccccaeb1215a232709df38d5d409f7 (patch)
tree65a10409dcb4f6ebab0cadf47bd856a1d62bd365 /test/syscalls/linux/pty.cc
parentf4d694693c62378db4740d152ae3679b2954e282 (diff)
Remove side effect from pty tests
Individual test cases must not rely on being executed in a clean environment. PiperOrigin-RevId: 358207468
Diffstat (limited to 'test/syscalls/linux/pty.cc')
-rw-r--r--test/syscalls/linux/pty.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/test/syscalls/linux/pty.cc b/test/syscalls/linux/pty.cc
index e6b12f81c..294b9f6fd 100644
--- a/test/syscalls/linux/pty.cc
+++ b/test/syscalls/linux/pty.cc
@@ -1316,7 +1316,10 @@ class JobControlTest : public ::testing::Test {
// In the gVisor test environment, this test will be run as the session
// leader already (as the sentry init process).
if (!IsRunningOnGvisor()) {
- ASSERT_THAT(setsid(), SyscallSucceeds());
+ // Ignore failure because setsid(2) fails if the process is already the
+ // session leader.
+ setsid();
+ ioctl(replica_.get(), TIOCNOTTY);
}
}