From bcd3feaf5207d22345ddedbac8cecdb732bf16c9 Mon Sep 17 00:00:00 2001 From: gVisor bot Date: Wed, 14 Dec 2022 17:01:05 -0800 Subject: [PATCH] Add test for zero size read and write PiperOrigin-RevId: 495456453 --- test/syscalls/linux/pipe.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/syscalls/linux/pipe.cc b/test/syscalls/linux/pipe.cc index 209801e36..b02e47048 100644 --- a/test/syscalls/linux/pipe.cc +++ b/test/syscalls/linux/pipe.cc @@ -664,6 +664,13 @@ TEST_P(PipeTest, Streaming) { } } +TEST_P(PipeTest, ZeroSize) { + SKIP_IF(!CreateBlocking()); + + ASSERT_THAT(write(wfd_.get(), nullptr, 0), SyscallSucceedsWithValue(0)); + ASSERT_THAT(read(rfd_.get(), nullptr, 0), SyscallSucceedsWithValue(0)); +} + std::string PipeCreatorName(::testing::TestParamInfo info) { return info.param.name_; // Use the name specified. }