mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Fix SocketPairTest and BadSocketPairTest in opensource.
PiperOrigin-RevId: 328467152
This commit is contained in:
committed by
gVisor bot
parent
df3c105f49
commit
ebf5293374
@@ -97,11 +97,13 @@ TEST(BadSocketPairArgs, ValidateErrForBadCallsToSocketPair) {
|
||||
ASSERT_THAT(socketpair(AF_INET6, 0, 0, fd),
|
||||
SyscallFailsWithErrno(ESOCKTNOSUPPORT));
|
||||
|
||||
// Invalid AF will return ENOAFSUPPORT.
|
||||
// Invalid AF will return ENOAFSUPPORT or EPERM.
|
||||
ASSERT_THAT(socketpair(AF_MAX, 0, 0, fd),
|
||||
SyscallFailsWithErrno(EAFNOSUPPORT));
|
||||
::testing::AnyOf(SyscallFailsWithErrno(EAFNOSUPPORT),
|
||||
SyscallFailsWithErrno(EPERM)));
|
||||
ASSERT_THAT(socketpair(8675309, 0, 0, fd),
|
||||
SyscallFailsWithErrno(EAFNOSUPPORT));
|
||||
::testing::AnyOf(SyscallFailsWithErrno(EAFNOSUPPORT),
|
||||
SyscallFailsWithErrno(EPERM)));
|
||||
}
|
||||
|
||||
enum class Operation {
|
||||
@@ -116,7 +118,8 @@ std::string OperationToString(Operation operation) {
|
||||
return "Bind";
|
||||
case Operation::Connect:
|
||||
return "Connect";
|
||||
case Operation::SendTo:
|
||||
// Operation::SendTo is the default.
|
||||
default:
|
||||
return "SendTo";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -435,8 +435,10 @@ TEST_P(UDPSocketPairTest, TOSRecvMismatch) {
|
||||
|
||||
// Test that an IPv4 socket does not support the IPv6 TClass option.
|
||||
TEST_P(UDPSocketPairTest, TClassRecvMismatch) {
|
||||
// This should only test AF_INET sockets for the mismatch behavior.
|
||||
SKIP_IF(GetParam().domain != AF_INET);
|
||||
// This should only test AF_INET6 sockets for the mismatch behavior.
|
||||
SKIP_IF(GetParam().domain != AF_INET6);
|
||||
// IPV6_RECVTCLASS is only valid for SOCK_DGRAM and SOCK_RAW.
|
||||
SKIP_IF(GetParam().type != SOCK_DGRAM | GetParam().type != SOCK_RAW);
|
||||
|
||||
auto sockets = ASSERT_NO_ERRNO_AND_VALUE(NewSocketPair());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user