Bruno Jesus : ws2_32/tests: Add SO_ACCEPTCONN tests.
Alexandre Julliard
julliard at winehq.org
Tue Jul 30 14:14:22 CDT 2013
Module: wine
Branch: master
Commit: 4133fb4341bf5376c612af019831ae79427b7c7a
URL: http://source.winehq.org/git/wine.git/?a=commit;h=4133fb4341bf5376c612af019831ae79427b7c7a
Author: Bruno Jesus <00cpxxx at gmail.com>
Date: Tue Jul 30 09:58:38 2013 -0300
ws2_32/tests: Add SO_ACCEPTCONN tests.
---
dlls/ws2_32/tests/sock.c | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/dlls/ws2_32/tests/sock.c b/dlls/ws2_32/tests/sock.c
index fce0b99..1a75ffd 100644
--- a/dlls/ws2_32/tests/sock.c
+++ b/dlls/ws2_32/tests/sock.c
@@ -2460,7 +2460,7 @@ static void test_errors(void)
static void test_listen(void)
{
SOCKET fdA, fdB;
- int ret;
+ int ret, acceptc, olen = sizeof(acceptc);
struct sockaddr_in address;
memset(&address, 0, sizeof(address));
@@ -2507,9 +2507,17 @@ static void test_listen(void)
ok (bind(fdB, (struct sockaddr*) &address, sizeof(address)), "bind should have failed\n");
ok (ret == WSAEINVAL, "expected 10022, received %d\n", ret);
+ acceptc = 0xdead;
+ ok (!getsockopt(fdA, SOL_SOCKET, SO_ACCEPTCONN, (char*)&acceptc, &olen), "getsockopt failed\n");
+ ok (acceptc == 0, "SO_ACCEPTCONN should be 0, received %d\n", acceptc);
+
ok (!listen(fdA, 0), "listen failed\n");
ok (!listen(fdA, SOMAXCONN), "double listen failed\n");
+ acceptc = 0xdead;
+ ok (!getsockopt(fdA, SOL_SOCKET, SO_ACCEPTCONN, (char*)&acceptc, &olen), "getsockopt failed\n");
+ ok (acceptc == 1, "SO_ACCEPTCONN should be 1, received %d\n", acceptc);
+
SetLastError(0xdeadbeef);
ok ((listen(fdB, SOMAXCONN) == SOCKET_ERROR), "listen did not fail\n");
ret = WSAGetLastError();
@@ -2521,7 +2529,6 @@ static void test_listen(void)
fdB = socket(AF_INET, SOCK_STREAM, 0);
ok ((fdB != INVALID_SOCKET), "socket failed unexpectedly: %d\n", WSAGetLastError() );
-
SetLastError(0xdeadbeef);
ok (bind(fdB, (struct sockaddr*) &address, sizeof(address)), "bind should have failed\n");
ret = WSAGetLastError();
More information about the wine-cvs
mailing list