ws2_32/tests: Add more select() tests related to OOB handling.

This commit is contained in:
Bruno Jesus 2015-03-12 03:44:22 -03:00 committed by Alexandre Julliard
parent f1e23aa619
commit 0415407404
1 changed files with 23 additions and 1 deletions

View File

@ -3614,7 +3614,7 @@ static void test_select(void)
/* When OOB data is received the socket is set in the except descriptor */
ret = send(fdWrite, "A", 1, MSG_OOB);
ok(ret == 1, "expected 4, got %d\n", ret);
ok(ret == 1, "expected 1, got %d\n", ret);
FD_ZERO_ALL();
FD_SET_ALL(fdListen);
FD_SET(fdRead, &readfds);
@ -3629,6 +3629,28 @@ todo_wine
ok(ret == 1, "expected 1, got %d\n", ret);
ok(tmp_buf[0] == 'A', "expected 'A', got 0x%02X\n", tmp_buf[0]);
/* If the socket is OOBINLINED it will not receive the OOB in except fds */
ret = 1;
ret = setsockopt(fdRead, SOL_SOCKET, SO_OOBINLINE, (char*) &ret, sizeof(ret));
ok(ret == 0, "expected 0, got %d\n", ret);
ret = send(fdWrite, "A", 1, MSG_OOB);
ok(ret == 1, "expected 1, got %d\n", ret);
FD_ZERO_ALL();
FD_SET_ALL(fdListen);
FD_SET(fdRead, &readfds);
FD_SET(fdRead, &exceptfds);
ret = select(0, &readfds, &writefds, &exceptfds, &select_timeout);
ok(ret == 1, "expected 1, got %d\n", ret);
ok(FD_ISSET(fdRead, &readfds), "fdRead socket is not in the set\n");
tmp_buf[0] = 0xAF;
SetLastError(0xdeadbeef);
ret = recv(fdRead, tmp_buf, sizeof(tmp_buf), MSG_OOB);
ok(ret == SOCKET_ERROR, "expected -1, got %d\n", ret); /* can't recv with MSG_OOB if OOBINLINED */
ok(GetLastError() == WSAEINVAL, "expected 10022, got %d\n", GetLastError());
ret = recv(fdRead, tmp_buf, sizeof(tmp_buf), 0);
ok(ret == 1, "expected 1, got %d\n", ret);
ok(tmp_buf[0] == 'A', "expected 'A', got 0x%02X\n", tmp_buf[0]);
/* When the connection is closed the socket is set in the read descriptor */
ret = closesocket(fdRead);
ok(ret == 0, "expected 0, got %d\n", ret);