summaryrefslogtreecommitdiffhomepage
path: root/test/syscalls/linux
diff options
context:
space:
mode:
authorNayana Bidari <nybidari@google.com>2020-06-10 15:05:20 -0700
committergVisor bot <gvisor-bot@google.com>2020-06-10 15:06:45 -0700
commit9338854ea31059d6b6b5bf59a12512455b632f49 (patch)
tree125806f2a353dbc024b5a719730d003a0f3dc61b /test/syscalls/linux
parent4b9652d63b319414e764696f1b77ee39cd36d96d (diff)
Fix the error code for syscall test with null TOS.
The setsockopt with nullptr can fail with either EFAULT or zero. PiperOrigin-RevId: 315777107
Diffstat (limited to 'test/syscalls/linux')
-rw-r--r--test/syscalls/linux/socket_ip_unbound.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/test/syscalls/linux/socket_ip_unbound.cc b/test/syscalls/linux/socket_ip_unbound.cc
index ca597e267..af8dda19c 100644
--- a/test/syscalls/linux/socket_ip_unbound.cc
+++ b/test/syscalls/linux/socket_ip_unbound.cc
@@ -377,8 +377,11 @@ TEST_P(IPUnboundSocketTest, NullTOS) {
//
// Linux's implementation would need fixing as passing a nullptr as optval
// and non-zero optlen may not be valid.
- EXPECT_THAT(setsockopt(socket->get(), t.level, t.option, nullptr, set_sz),
- SyscallSucceedsWithValue(0));
+ // TODO(b/158666797): Combine the gVisor and linux cases for IPv6.
+ // Some kernel versions return EFAULT, so we handle both.
+ EXPECT_THAT(
+ setsockopt(socket->get(), t.level, t.option, nullptr, set_sz),
+ AnyOf(SyscallFailsWithErrno(EFAULT), SyscallSucceedsWithValue(0)));
}
}
socklen_t get_sz = sizeof(int);