Also fixes spurious test failures wherein the broken call would return ENOTSOCK.
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/ws2_32/tests/afd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/ws2_32/tests/afd.c b/dlls/ws2_32/tests/afd.c index 97b35e1f3ea..3f03c14a94f 100644 --- a/dlls/ws2_32/tests/afd.c +++ b/dlls/ws2_32/tests/afd.c @@ -565,7 +565,7 @@ static void test_poll(void) ret = bind(client, (const struct sockaddr *)&bind_addr, sizeof(bind_addr)); ok(!ret, "got error %u\n", WSAGetLastError()); len = sizeof(addr); - ret = getsockname(listener, (struct sockaddr *)&addr, &len); + ret = getsockname(client, (struct sockaddr *)&addr, &len); ok(!ret, "got error %u\n", WSAGetLastError());
check_poll(client, event, AFD_POLL_WRITE); @@ -1046,7 +1046,7 @@ static void test_recv(void) ret = bind(client, (const struct sockaddr *)&bind_addr, sizeof(bind_addr)); ok(!ret, "got error %u\n", WSAGetLastError()); len = sizeof(addr); - ret = getsockname(listener, (struct sockaddr *)&addr, &len); + ret = getsockname(client, (struct sockaddr *)&addr, &len); ok(!ret, "got error %u\n", WSAGetLastError());
memset(buffer, 0xcc, sizeof(buffer));
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/ws2_32/tests/afd.c | 37 ++++++++++++++++++++++++++++++++----- 1 file changed, 32 insertions(+), 5 deletions(-)
diff --git a/dlls/ws2_32/tests/afd.c b/dlls/ws2_32/tests/afd.c index 3f03c14a94f..87e4779b980 100644 --- a/dlls/ws2_32/tests/afd.c +++ b/dlls/ws2_32/tests/afd.c @@ -111,9 +111,10 @@ static void test_open_device(void) closesocket(s); }
-#define check_poll(a, b, c) check_poll_(__LINE__, a, b, c, FALSE) -#define check_poll_todo(a, b, c) check_poll_(__LINE__, a, b, c, TRUE) -static void check_poll_(int line, SOCKET s, HANDLE event, int expect, BOOL todo) +#define check_poll(a, b, c) check_poll_(__LINE__, a, b, ~0, c, FALSE) +#define check_poll_mask(a, b, c, d) check_poll_(__LINE__, a, b, c, d, FALSE) +#define check_poll_todo(a, b, c) check_poll_(__LINE__, a, b, ~0, c, TRUE) +static void check_poll_(int line, SOCKET s, HANDLE event, int mask, int expect, BOOL todo) { struct afd_poll_params in_params = {0}, out_params = {0}; IO_STATUS_BLOCK io; @@ -122,12 +123,17 @@ static void check_poll_(int line, SOCKET s, HANDLE event, int expect, BOOL todo) in_params.timeout = -1000 * 10000; in_params.count = 1; in_params.sockets[0].socket = s; - in_params.sockets[0].flags = ~0; + in_params.sockets[0].flags = mask; in_params.sockets[0].status = 0xdeadbeef;
ret = NtDeviceIoControlFile((HANDLE)s, event, NULL, NULL, &io, IOCTL_AFD_POLL, &in_params, sizeof(in_params), &out_params, sizeof(out_params)); - ok_(__FILE__, line)(!ret, "got %#x\n", ret); + ok_(__FILE__, line)(!ret || ret == STATUS_PENDING, "got %#x\n", ret); + if (ret == STATUS_PENDING) + { + ret = WaitForSingleObject(event, 1000); + ok_(__FILE__, line)(!ret, "wait timed out\n"); + } ok_(__FILE__, line)(!io.Status, "got %#x\n", io.Status); ok_(__FILE__, line)(io.Information == sizeof(out_params), "got %#Ix\n", io.Information); ok_(__FILE__, line)(out_params.timeout == in_params.timeout, "got timeout %I64d\n", out_params.timeout); @@ -311,6 +317,7 @@ static void test_poll(void) ret = send(server, "data", 5, 0); ok(ret == 5, "got %d\n", ret);
+ check_poll_mask(client, event, AFD_POLL_READ, AFD_POLL_READ); check_poll(client, event, AFD_POLL_WRITE | AFD_POLL_CONNECT | AFD_POLL_READ); check_poll(server, event, AFD_POLL_WRITE | AFD_POLL_CONNECT);
@@ -325,6 +332,7 @@ static void test_poll(void) ok(ret == 1, "got %d\n", ret);
check_poll(client, event, AFD_POLL_WRITE | AFD_POLL_CONNECT | AFD_POLL_READ); + check_poll_mask(server, event, AFD_POLL_OOB, AFD_POLL_OOB); check_poll(server, event, AFD_POLL_CONNECT | AFD_POLL_OOB);
ret = recv(server, large_buffer, 1, MSG_OOB); @@ -341,6 +349,7 @@ static void test_poll(void) ok(ret == 1, "got %d\n", ret);
check_poll(client, event, AFD_POLL_WRITE | AFD_POLL_CONNECT | AFD_POLL_READ); + check_poll_mask(server, event, AFD_POLL_READ, AFD_POLL_READ); check_poll(server, event, AFD_POLL_CONNECT | AFD_POLL_READ);
closesocket(client); @@ -364,6 +373,7 @@ static void test_poll(void) ok(!ret, "got error %u\n", WSAGetLastError());
check_poll(client, event, AFD_POLL_WRITE | AFD_POLL_CONNECT); + check_poll_mask(server, event, AFD_POLL_HUP, AFD_POLL_HUP); check_poll(server, event, AFD_POLL_WRITE | AFD_POLL_CONNECT | AFD_POLL_HUP);
closesocket(client); @@ -381,12 +391,14 @@ static void test_poll(void) ok(ret == 5, "got %d\n", ret);
check_poll(client, event, AFD_POLL_WRITE | AFD_POLL_CONNECT); + check_poll_mask(server, event, AFD_POLL_READ, AFD_POLL_READ); check_poll(server, event, AFD_POLL_WRITE | AFD_POLL_CONNECT | AFD_POLL_READ);
ret = shutdown(client, SD_SEND); ok(!ret, "got error %u\n", WSAGetLastError());
check_poll(client, event, AFD_POLL_WRITE | AFD_POLL_CONNECT); + check_poll_mask(server, event, AFD_POLL_READ, AFD_POLL_READ); check_poll_todo(server, event, AFD_POLL_WRITE | AFD_POLL_CONNECT | AFD_POLL_READ | AFD_POLL_HUP);
/* Test closing a socket while polling on it. Note that AFD_POLL_CLOSE @@ -862,6 +874,9 @@ static void test_recv(void) ret = send(server, "data", 5, 0); ok(ret == 5, "got %d\n", ret);
+ /* wait for the data to be available */ + check_poll_mask(client, event, AFD_POLL_READ, AFD_POLL_READ); + memset(&io, 0xcc, sizeof(io)); memset(buffer, 0xcc, sizeof(buffer)); ret = NtDeviceIoControlFile((HANDLE)client, event, NULL, NULL, &io, @@ -886,6 +901,9 @@ static void test_recv(void) ret = send(server, "data", 5, 0); ok(ret == 5, "got %d\n", ret);
+ /* wait for the data to be available */ + check_poll_mask(client, event, AFD_POLL_READ, AFD_POLL_READ); + memset(&io, 0xcc, sizeof(io)); memset(buffer, 0xcc, sizeof(buffer)); ret = NtDeviceIoControlFile((HANDLE)client, event, NULL, NULL, &io, @@ -926,6 +944,9 @@ static void test_recv(void) ret = send(server, "data", 5, 0); ok(ret == 5, "got %d\n", ret);
+ /* wait for the data to be available */ + check_poll_mask(client, event, AFD_POLL_READ, AFD_POLL_READ); + memset(&io, 0xcc, sizeof(io)); memset(buffer, 0xcc, sizeof(buffer)); ret = NtDeviceIoControlFile((HANDLE)client, event, NULL, NULL, &io, @@ -966,6 +987,9 @@ static void test_recv(void) ret = send(server, "data", 4, 0); ok(ret == 4, "got %d\n", ret);
+ /* wait for the data to be available */ + check_poll_mask(client, event, AFD_POLL_READ, AFD_POLL_READ); + memset(buffer, 0xcc, sizeof(buffer)); ret = NtDeviceIoControlFile((HANDLE)client, event, NULL, NULL, &io, IOCTL_AFD_RECV, ¶ms, sizeof(params), NULL, 0); @@ -1082,6 +1106,9 @@ static void test_recv(void) ret = sendto(server, "moredata", 9, 0, (struct sockaddr *)&addr, sizeof(addr)); ok(ret == 9, "got %d\n", ret);
+ /* wait for the data to be available */ + check_poll_mask(client, event, AFD_POLL_READ, AFD_POLL_READ); + memset(&io, 0, sizeof(io)); memset(buffer, 0xcc, sizeof(buffer)); ret = NtDeviceIoControlFile((HANDLE)client, event, NULL, NULL, &io,
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=91529
Your paranoid android.
=== debiant2 (32 bit report) ===
ws2_32: afd.c:336: Test failed: got flags 0x43 afd.c:342: Test failed: got flags 0x41
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/ws2_32/tests/sock.c | 96 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+)
diff --git a/dlls/ws2_32/tests/sock.c b/dlls/ws2_32/tests/sock.c index 33ab1e1b576..bb4f1b74044 100644 --- a/dlls/ws2_32/tests/sock.c +++ b/dlls/ws2_32/tests/sock.c @@ -4092,6 +4092,101 @@ static void test_keepalive_vals(void) closesocket(sock); }
+static void test_unsupported_ioctls(void) +{ + OVERLAPPED overlapped = {0}, *overlapped_ptr; + unsigned int i; + ULONG_PTR key; + HANDLE port; + DWORD size; + SOCKET s; + int ret; + + static const DWORD codes[] = {0xdeadbeef, FIOASYNC, 0x667e, SIO_FLUSH}; + + for (i = 0; i < ARRAY_SIZE(codes); ++i) + { + winetest_push_context("ioctl %#x", codes[i]); + s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); + port = CreateIoCompletionPort((HANDLE)s, NULL, 123, 0); + + WSASetLastError(0xdeadbeef); + ret = WSAIoctl(s, codes[i], NULL, 0, NULL, 0, NULL, &overlapped, NULL); + todo_wine_if (codes[i] == SIO_FLUSH) + ok(ret == -1, "expected failure\n"); + todo_wine ok(WSAGetLastError() == WSAEFAULT, "got error %u\n", WSAGetLastError()); + + WSASetLastError(0xdeadbeef); + size = 0xdeadbeef; + ret = WSAIoctl(s, codes[i], NULL, 0, NULL, 0, &size, NULL, NULL); + todo_wine_if (codes[i] == SIO_FLUSH) + ok(ret == -1, "expected failure\n"); + todo_wine_if (codes[i] == FIOASYNC || codes[i] == SIO_FLUSH) + ok(WSAGetLastError() == WSAEOPNOTSUPP, "got error %u\n", WSAGetLastError()); + todo_wine_if (codes[i] != SIO_FLUSH) + ok(!size, "got size %u\n", size); + + WSASetLastError(0xdeadbeef); + size = 0xdeadbeef; + overlapped.Internal = 0xdeadbeef; + overlapped.InternalHigh = 0xdeadbeef; + ret = WSAIoctl(s, codes[i], NULL, 0, NULL, 0, &size, &overlapped, NULL); + todo_wine_if (codes[i] == SIO_FLUSH) + ok(ret == -1, "expected failure\n"); + todo_wine ok(WSAGetLastError() == ERROR_IO_PENDING, "got error %u\n", WSAGetLastError()); + todo_wine_if (codes[i] == SIO_FLUSH) + ok(size == 0xdeadbeef, "got size %u\n", size); + + ret = GetQueuedCompletionStatus(port, &size, &key, &overlapped_ptr, 0); + todo_wine_if (codes[i] == SIO_FLUSH) + ok(!ret, "expected failure\n"); + todo_wine_if (codes[i] != 0xdeadbeef) + ok(GetLastError() == ERROR_NOT_SUPPORTED, "got error %u\n", GetLastError()); + todo_wine_if (codes[i] == FIOASYNC || codes[i] == 0x667e) + ok(!size, "got size %u\n", size); + ok(key == 123, "got key %Iu\n", key); + todo_wine_if (codes[i] == FIOASYNC || codes[i] == 0x667e) + ok(overlapped_ptr == &overlapped, "got overlapped %p\n", overlapped_ptr); + todo_wine_if (codes[i] != 0xdeadbeef) + ok((NTSTATUS)overlapped.Internal == STATUS_NOT_SUPPORTED, + "got status %#x\n", (NTSTATUS)overlapped.Internal); + todo_wine_if (codes[i] == FIOASYNC || codes[i] == 0x667e) + ok(!overlapped.InternalHigh, "got size %Iu\n", overlapped.InternalHigh); + + CloseHandle(port); + closesocket(s); + + s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); + + ret = WSAIoctl(s, codes[i], NULL, 0, NULL, 0, NULL, &overlapped, socket_apc); + todo_wine_if (codes[i] == SIO_FLUSH) + ok(ret == -1, "expected failure\n"); + todo_wine ok(WSAGetLastError() == WSAEFAULT, "got error %u\n", WSAGetLastError()); + + apc_count = 0; + size = 0xdeadbeef; + ret = WSAIoctl(s, codes[i], NULL, 0, NULL, 0, &size, &overlapped, socket_apc); + todo_wine_if (codes[i] == SIO_FLUSH) + ok(ret == -1, "expected failure\n"); + todo_wine ok(WSAGetLastError() == ERROR_IO_PENDING, "got error %u\n", WSAGetLastError()); + todo_wine_if (codes[i] == SIO_FLUSH) + ok(size == 0xdeadbeef, "got size %u\n", size); + + ret = SleepEx(0, TRUE); + todo_wine ok(ret == WAIT_IO_COMPLETION, "got %d\n", ret); + if (ret == WAIT_IO_COMPLETION) + { + ok(apc_count == 1, "APC was called %u times\n", apc_count); + ok(apc_error == WSAEOPNOTSUPP, "got APC error %u\n", apc_error); + ok(!apc_size, "got APC size %u\n", apc_size); + ok(apc_overlapped == &overlapped, "got APC overlapped %p\n", apc_overlapped); + } + + closesocket(s); + winetest_pop_context(); + } +} + static BOOL drain_pause = FALSE; static DWORD WINAPI drain_socket_thread(LPVOID arg) { @@ -10314,6 +10409,7 @@ START_TEST( sock ) test_keepalive_vals(); test_sioRoutingInterfaceQuery(); test_sioAddressListChange(); + test_unsupported_ioctls();
test_WSASendMsg(); test_WSASendTo();
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=91530
Your paranoid android.
=== wvistau64 (64 bit report) ===
ws2_32: sock.c:3766: Test failed: FIONBIO returned 0 sock.c:3771: Test failed: SIOCATMARK returned 1
On 5/31/21 11:08 AM, Marvin wrote:
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=91530
Your paranoid android.
=== wvistau64 (64 bit report) ===
ws2_32: sock.c:3766: Test failed: FIONBIO returned 0 sock.c:3771: Test failed: SIOCATMARK returned 1
This one is yet another trivial "Vista's loopback interface isn't fast enough" bug. It's not caused by this series but was introduced with 2795fa9c00. I'll send a patch.
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/ws2_32/tests/sock.c | 93 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+)
diff --git a/dlls/ws2_32/tests/sock.c b/dlls/ws2_32/tests/sock.c index bb4f1b74044..f5f7e32649f 100644 --- a/dlls/ws2_32/tests/sock.c +++ b/dlls/ws2_32/tests/sock.c @@ -4187,6 +4187,98 @@ static void test_unsupported_ioctls(void) } }
+static void test_get_extension_func(void) +{ + OVERLAPPED overlapped = {0}, *overlapped_ptr; + GUID acceptex_guid = WSAID_ACCEPTEX; + GUID bogus_guid = {0xdeadbeef}; + ULONG_PTR key; + HANDLE port; + DWORD size; + void *func; + SOCKET s; + int ret; + + s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); + port = CreateIoCompletionPort((HANDLE)s, NULL, 123, 0); + + WSASetLastError(0xdeadbeef); + ret = WSAIoctl(s, SIO_GET_EXTENSION_FUNCTION_POINTER, &acceptex_guid, sizeof(GUID), + &func, sizeof(func), NULL, &overlapped, NULL); + todo_wine ok(ret == -1, "expected failure\n"); + todo_wine ok(WSAGetLastError() == WSAEFAULT, "got error %u\n", WSAGetLastError()); + + WSASetLastError(0xdeadbeef); + size = 0xdeadbeef; + ret = WSAIoctl(s, SIO_GET_EXTENSION_FUNCTION_POINTER, &acceptex_guid, sizeof(GUID), + &func, sizeof(func), &size, NULL, NULL); + ok(!ret, "expected success\n"); + todo_wine ok(!WSAGetLastError(), "got error %u\n", WSAGetLastError()); + ok(size == sizeof(func), "got size %u\n", size); + + WSASetLastError(0xdeadbeef); + size = 0xdeadbeef; + overlapped.Internal = 0xdeadbeef; + overlapped.InternalHigh = 0xdeadbeef; + ret = WSAIoctl(s, SIO_GET_EXTENSION_FUNCTION_POINTER, &acceptex_guid, sizeof(GUID), + &func, sizeof(func), &size, &overlapped, NULL); + ok(!ret, "expected success\n"); + todo_wine ok(!WSAGetLastError(), "got error %u\n", WSAGetLastError()); + ok(size == sizeof(func), "got size %u\n", size); + + ret = GetQueuedCompletionStatus(port, &size, &key, &overlapped_ptr, 0); + ok(ret, "got error %u\n", GetLastError()); + todo_wine ok(!size, "got size %u\n", size); + ok(key == 123, "got key %Iu\n", key); + ok(overlapped_ptr == &overlapped, "got overlapped %p\n", overlapped_ptr); + ok(!overlapped.Internal, "got status %#x\n", (NTSTATUS)overlapped.Internal); + todo_wine ok(!overlapped.InternalHigh, "got size %Iu\n", overlapped.InternalHigh); + + size = 0xdeadbeef; + overlapped.Internal = 0xdeadbeef; + overlapped.InternalHigh = 0xdeadbeef; + ret = WSAIoctl(s, SIO_GET_EXTENSION_FUNCTION_POINTER, &bogus_guid, sizeof(GUID), + &func, sizeof(func), &size, &overlapped, NULL); + ok(ret == -1, "expected failure\n"); + todo_wine ok(WSAGetLastError() == WSAEINVAL, "got error %u\n", WSAGetLastError()); + ok(size == 0xdeadbeef, "got size %u\n", size); + todo_wine ok(overlapped.Internal == 0xdeadbeef, "got status %#x\n", (NTSTATUS)overlapped.Internal); + todo_wine ok(overlapped.InternalHigh == 0xdeadbeef, "got size %Iu\n", overlapped.InternalHigh); + + ret = GetQueuedCompletionStatus(port, &size, &key, &overlapped_ptr, 0); + todo_wine ok(!ret, "expected failure\n"); + todo_wine ok(GetLastError() == WAIT_TIMEOUT, "got error %u\n", WSAGetLastError()); + + CloseHandle(port); + closesocket(s); + + s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); + + ret = WSAIoctl(s, SIO_GET_EXTENSION_FUNCTION_POINTER, &acceptex_guid, sizeof(GUID), + &func, sizeof(func), NULL, &overlapped, socket_apc); + todo_wine ok(ret == -1, "expected failure\n"); + todo_wine ok(WSAGetLastError() == WSAEFAULT, "got error %u\n", WSAGetLastError()); + + apc_count = 0; + size = 0xdeadbeef; + ret = WSAIoctl(s, SIO_GET_EXTENSION_FUNCTION_POINTER, &acceptex_guid, sizeof(GUID), + &func, sizeof(func), &size, &overlapped, socket_apc); + ok(!ret, "got error %u\n", WSAGetLastError()); + ok(size == sizeof(func), "got size %u\n", size); + + ret = SleepEx(0, TRUE); + todo_wine ok(ret == WAIT_IO_COMPLETION, "got %d\n", ret); + if (ret == WAIT_IO_COMPLETION) + { + ok(apc_count == 1, "APC was called %u times\n", apc_count); + ok(!apc_error, "got APC error %u\n", apc_error); + ok(!apc_size, "got APC size %u\n", apc_size); + ok(apc_overlapped == &overlapped, "got APC overlapped %p\n", apc_overlapped); + } + + closesocket(s); +} + static BOOL drain_pause = FALSE; static DWORD WINAPI drain_socket_thread(LPVOID arg) { @@ -10406,6 +10498,7 @@ START_TEST( sock ) test_address_list_query(); test_fionbio(); test_fionread_siocatmark(); + test_get_extension_func(); test_keepalive_vals(); test_sioRoutingInterfaceQuery(); test_sioAddressListChange();
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=91531
Your paranoid android.
=== wvistau64 (64 bit report) ===
ws2_32: sock.c:3766: Test failed: FIONBIO returned 0 sock.c:3771: Test failed: SIOCATMARK returned 1
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/ws2_32/tests/sock.c | 137 ++++++++++++++++++++++++++++++--------- 1 file changed, 107 insertions(+), 30 deletions(-)
diff --git a/dlls/ws2_32/tests/sock.c b/dlls/ws2_32/tests/sock.c index f5f7e32649f..cf3878eba40 100644 --- a/dlls/ws2_32/tests/sock.c +++ b/dlls/ws2_32/tests/sock.c @@ -7672,44 +7672,121 @@ static void test_getpeername(void)
static void test_sioRoutingInterfaceQuery(void) { - int ret; + OVERLAPPED overlapped = {0}, *overlapped_ptr; + struct sockaddr_in in = {0}, out = {0}; + ULONG_PTR key; + HANDLE port; SOCKET sock; - SOCKADDR_IN sin = { 0 }, sout = { 0 }; - DWORD bytesReturned; + DWORD size; + int ret;
- sock = socket(PF_INET, SOCK_DGRAM, IPPROTO_IP); + sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); ok(sock != INVALID_SOCKET, "Expected socket to return a valid socket\n"); - ret = WSAIoctl(sock, SIO_ROUTING_INTERFACE_QUERY, NULL, 0, NULL, 0, NULL, - NULL, NULL); - ok(ret == SOCKET_ERROR && WSAGetLastError() == WSAEFAULT, - "expected WSAEFAULT, got %d\n", WSAGetLastError()); - ret = WSAIoctl(sock, SIO_ROUTING_INTERFACE_QUERY, &sin, sizeof(sin), - NULL, 0, NULL, NULL, NULL); - ok(ret == SOCKET_ERROR && WSAGetLastError() == WSAEFAULT, - "expected WSAEFAULT, got %d\n", WSAGetLastError()); - ret = WSAIoctl(sock, SIO_ROUTING_INTERFACE_QUERY, &sin, sizeof(sin), - NULL, 0, &bytesReturned, NULL, NULL); - todo_wine ok(ret == SOCKET_ERROR && WSAGetLastError() == WSAEAFNOSUPPORT, - "expected WSAEAFNOSUPPORT, got %d\n", WSAGetLastError()); - sin.sin_family = AF_INET; - ret = WSAIoctl(sock, SIO_ROUTING_INTERFACE_QUERY, &sin, sizeof(sin), - NULL, 0, &bytesReturned, NULL, NULL); - todo_wine ok(ret == SOCKET_ERROR && WSAGetLastError() == WSAEINVAL, - "expected WSAEINVAL, got %d\n", WSAGetLastError()); - sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK); - ret = WSAIoctl(sock, SIO_ROUTING_INTERFACE_QUERY, &sin, sizeof(sin), - NULL, 0, &bytesReturned, NULL, NULL); - ok(ret == SOCKET_ERROR && WSAGetLastError() == WSAEFAULT, - "expected WSAEFAULT, got %d\n", WSAGetLastError()); - ret = WSAIoctl(sock, SIO_ROUTING_INTERFACE_QUERY, &sin, sizeof(sin), - &sout, sizeof(sout), &bytesReturned, NULL, NULL); - ok(!ret, "WSAIoctl failed: %d\n", WSAGetLastError()); - ok(sout.sin_family == AF_INET, "expected AF_INET, got %d\n", sout.sin_family); + port = CreateIoCompletionPort((HANDLE)sock, NULL, 123, 0); + + WSASetLastError(0xdeadbeef); + ret = WSAIoctl(sock, SIO_ROUTING_INTERFACE_QUERY, &in, sizeof(in), &out, sizeof(out), NULL, NULL, NULL); + ok(ret == -1, "expected failure\n"); + ok(WSAGetLastError() == WSAEFAULT, "got error %u\n", WSAGetLastError()); + + size = 0xdeadbeef; + ret = WSAIoctl(sock, SIO_ROUTING_INTERFACE_QUERY, &in, sizeof(in) - 1, &out, sizeof(out), &size, NULL, NULL); + ok(ret == -1, "expected failure\n"); + todo_wine ok(WSAGetLastError() == WSAEINVAL, "got error %u\n", WSAGetLastError()); + ok(size == 0xdeadbeef, "got size %u\n", size); + + size = 0xdeadbeef; + ret = WSAIoctl(sock, SIO_ROUTING_INTERFACE_QUERY, NULL, sizeof(in), &out, sizeof(out), &size, NULL, NULL); + ok(ret == -1, "expected failure\n"); + todo_wine ok(WSAGetLastError() == WSAEINVAL, "got error %u\n", WSAGetLastError()); + ok(size == 0xdeadbeef, "got size %u\n", size); + + size = 0xdeadbeef; + ret = WSAIoctl(sock, SIO_ROUTING_INTERFACE_QUERY, &in, sizeof(in), &out, sizeof(out), &size, NULL, NULL); + ok(ret == -1, "expected failure\n"); + ok(WSAGetLastError() == WSAEAFNOSUPPORT, "got error %u\n", WSAGetLastError()); + ok(size == 0xdeadbeef, "got size %u\n", size); + + in.sin_family = AF_INET; + size = 0xdeadbeef; + ret = WSAIoctl(sock, SIO_ROUTING_INTERFACE_QUERY, &in, sizeof(in), &out, sizeof(out), &size, NULL, NULL); + todo_wine ok(ret == -1, "expected failure\n"); + todo_wine ok(WSAGetLastError() == WSAEINVAL, "got error %u\n", WSAGetLastError()); + todo_wine ok(size == 0xdeadbeef, "got size %u\n", size); + + in.sin_addr.s_addr = htonl(INADDR_LOOPBACK); + WSASetLastError(0xdeadbeef); + size = 0xdeadbeef; + ret = WSAIoctl(sock, SIO_ROUTING_INTERFACE_QUERY, &in, sizeof(in), &out, sizeof(out), &size, NULL, NULL); + ok(!ret, "expected failure\n"); + todo_wine ok(!WSAGetLastError(), "got error %u\n", WSAGetLastError()); + ok(size == sizeof(out), "got size %u\n", size); /* We expect the source address to be INADDR_LOOPBACK as well, but * there's no guarantee that a route to the loopback address exists, * so rather than introduce spurious test failures we do not test the * source address. */ + + size = 0xdeadbeef; + ret = WSAIoctl(sock, SIO_ROUTING_INTERFACE_QUERY, &in, sizeof(in), &out, sizeof(out) - 1, &size, NULL, NULL); + ok(ret == -1, "expected failure\n"); + ok(WSAGetLastError() == WSAEFAULT, "got error %u\n", WSAGetLastError()); + todo_wine ok(size == sizeof(out), "got size %u\n", size); + + size = 0xdeadbeef; + ret = WSAIoctl(sock, SIO_ROUTING_INTERFACE_QUERY, &in, sizeof(in), NULL, sizeof(out), &size, NULL, NULL); + ok(ret == -1, "expected failure\n"); + ok(WSAGetLastError() == WSAEFAULT, "got error %u\n", WSAGetLastError()); + ok(size == 0xdeadbeef, "got size %u\n", size); + + ret = WSAIoctl(sock, SIO_ROUTING_INTERFACE_QUERY, &in, sizeof(in), &out, sizeof(out), NULL, &overlapped, NULL); + ok(ret == -1, "expected failure\n"); + ok(WSAGetLastError() == WSAEFAULT, "got error %u\n", WSAGetLastError()); + ok(size == 0xdeadbeef, "got size %u\n", size); + + WSASetLastError(0xdeadbeef); + size = 0xdeadbeef; + overlapped.Internal = 0xdeadbeef; + overlapped.InternalHigh = 0xdeadbeef; + ret = WSAIoctl(sock, SIO_ROUTING_INTERFACE_QUERY, &in, sizeof(in), &out, sizeof(out), &size, &overlapped, NULL); + ok(!ret, "expected failure\n"); + todo_wine ok(!WSAGetLastError(), "got error %u\n", WSAGetLastError()); + ok(size == sizeof(out), "got size %u\n", size); + + ret = GetQueuedCompletionStatus(port, &size, &key, &overlapped_ptr, 0); + ok(ret, "got error %u\n", GetLastError()); + todo_wine ok(!size, "got size %u\n", size); + ok(overlapped_ptr == &overlapped, "got overlapped %p\n", overlapped_ptr); + ok(!overlapped.Internal, "got status %#x\n", (NTSTATUS)overlapped.Internal); + todo_wine ok(!overlapped.InternalHigh, "got size %Iu\n", overlapped.InternalHigh); + + CloseHandle(port); + closesocket(sock); + + sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); + + ret = WSAIoctl(sock, SIO_ROUTING_INTERFACE_QUERY, &in, sizeof(in), + &out, sizeof(out), NULL, &overlapped, socket_apc); + ok(ret == -1, "expected failure\n"); + ok(WSAGetLastError() == WSAEFAULT, "got error %u\n", WSAGetLastError()); + + apc_count = 0; + size = 0xdeadbeef; + ret = WSAIoctl(sock, SIO_ROUTING_INTERFACE_QUERY, &in, sizeof(in), + &out, sizeof(out), &size, &overlapped, socket_apc); + ok(!ret, "expected success\n"); + ok(size == sizeof(out), "got size %u\n", size); + + ret = SleepEx(0, TRUE); + todo_wine ok(ret == WAIT_IO_COMPLETION, "got %d\n", ret); + if (ret == WAIT_IO_COMPLETION) + { + ok(apc_count == 1, "APC was called %u times\n", apc_count); + ok(!apc_error, "got APC error %u\n", apc_error); + ok(!apc_size, "got APC size %u\n", apc_size); + ok(apc_overlapped == &overlapped, "got APC overlapped %p\n", apc_overlapped); + } + closesocket(sock); }
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=91532
Your paranoid android.
=== wvistau64 (64 bit report) ===
ws2_32: sock.c:3766: Test failed: FIONBIO returned 0 sock.c:3771: Test failed: SIOCATMARK returned 1 sock.c:3786: Test failed: SIOCATMARK returned 1
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=91528
Your paranoid android.
=== debiant2 (32 bit report) ===
ws2_32: afd.c:328: Test failed: got flags 0x43 afd.c:334: Test failed: got flags 0x41
On 5/31/21 10:49 AM, Marvin wrote:
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=91528
Your paranoid android.
=== debiant2 (32 bit report) ===
ws2_32: afd.c:328: Test failed: got flags 0x43 afd.c:334: Test failed: got flags 0x41
That's missing the mark by virtue of a spurious AFD_POLL_READ. Not sure why that's happening; unfortunately I can't seem to reproduce it locally or on the TestBot.