Signed-off-by: Alex Henrie alexhenrie24@gmail.com --- The idea here is to not have to write new tests every time we hook up a new option. --- dlls/ws2_32/tests/sock.c | 297 +++++++++++++++++++++++++++++++++++---- 1 file changed, 268 insertions(+), 29 deletions(-)
diff --git a/dlls/ws2_32/tests/sock.c b/dlls/ws2_32/tests/sock.c index dd8c83374d0..408afdceb88 100644 --- a/dlls/ws2_32/tests/sock.c +++ b/dlls/ws2_32/tests/sock.c @@ -11413,47 +11413,286 @@ static void test_so_debug(void) closesocket(s); }
-static void test_set_only_options(void) +enum sockopt_validity_flags { - unsigned int i; - int ret, len; - int value; - SOCKET s; + BROKEN = 1, + TODO_OPT = 2, + TODO_ERR = 4 +};
- static const struct - { - int level; - int option; - } - tests[] = - { - {IPPROTO_IP, IP_ADD_MEMBERSHIP}, - {IPPROTO_IP, IP_DROP_MEMBERSHIP}, - {IPPROTO_IPV6, IPV6_ADD_MEMBERSHIP}, - {IPPROTO_IPV6, IPV6_DROP_MEMBERSHIP}, - }; +struct sockopt_validity_test +{ + int opt; + int get_error; + enum sockopt_validity_flags get_flags; + int set_error; + enum sockopt_validity_flags set_flags; +};
- for (i = 0; i < ARRAY_SIZE(tests); ++i) +static void do_sockopt_validity_tests(const char *type, SOCKET sock, int level, + const struct sockopt_validity_test *tests) +{ + static const struct sockopt_validity_test default_test = {0, WSAENOPROTOOPT, 0, WSAENOPROTOOPT, TODO_ERR}; + const struct sockopt_validity_test *test; + char value[256]; + int opt, count, rc, expected_rc, i = 0; + + for (opt = 0; opt < 100; opt++) { - if (tests[i].level == IPPROTO_IPV6) + if (tests[i].opt && opt == tests[i].opt) { - s = socket(AF_INET6, SOCK_STREAM, IPPROTO_TCP); - if (s == INVALID_SOCKET) continue; + test = &tests[i]; + i++; } else { - s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); + test = &default_test; }
- len = sizeof(value); - ret = getsockopt(s, tests[i].level, tests[i].option, (char *)&value, &len); - ok(ret == -1, "expected failure\n"); - ok(WSAGetLastError() == WSAENOPROTOOPT, "got error %u\n", WSAGetLastError()); - - closesocket(s); + memset(value, 0, sizeof(value)); + count = sizeof(value); + + WSASetLastError(0); + rc = getsockopt(sock, level, opt, value, &count); + expected_rc = test->get_error ? SOCKET_ERROR : 0; +todo_wine_if(test->get_flags & TODO_OPT) + ok(rc == expected_rc || broken(rc == SOCKET_ERROR && test->get_flags & BROKEN), + "expected getting %s option %i to return %i, got %i\n", type, opt, expected_rc, rc); +todo_wine_if(test->get_flags & TODO_ERR) + ok(WSAGetLastError() == test->get_error || broken(rc == SOCKET_ERROR && test->get_flags & BROKEN), + "expected getting %s option %i to cause error %i, got %i\n", type, opt, test->get_error, WSAGetLastError()); + + WSASetLastError(0); + rc = setsockopt(sock, level, opt, value, count); + expected_rc = test->set_error ? SOCKET_ERROR : 0; +todo_wine_if(test->set_flags & TODO_OPT) + ok(rc == expected_rc || broken(rc == SOCKET_ERROR && test->set_flags & BROKEN), + "expected setting %s option %i to return %i, got %i\n", type, opt, expected_rc, rc); +todo_wine_if(test->set_flags & TODO_ERR) + ok(WSAGetLastError() == test->set_error || broken(rc == SOCKET_ERROR && test->set_flags & BROKEN), + "expected setting %s option %i to cause error %i, got %i\n", type, opt, test->set_error, WSAGetLastError()); } }
+static void test_sockopt_validity(void) +{ + static const struct sockopt_validity_test ipv4_tcp_tests[] = + { + { IP_OPTIONS }, + { 2, WSAEINVAL, TODO_OPT | TODO_ERR, WSAEINVAL, 0 }, + { IP_TOS }, + { IP_TTL }, + { IP_MULTICAST_IF, WSAEINVAL, TODO_OPT | TODO_ERR, WSAEINVAL, 0 }, + { IP_MULTICAST_TTL, WSAEINVAL, TODO_OPT | TODO_ERR, WSAEINVAL, 0 }, + { IP_MULTICAST_LOOP, WSAEINVAL, TODO_OPT | TODO_ERR, WSAEINVAL, TODO_OPT | TODO_ERR }, + { IP_ADD_MEMBERSHIP, WSAENOPROTOOPT, 0, WSAEINVAL, 0 }, + { IP_DROP_MEMBERSHIP, WSAENOPROTOOPT, 0, WSAEINVAL, 0 }, + { IP_DONTFRAGMENT }, + { IP_ADD_SOURCE_MEMBERSHIP, WSAENOPROTOOPT, 0, WSAEINVAL, 0 }, + { IP_DROP_SOURCE_MEMBERSHIP, WSAENOPROTOOPT, 0, WSAEINVAL, 0 }, + { IP_BLOCK_SOURCE, WSAENOPROTOOPT, 0, WSAEINVAL, 0 }, + { IP_UNBLOCK_SOURCE, WSAENOPROTOOPT, 0, WSAEINVAL, 0 }, + { IP_PKTINFO, WSAEINVAL, TODO_OPT | TODO_ERR, WSAEINVAL, TODO_OPT | TODO_ERR }, + { IP_RECVTTL, WSAEINVAL, TODO_ERR, WSAEINVAL, TODO_ERR }, + { IP_RECEIVE_BROADCAST, WSAEINVAL, TODO_ERR, WSAEINVAL, TODO_ERR }, + { 23, 0, TODO_OPT | TODO_ERR, 0, TODO_OPT }, + { IP_RECVIF, WSAEINVAL, TODO_ERR, WSAEINVAL, TODO_ERR }, + { IP_RECVDSTADDR, WSAEINVAL, TODO_ERR, WSAEINVAL, TODO_ERR }, + { IP_IFLIST, 0, TODO_OPT | TODO_ERR, 0, TODO_OPT }, + { IP_ADD_IFLIST, WSAENOPROTOOPT, 0, WSAEINVAL, TODO_ERR }, + { IP_DEL_IFLIST, WSAENOPROTOOPT, 0, WSAEINVAL, TODO_ERR }, + { IP_UNICAST_IF }, + { IP_RTHDR, 0, TODO_OPT | TODO_ERR, 0, TODO_OPT }, + { IP_GET_IFLIST, WSAEINVAL, BROKEN /* win8 */ | TODO_ERR, WSAENOPROTOOPT, TODO_ERR }, + { IP_RECVRTHDR, WSAEINVAL, TODO_ERR, WSAEINVAL, BROKEN /* win8 */ | TODO_ERR }, + { IP_RECVTCLASS, WSAEINVAL, TODO_ERR, WSAEINVAL, TODO_ERR }, + { 41, WSAENOPROTOOPT, 0, WSAEINVAL, TODO_ERR }, + { 42, WSAENOPROTOOPT, 0, WSAEINVAL, TODO_ERR }, + { 43, WSAENOPROTOOPT, 0, WSAEINVAL, TODO_ERR }, + { 44, WSAENOPROTOOPT, 0, WSAEINVAL, TODO_ERR }, + { 45, WSAENOPROTOOPT, 0, WSAEINVAL, TODO_ERR }, + { 46, WSAENOPROTOOPT, 0, WSAEINVAL, TODO_ERR }, + { IP_ORIGINAL_ARRIVAL_IF, WSAEINVAL, BROKEN /* vista */ | TODO_ERR, WSAEINVAL, BROKEN /* vista */ | TODO_ERR }, + { IP_ECN, WSAEINVAL, BROKEN /* win7 */ | TODO_ERR, WSAEINVAL, BROKEN /* win7 */ | TODO_ERR }, + { IP_PKTINFO_EX, WSAEINVAL, BROKEN /* win7 */ | TODO_ERR, WSAEINVAL, BROKEN /* win7 */ | TODO_ERR }, + { IP_WFP_REDIRECT_RECORDS, WSAEINVAL, BROKEN /* win7 */ | TODO_ERR, WSAEINVAL, BROKEN /* win7 */ | TODO_ERR }, + { IP_WFP_REDIRECT_CONTEXT, WSAEINVAL, BROKEN /* win7 */ | TODO_ERR, WSAEINVAL, BROKEN /* win7 */ | TODO_ERR }, + { IP_MTU_DISCOVER, 0, BROKEN /* win8 */ | TODO_OPT | TODO_ERR, WSAEINVAL, BROKEN /* win8 */ | TODO_ERR }, + { IP_MTU, WSAENOTCONN, BROKEN /* win8 */ | TODO_ERR, WSAENOPROTOOPT, TODO_ERR }, + { IP_NRT_INTERFACE, WSAENOPROTOOPT, 0, WSAEFAULT, BROKEN /* win8 */ | TODO_ERR }, + { IP_RECVERR, WSAEINVAL, BROKEN /* win8 */ | TODO_ERR, WSAEINVAL, BROKEN /* win8 */ | TODO_ERR }, + { IP_USER_MTU, 0, BROKEN /* win8 */ | TODO_OPT | TODO_ERR, 0, BROKEN /* win8 */ | TODO_OPT }, + {} + }; + static const struct sockopt_validity_test ipv4_udp_tests[] = + { + { IP_OPTIONS }, + { 2, WSAEINVAL, TODO_OPT | TODO_ERR, WSAEINVAL, 0 }, + { IP_TOS }, + { IP_TTL }, + { IP_MULTICAST_IF }, + { IP_MULTICAST_TTL }, + { IP_MULTICAST_LOOP }, + { IP_ADD_MEMBERSHIP, WSAENOPROTOOPT, 0, WSAEFAULT, TODO_ERR }, + { IP_DROP_MEMBERSHIP, WSAENOPROTOOPT, 0, WSAEFAULT, TODO_ERR }, + { IP_DONTFRAGMENT }, + { IP_ADD_SOURCE_MEMBERSHIP, WSAENOPROTOOPT, 0, WSAEFAULT, TODO_ERR }, + { IP_DROP_SOURCE_MEMBERSHIP, WSAENOPROTOOPT, 0, WSAEFAULT, TODO_ERR }, + { IP_BLOCK_SOURCE, WSAENOPROTOOPT, 0, WSAEFAULT, TODO_ERR }, + { IP_UNBLOCK_SOURCE, WSAENOPROTOOPT, 0, WSAEFAULT, TODO_ERR }, + { IP_PKTINFO }, + { IP_RECVTTL, 0, TODO_OPT | TODO_ERR, 0, TODO_OPT }, + { IP_RECEIVE_BROADCAST, 0, TODO_OPT | TODO_ERR, 0, TODO_OPT }, + { 23, 0, TODO_OPT | TODO_ERR, 0, TODO_OPT }, + { IP_RECVIF, 0, TODO_OPT | TODO_ERR, 0, TODO_OPT }, + { IP_RECVDSTADDR, 0, TODO_OPT | TODO_ERR, 0, TODO_OPT }, + { IP_IFLIST, 0, TODO_OPT | TODO_ERR, 0, TODO_OPT }, + { IP_ADD_IFLIST, WSAENOPROTOOPT, 0, WSAEINVAL, TODO_ERR }, + { IP_DEL_IFLIST, WSAENOPROTOOPT, 0, WSAEINVAL, TODO_ERR }, + { IP_UNICAST_IF }, + { IP_RTHDR, 0, TODO_OPT | TODO_ERR, 0, TODO_OPT }, + { IP_GET_IFLIST, WSAEINVAL, BROKEN /* win8 */ | TODO_ERR, WSAENOPROTOOPT, TODO_ERR }, + { IP_RECVRTHDR, 0, TODO_OPT | TODO_ERR, 0, BROKEN /* win8 */ | TODO_OPT }, + { IP_RECVTCLASS, 0, TODO_OPT | TODO_ERR, 0, TODO_OPT }, + { 41, WSAENOPROTOOPT, 0, WSAEFAULT, TODO_ERR }, + { 42, WSAENOPROTOOPT, 0, WSAEFAULT, TODO_ERR }, + { 43, WSAENOPROTOOPT, 0, WSAEFAULT, TODO_ERR }, + { 44, WSAENOPROTOOPT, 0, WSAEFAULT, TODO_ERR }, + { 45, WSAENOPROTOOPT, 0, WSAEFAULT, TODO_ERR }, + { 46, WSAENOPROTOOPT, 0, WSAEFAULT, TODO_ERR }, + { IP_ORIGINAL_ARRIVAL_IF, 0, BROKEN /* vista */ | TODO_OPT | TODO_ERR, 0, BROKEN /* vista */ | TODO_OPT }, + { IP_ECN, 0, BROKEN /* win7 */ | TODO_OPT | TODO_ERR, 0, BROKEN /* win7 */ | TODO_OPT }, + { IP_PKTINFO_EX, 0, BROKEN /* win7 */ | TODO_OPT | TODO_ERR, 0, BROKEN /* win7 */ | TODO_OPT }, + { IP_WFP_REDIRECT_RECORDS, 0, BROKEN /* win7 */ | TODO_OPT | TODO_ERR, 0, BROKEN /* win7 */ | TODO_OPT }, + { IP_WFP_REDIRECT_CONTEXT, 0, BROKEN /* win7 */ | TODO_OPT | TODO_ERR, 0, BROKEN /* win7 */ | TODO_OPT }, + { IP_MTU_DISCOVER, 0, BROKEN /* win8 */ | TODO_OPT | TODO_ERR, WSAEINVAL, BROKEN /* win8 */ | TODO_ERR }, + { IP_MTU, WSAENOTCONN, BROKEN /* win8 */ | TODO_ERR, WSAENOPROTOOPT, TODO_ERR }, + { IP_NRT_INTERFACE, WSAENOPROTOOPT, 0, WSAEFAULT, BROKEN /* win8 */ | TODO_ERR }, + { IP_RECVERR, 0, BROKEN /* win8 */ | TODO_OPT | TODO_ERR, 0, BROKEN /* win8 */ | TODO_OPT }, + { IP_USER_MTU, 0, BROKEN /* win8 */ | TODO_OPT | TODO_ERR, 0, BROKEN /* win8 */ | TODO_OPT }, + {} + }; + static const struct sockopt_validity_test ipv6_tcp_tests[] = + { + { IPV6_HOPOPTS, 0, TODO_OPT | TODO_ERR, 0, TODO_OPT }, + { 2, WSAEINVAL, TODO_ERR, WSAEINVAL, TODO_ERR }, + { 3, 0, TODO_OPT | TODO_ERR, 0, TODO_OPT }, + { IPV6_UNICAST_HOPS }, + { IPV6_MULTICAST_IF, WSAEINVAL, TODO_OPT | TODO_ERR, WSAEINVAL, 0 }, + { IPV6_MULTICAST_HOPS, WSAEINVAL, TODO_OPT | TODO_ERR, WSAEINVAL, 0 }, + { IPV6_MULTICAST_LOOP, WSAEINVAL, TODO_OPT | TODO_ERR, WSAEINVAL, TODO_OPT | TODO_ERR }, + { IPV6_ADD_MEMBERSHIP, WSAENOPROTOOPT, 0, WSAEINVAL, 0 }, + { IPV6_DROP_MEMBERSHIP, WSAENOPROTOOPT, 0, WSAEINVAL, 0 }, + { IPV6_DONTFRAG }, + { 15, WSAENOPROTOOPT, 0, WSAEINVAL, TODO_ERR }, + { 16, WSAENOPROTOOPT, 0, WSAEINVAL, TODO_ERR }, + { 17, WSAENOPROTOOPT, 0, WSAEINVAL, TODO_ERR }, + { 18, WSAENOPROTOOPT, 0, WSAEINVAL, TODO_ERR }, + { IPV6_PKTINFO, WSAEINVAL, TODO_OPT | TODO_ERR, WSAEINVAL, TODO_OPT | TODO_ERR }, + { IPV6_HOPLIMIT, WSAEINVAL, TODO_OPT | TODO_ERR, WSAEINVAL, TODO_OPT | TODO_ERR }, + { 22, WSAEINVAL, TODO_ERR, WSAEINVAL, TODO_ERR }, + { IPV6_PROTECTION_LEVEL, 0, TODO_OPT | TODO_ERR, 0, 0 }, + { IPV6_RECVIF, WSAEINVAL, TODO_ERR, WSAEINVAL, TODO_ERR }, + { IPV6_RECVDSTADDR, WSAEINVAL, TODO_ERR, WSAEINVAL, TODO_ERR }, + { IPV6_V6ONLY }, + { IPV6_IFLIST, 0, TODO_OPT | TODO_ERR, 0, TODO_OPT }, + { IPV6_ADD_IFLIST, WSAENOPROTOOPT, 0, WSAEINVAL, TODO_ERR }, + { IPV6_DEL_IFLIST, WSAENOPROTOOPT, 0, WSAEINVAL, TODO_ERR }, + { IPV6_UNICAST_IF }, + { IPV6_RTHDR, 0, TODO_OPT | TODO_ERR, 0, TODO_OPT }, + { IPV6_GET_IFLIST, WSAEINVAL, BROKEN /* win8 */ | TODO_ERR, WSAENOPROTOOPT, TODO_ERR }, + { IPV6_RECVRTHDR, WSAEINVAL, TODO_ERR, WSAEINVAL, BROKEN /* win8 */ | TODO_ERR }, + { IPV6_RECVTCLASS, WSAEINVAL, TODO_ERR, WSAEINVAL, TODO_ERR }, + { 41, WSAENOPROTOOPT, 0, WSAEINVAL, TODO_ERR }, + { 42, WSAENOPROTOOPT, 0, WSAEINVAL, TODO_ERR }, + { 43, WSAENOPROTOOPT, 0, WSAEINVAL, TODO_ERR }, + { 44, WSAENOPROTOOPT, 0, WSAEINVAL, TODO_ERR }, + { 45, WSAENOPROTOOPT, 0, WSAEINVAL, TODO_ERR }, + { 46, WSAENOPROTOOPT, 0, WSAEINVAL, TODO_ERR }, + { 47, WSAEINVAL, BROKEN /* vista */ | TODO_ERR, WSAEINVAL, BROKEN /* vista */ | TODO_ERR }, + { IPV6_ECN, WSAEINVAL, BROKEN /* win7 */ | TODO_ERR, WSAEINVAL, BROKEN /* win7 */ | TODO_ERR }, + { IPV6_PKTINFO_EX, WSAEINVAL, BROKEN /* win7 */ | TODO_ERR, WSAEINVAL, BROKEN /* win7 */ | TODO_ERR }, + { IPV6_WFP_REDIRECT_RECORDS, WSAEINVAL, BROKEN /* win7 */ | TODO_ERR, WSAEINVAL, BROKEN /* win7 */ | TODO_ERR }, + { IPV6_WFP_REDIRECT_CONTEXT, WSAEINVAL, BROKEN /* win7 */ | TODO_ERR, WSAEINVAL, BROKEN /* win7 */ | TODO_ERR }, + { IPV6_MTU_DISCOVER, 0, BROKEN /* win8 */ | TODO_OPT | TODO_ERR, WSAEINVAL, BROKEN /* win8 */ | TODO_ERR }, + { IPV6_MTU, WSAENOTCONN, BROKEN /* win8 */ | TODO_ERR, WSAENOPROTOOPT, TODO_ERR }, + { IPV6_NRT_INTERFACE, WSAENOPROTOOPT, 0, WSAEFAULT, BROKEN /* win8 */ | TODO_ERR }, + { IPV6_RECVERR, WSAEINVAL, BROKEN /* win8 */ | TODO_ERR, WSAEINVAL, BROKEN /* win8 */ | TODO_ERR }, + { IPV6_USER_MTU, 0, BROKEN /* win8 */ | TODO_OPT | TODO_ERR, 0, BROKEN /* win8 */ | TODO_OPT }, + {} + }; + static const struct sockopt_validity_test ipv6_udp_tests[] = + { + { IPV6_HOPOPTS, 0, TODO_OPT | TODO_ERR, 0, TODO_OPT }, + { 2, WSAEINVAL, TODO_ERR, WSAEINVAL, TODO_ERR }, + { 3, 0, TODO_OPT | TODO_ERR, 0, TODO_OPT }, + { IPV6_UNICAST_HOPS }, + { IPV6_MULTICAST_IF }, + { IPV6_MULTICAST_HOPS }, + { IPV6_MULTICAST_LOOP }, + { IPV6_ADD_MEMBERSHIP, WSAENOPROTOOPT, 0, WSAEFAULT, TODO_ERR }, + { IPV6_DROP_MEMBERSHIP, WSAENOPROTOOPT, 0, WSAEFAULT, TODO_ERR }, + { IPV6_DONTFRAG }, + { 15, WSAENOPROTOOPT, 0, WSAEINVAL, TODO_ERR }, + { 16, WSAENOPROTOOPT, 0, WSAEINVAL, TODO_ERR }, + { 17, WSAENOPROTOOPT, 0, WSAEINVAL, TODO_ERR }, + { 18, WSAENOPROTOOPT, 0, WSAEINVAL, TODO_ERR }, + { IPV6_PKTINFO }, + { IPV6_HOPLIMIT }, + { 22, 0, TODO_OPT | TODO_ERR, 0, TODO_OPT }, + { IPV6_PROTECTION_LEVEL, 0, TODO_OPT | TODO_ERR, 0, 0 }, + { IPV6_RECVIF, 0, TODO_OPT | TODO_ERR, 0, TODO_OPT }, + { IPV6_RECVDSTADDR, 0, TODO_OPT | TODO_ERR, 0, TODO_OPT }, + { IPV6_V6ONLY }, + { IPV6_IFLIST, 0, TODO_OPT | TODO_ERR, 0, TODO_OPT }, + { IPV6_ADD_IFLIST, WSAENOPROTOOPT, 0, WSAEINVAL, TODO_ERR }, + { IPV6_DEL_IFLIST, WSAENOPROTOOPT, 0, WSAEINVAL, TODO_ERR }, + { IPV6_UNICAST_IF }, + { IPV6_RTHDR, 0, TODO_OPT | TODO_ERR, 0, TODO_OPT }, + { IPV6_GET_IFLIST, WSAEINVAL, BROKEN /* win8 */ | TODO_ERR, WSAENOPROTOOPT, TODO_ERR }, + { IPV6_RECVRTHDR, 0, TODO_OPT | TODO_ERR, 0, BROKEN /* win8 */ | TODO_OPT }, + { IPV6_RECVTCLASS, 0, TODO_OPT | TODO_ERR, 0, TODO_OPT }, + { 41, WSAENOPROTOOPT, 0, WSAEFAULT, TODO_ERR }, + { 42, WSAENOPROTOOPT, 0, WSAEFAULT, TODO_ERR }, + { 43, WSAENOPROTOOPT, 0, WSAEFAULT, TODO_ERR }, + { 44, WSAENOPROTOOPT, 0, WSAEFAULT, TODO_ERR }, + { 45, WSAENOPROTOOPT, 0, WSAEFAULT, TODO_ERR }, + { 46, WSAENOPROTOOPT, 0, WSAEFAULT, TODO_ERR }, + { 47, 0, BROKEN /* vista */ | TODO_OPT | TODO_ERR, 0, BROKEN /* vista */ | TODO_OPT }, + { IPV6_ECN, 0, BROKEN /* win7 */ | TODO_OPT | TODO_ERR, 0, BROKEN /* win7 */ | TODO_OPT }, + { IPV6_PKTINFO_EX, 0, BROKEN /* win7 */ | TODO_OPT | TODO_ERR, 0, BROKEN /* win7 */ | TODO_OPT }, + { IPV6_WFP_REDIRECT_RECORDS, 0, BROKEN /* win7 */ | TODO_OPT | TODO_ERR, 0, BROKEN /* win7 */ | TODO_OPT }, + { IPV6_WFP_REDIRECT_CONTEXT, 0, BROKEN /* win7 */ | TODO_OPT | TODO_ERR, 0, BROKEN /* win7 */ | TODO_OPT }, + { IPV6_MTU_DISCOVER, 0, BROKEN /* win8 */ | TODO_OPT | TODO_ERR, WSAEINVAL, BROKEN /* win8 */ | TODO_ERR }, + { IPV6_MTU, WSAENOTCONN, BROKEN /* win8 */ | TODO_ERR, WSAENOPROTOOPT, TODO_ERR }, + { IPV6_NRT_INTERFACE, WSAENOPROTOOPT, 0, WSAEFAULT, BROKEN /* win8 */ | TODO_ERR }, + { IPV6_RECVERR, 0, BROKEN /* win8 */ | TODO_OPT | TODO_ERR, 0, BROKEN /* win8 */ | TODO_OPT }, + { IPV6_USER_MTU, 0, BROKEN /* win8 */ | TODO_OPT | TODO_ERR, 0, BROKEN /* win8 */ | TODO_OPT }, + {} + }; + SOCKET sock; + + sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); + ok(sock != INVALID_SOCKET, "failed to create socket, error %u\n", WSAGetLastError()); + do_sockopt_validity_tests("IPv4 TCP", sock, IPPROTO_IP, ipv4_tcp_tests); + closesocket(sock); + + sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); + ok(sock != INVALID_SOCKET, "failed to create socket, error %u\n", WSAGetLastError()); + do_sockopt_validity_tests("IPv4 UDP", sock, IPPROTO_IP, ipv4_udp_tests); + closesocket(sock); + + sock = socket(AF_INET6, SOCK_STREAM, IPPROTO_TCP); + ok(sock != INVALID_SOCKET, "failed to create socket, error %u\n", WSAGetLastError()); + do_sockopt_validity_tests("IPv6 TCP", sock, IPPROTO_IPV6, ipv6_tcp_tests); + closesocket(sock); + + sock = socket(AF_INET6, SOCK_DGRAM, IPPROTO_UDP); + ok(sock != INVALID_SOCKET, "failed to create socket, error %u\n", WSAGetLastError()); + do_sockopt_validity_tests("IPv6 UDP", sock, IPPROTO_IPV6, ipv6_udp_tests); + closesocket(sock); +} + START_TEST( sock ) { int i; @@ -11471,7 +11710,7 @@ START_TEST( sock ) test_ipv6_cmsg(); test_extendedSocketOptions(); test_so_debug(); - test_set_only_options(); + test_sockopt_validity();
for (i = 0; i < ARRAY_SIZE(tests); i++) do_test(&tests[i]);