Deflake process_vm_read_write test.

Passing an uninitialized iovec can cause process_vm_readv/writev to fail for
reasons other than the intended one.

PiperOrigin-RevId: 708414541
This commit is contained in:
Jamie Liu
2024-12-20 13:38:37 -08:00
committed by gVisor bot
parent 0fb4cc71ba
commit 0f8db9fa28
+6 -2
View File
@@ -350,11 +350,15 @@ TEST(ProcessVMInvalidTest, NULLRemoteIovec) {
}
TEST(ProcessVMInvalidTest, ProcessNoExist) {
std::string contents = "3263827";
struct iovec iov;
iov.iov_base = contents.data();
iov.iov_len = contents.size();
EXPECT_THAT(process_vm_readv(-1, &iov, 1, &iov, 1, 0),
SyscallFailsWithErrno(::testing::AnyOf(ESRCH, EFAULT)));
SyscallFailsWithErrno(ESRCH));
EXPECT_THAT(process_vm_writev(-1, &iov, 1, &iov, 1, 0),
SyscallFailsWithErrno(::testing::AnyOf(ESRCH, EFAULT)));
SyscallFailsWithErrno(ESRCH));
}
TEST(ProcessVMInvalidTest, GreaterThanIOV_MAX) {