Zebediah Figura : ws2_32/tests: Add tests for options which can only be set.
Module: wine Branch: master Commit: b9bf00605d4af7d0927a63695b97eb3d8db8bd4c URL: https://source.winehq.org/git/wine.git/?a=commit;h=b9bf00605d4af7d0927a63695... Author: Zebediah Figura <z.figura12(a)gmail.com> Date: Wed Jun 30 20:24:37 2021 -0500 ws2_32/tests: Add tests for options which can only be set. Signed-off-by: Zebediah Figura <z.figura12(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ws2_32/tests/sock.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/dlls/ws2_32/tests/sock.c b/dlls/ws2_32/tests/sock.c index e579b72ecb5..8617a6fb7e3 100644 --- a/dlls/ws2_32/tests/sock.c +++ b/dlls/ws2_32/tests/sock.c @@ -11011,6 +11011,47 @@ static void test_so_debug(void) closesocket(s); } +static void test_set_only_options(void) +{ + unsigned int i; + int ret, len; + int value; + SOCKET s; + + 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}, + }; + + for (i = 0; i < ARRAY_SIZE(tests); ++i) + { + if (tests[i].level == IPPROTO_IPV6) + { + s = socket(AF_INET6, SOCK_STREAM, IPPROTO_TCP); + if (s == INVALID_SOCKET) continue; + } + else + { + s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); + } + + 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); + } +} + START_TEST( sock ) { int i; @@ -11027,6 +11068,7 @@ START_TEST( sock ) test_ip_pktinfo(); test_extendedSocketOptions(); test_so_debug(); + test_set_only_options(); for (i = 0; i < ARRAY_SIZE(tests); i++) do_test(&tests[i]);
participants (1)
-
Alexandre Julliard