Module: wine Branch: master Commit: e3453ed81472de873ea989e3640fcbd79bbd5c68 URL: https://gitlab.winehq.org/wine/wine/-/commit/e3453ed81472de873ea989e3640fcbd...
Author: Rémi Bernon rbernon@codeweavers.com Date: Tue Apr 4 09:16:03 2023 +0200
ws2_32/tests: Adjust test results without host IPv6 support.
---
dlls/ws2_32/tests/afd.c | 7 +++++++ dlls/ws2_32/tests/protocol.c | 10 ++++++++-- dlls/ws2_32/tests/sock.c | 19 ++++++++++++++++--- 3 files changed, 31 insertions(+), 5 deletions(-)
diff --git a/dlls/ws2_32/tests/afd.c b/dlls/ws2_32/tests/afd.c index b07fb40fe3f..d0191ba8dbf 100644 --- a/dlls/ws2_32/tests/afd.c +++ b/dlls/ws2_32/tests/afd.c @@ -2281,6 +2281,12 @@ static void test_bind(void) todo_wine ok(ret == STATUS_PENDING, "got %#x\n", ret); ret = WaitForSingleObject(event, 0); ok(!ret, "got %#x\n", ret); + if (io.Status == STATUS_INVALID_ADDRESS_COMPONENT) + { + skip("IPv6 not supported\n"); + closesocket(s); + goto cleanup; + } ok(!io.Status, "got %#lx\n", io.Status); ok(io.Information == sizeof(addr6), "got %#Ix\n", io.Information); ok(addr6.sin6_family == AF_INET6, "got family %u\n", addr6.sin6_family); @@ -2315,6 +2321,7 @@ static void test_bind(void) closesocket(s2); closesocket(s);
+cleanup: CloseHandle(event); free(params); } diff --git a/dlls/ws2_32/tests/protocol.c b/dlls/ws2_32/tests/protocol.c index 34c0dbb0858..b0259cfe47d 100644 --- a/dlls/ws2_32/tests/protocol.c +++ b/dlls/ws2_32/tests/protocol.c @@ -2176,6 +2176,7 @@ static void test_getaddrinfo(void) SOCKADDR_IN *sockaddr; CHAR name[256], *ip; DWORD size = sizeof(name); + BOOL has_ipv6_getaddrinfo = TRUE; BOOL has_ipv6_addr;
memset(&hint, 0, sizeof(ADDRINFOA)); @@ -2376,8 +2377,10 @@ static void test_getaddrinfo(void) } else { + todo_wine ok(ret == WSAHOST_NOT_FOUND, "getaddrinfo failed with %d\n", ret); - win_skip("getaddrinfo does not support IPV6\n"); + skip("getaddrinfo does not support IPV6\n"); + has_ipv6_getaddrinfo = FALSE; }
hint.ai_flags = 0; @@ -2468,7 +2471,10 @@ static void test_getaddrinfo(void) ret = getaddrinfo("www.kernel.org", NULL, NULL, &result); ok(!ret, "getaddrinfo failed with %d\n", WSAGetLastError()); if (!has_ipv6_addr) - todo_wine ok(!ipv6_found(result), "IPv6 address is returned.\n"); + { + todo_wine_if(has_ipv6_getaddrinfo) + ok(!ipv6_found(result), "IPv6 address is returned.\n"); + } freeaddrinfo(result);
for (i = 0; i < ARRAY_SIZE(hinttests); i++) diff --git a/dlls/ws2_32/tests/sock.c b/dlls/ws2_32/tests/sock.c index 17298ca4136..1125d4519d3 100644 --- a/dlls/ws2_32/tests/sock.c +++ b/dlls/ws2_32/tests/sock.c @@ -2187,7 +2187,14 @@ static void test_reuseaddr(void) ok(s1 != INVALID_SOCKET, "got error %d.\n", WSAGetLastError());
rc = bind(s1, tests[i].addr_loopback, tests[i].addrlen); - ok(!rc, "got error %d.\n", WSAGetLastError()); + ok(!rc || (tests[i].domain == AF_INET6 && WSAGetLastError() == WSAEADDRNOTAVAIL), "got error %d.\n", WSAGetLastError()); + if (tests[i].domain == AF_INET6 && WSAGetLastError() == WSAEADDRNOTAVAIL) + { + skip("IPv6 not supported, skipping test\n"); + closesocket(s1); + winetest_pop_context(); + continue; + }
s2 = socket(tests[i].domain, SOCK_STREAM, 0); ok(s2 != INVALID_SOCKET, "got error %d.\n", WSAGetLastError()); @@ -2392,7 +2399,7 @@ static void test_reuseaddr(void) } } rc = bind(s[0], tests_exclusive[i].s[0].addr, tests_exclusive[i].s[0].addrlen); - ok(!rc, "got error %d.\n", WSAGetLastError()); + ok(!rc || (tests_exclusive[i].s[0].domain == AF_INET6 && WSAGetLastError() == WSAEADDRNOTAVAIL), "got error %d.\n", WSAGetLastError());
rc = bind(s[1], tests_exclusive[i].s[1].addr, tests_exclusive[i].s[1].addrlen);
@@ -2746,7 +2753,12 @@ static void test_ipv6_cmsg(void) ok(server != INVALID_SOCKET, "failed to create socket, error %u\n", WSAGetLastError());
rc = bind(server, (SOCKADDR *)&localhost, sizeof(localhost)); - ok(rc != SOCKET_ERROR, "bind failed, error %u\n", WSAGetLastError()); + ok(rc != SOCKET_ERROR || WSAGetLastError() == WSAEADDRNOTAVAIL, "bind failed, error %u\n", WSAGetLastError()); + if (WSAGetLastError() == WSAEADDRNOTAVAIL) + { + skip("IPv6 not supported, skipping test\n"); + goto cleanup; + } rc = connect(client, (SOCKADDR *)&localhost, sizeof(localhost)); ok(rc != SOCKET_ERROR, "connect failed, error %u\n", WSAGetLastError());
@@ -2820,6 +2832,7 @@ static void test_ipv6_cmsg(void) rc = setsockopt(server, IPPROTO_IPV6, IPV6_RECVTCLASS, (const char *)&off, sizeof(off)); ok(!rc, "failed to clear IPV6_RECVTCLASS, error %u\n", WSAGetLastError());
+cleanup: closesocket(server); closesocket(client); }