Module: wine Branch: master Commit: 04154074049bac07c687d1d84211aeb55d2feb99 URL: http://source.winehq.org/git/wine.git/?a=commit;h=04154074049bac07c687d1d842...
Author: Bruno Jesus 00cpxxx@gmail.com Date: Thu Mar 12 03:44:22 2015 -0300
ws2_32/tests: Add more select() tests related to OOB handling.
---
dlls/ws2_32/tests/sock.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-)
diff --git a/dlls/ws2_32/tests/sock.c b/dlls/ws2_32/tests/sock.c index 4abf7d5..ec4b563 100644 --- a/dlls/ws2_32/tests/sock.c +++ b/dlls/ws2_32/tests/sock.c @@ -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);