Module: wine Branch: master Commit: e1705151a95949cef15f3cb583831ca0e2323a45 URL: http://source.winehq.org/git/wine.git/?a=commit;h=e1705151a95949cef15f3cb583...
Author: Vincent Povirk vincent@codeweavers.com Date: Sun Sep 12 16:17:09 2010 -0500
ws2_32: Add a test for selecting invalid sockets.
---
dlls/ws2_32/tests/sock.c | 26 ++++++++++++++++++++++++++ 1 files changed, 26 insertions(+), 0 deletions(-)
diff --git a/dlls/ws2_32/tests/sock.c b/dlls/ws2_32/tests/sock.c index 631fcda..16c6fcb 100644 --- a/dlls/ws2_32/tests/sock.c +++ b/dlls/ws2_32/tests/sock.c @@ -1939,6 +1939,32 @@ static void test_select(void) broken(thread_params.ReadKilled == 0), /*Win98*/ "closesocket did not wakeup select\n");
+ /* Test selecting invalid handles */ + FD_ZERO(&readfds); + FD_ZERO(&writefds); + FD_ZERO(&exceptfds); + FD_SET(INVALID_SOCKET, &readfds); + SetLastError(0); + ret = select(maxfd+1, &readfds, &writefds, &exceptfds, &select_timeout); + todo_wine ok ( (ret == SOCKET_ERROR), "expected SOCKET_ERROR, got %i\n", ret); + ok ( GetLastError() == WSAENOTSOCK, "expected WSAENOTSOCK, got %i\n", ret); + ok ( !FD_ISSET(fdRead, &readfds), "FD should not be set\n"); + + FD_ZERO(&readfds); + FD_SET(INVALID_SOCKET, &writefds); + SetLastError(0); + ret = select(maxfd+1, &readfds, &writefds, &exceptfds, &select_timeout); + todo_wine ok ( (ret == SOCKET_ERROR), "expected SOCKET_ERROR, got %i\n", ret); + ok ( GetLastError() == WSAENOTSOCK, "expected WSAENOTSOCK, got %i\n", ret); + ok ( !FD_ISSET(fdRead, &writefds), "FD should not be set\n"); + + FD_ZERO(&writefds); + FD_SET(INVALID_SOCKET, &exceptfds); + SetLastError(0); + ret = select(maxfd+1, &readfds, &writefds, &exceptfds, &select_timeout); + todo_wine ok ( (ret == SOCKET_ERROR), "expected SOCKET_ERROR, got %i\n", ret); + ok ( GetLastError() == WSAENOTSOCK, "expected WSAENOTSOCK, got %i\n", ret); + ok ( !FD_ISSET(fdRead, &exceptfds), "FD should not be set\n"); }
static DWORD WINAPI AcceptKillThread(select_thread_params *par)