winsock/tests: select() conformance test improvements.

Add OK tests around more function calls.
Add two more todo_wine tests that fail.
This commit is contained in:
Phil Lodwick 2006-02-06 20:59:08 +01:00 committed by Alexandre Julliard
parent 38290cf977
commit 96a46367a9
1 changed files with 36 additions and 17 deletions

View File

@ -1319,26 +1319,45 @@ static void test_WSAStringToAddressW(void)
static void test_select(void) static void test_select(void)
{ {
SOCKET fd; SOCKET fdRead, fdWrite;
fd_set readfds, writefds, exceptfds;
int maxfd;
int ret;
struct timeval select_timeout;
fd = socket(AF_INET, SOCK_STREAM, 0); fdRead = socket(AF_INET, SOCK_STREAM, 0);
if (fd != INVALID_SOCKET) ok( (fdRead != INVALID_SOCKET), "socket failed unexpectedly: %d\n", WSAGetLastError() );
{ fdWrite = socket(AF_INET, SOCK_STREAM, 0);
fd_set readfds; ok( (fdWrite != INVALID_SOCKET), "socket failed unexpectedly: %d\n", WSAGetLastError() );
struct timeval select_timeout;
FD_ZERO(&readfds);
FD_ZERO(&writefds);
FD_ZERO(&exceptfds);
FD_SET(fdRead, &readfds);
FD_SET(fdWrite, &writefds);
FD_SET(fdRead, &exceptfds);
FD_SET(fdWrite, &exceptfds);
select_timeout.tv_sec=2;
select_timeout.tv_usec=0;
FD_ZERO(&readfds); maxfd = fdRead;
FD_SET(fd, &readfds); if (fdWrite > maxfd)
select_timeout.tv_sec=2; maxfd = fdWrite;
select_timeout.tv_usec=0;
todo_wine {
todo_wine { ret = select(maxfd+1, &readfds, &writefds, &exceptfds, &select_timeout);
if (select((int) fd+1, &readfds, NULL, NULL, &select_timeout) != SOCKET_ERROR) ok ( (ret == 0), "select should not return any socket handles\n");
ok(!FD_ISSET(fd, &readfds), "FD should not be set\n"); ok ( !FD_ISSET(fdRead, &readfds), "FD should not be set\n");
} ok ( !FD_ISSET(fdWrite, &writefds), "FD should not be set\n");
closesocket(fd);
} }
ok ( !FD_ISSET(fdRead, &exceptfds), "FD should not be set\n");
ok ( !FD_ISSET(fdWrite, &exceptfds), "FD should not be set\n");
ret = closesocket(fdRead);
ok ( (ret == 0), "closesocket failed unexpectedly: %d\n", ret);
ret = closesocket(fdWrite);
ok ( (ret == 0), "closesocket failed unexpectedly: %d\n", ret);
} }
/**************** Main program ***************/ /**************** Main program ***************/