From 3e00c6130599b5fc0afc9c74e1efdd0a423728f8 Mon Sep 17 00:00:00 2001 From: Andrei Vagin Date: Fri, 3 Jun 2022 10:55:44 -0700 Subject: [PATCH] test/pty: last read in TermiosICANONEOF returns 0 on new linux kernels [==========] Running 1 test from 1 test suite. [----------] Global test environment set-up. [----------] 1 test from PtyTest [ RUN ] PtyTest.TermiosICANONEOF test/syscalls/linux/pty.cc:464: Failure Value of: ReadFd(fd.get(), &c, 1) Expected: -1 (failure), with errno PosixError(errno=11 Resource temporarily unavailable) Actual: 0 (of type long) [ FAILED ] PtyTest.TermiosICANONEOF (20018 ms) [----------] 1 test from PtyTest (20018 ms total) [----------] Global test environment tear-down [==========] 1 test from 1 test suite ran. (20018 ms total) [ PASSED ] 0 tests. [ FAILED ] 1 test, listed below: [ FAILED ] PtyTest.TermiosICANONEOF PiperOrigin-RevId: 452799870 --- test/syscalls/linux/pty.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/syscalls/linux/pty.cc b/test/syscalls/linux/pty.cc index 6aba0ae86..f93eb7c77 100644 --- a/test/syscalls/linux/pty.cc +++ b/test/syscalls/linux/pty.cc @@ -1120,7 +1120,10 @@ TEST_F(PtyTest, TermiosICANONEOF) { ExpectReadable(replica_, sizeof(input), buf); EXPECT_STREQ(buf, "abc"); - ExpectFinished(replica_); + // New Linux kernels can return zero. + EXPECT_THAT( + ReadFd(replica_.get(), buf, 1), + AnyOf(SyscallSucceedsWithValue(0), SyscallFailsWithErrno(EAGAIN))); } // ICANON limits us to 4096 bytes including a terminating character. Anything