Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
9ea1835b
Commit
9ea1835b
authored
Jul 20, 2013
by
Bruno Jesus
Committed by
Alexandre Julliard
Jul 22, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ws2_32/tests: Add listen() tests for TCP sockets.
parent
2046d69b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
80 additions
and
0 deletions
+80
-0
sock.c
dlls/ws2_32/tests/sock.c
+80
-0
No files found.
dlls/ws2_32/tests/sock.c
View file @
9ea1835b
...
...
@@ -2357,6 +2357,85 @@ static void test_errors(void)
ok
(
(
ret
==
0
),
"closesocket failed unexpectedly: %d
\n
"
,
WSAGetLastError
());
}
static
void
test_listen
(
void
)
{
SOCKET
fdA
,
fdB
;
int
ret
;
struct
sockaddr_in
address
;
memset
(
&
address
,
0
,
sizeof
(
address
));
address
.
sin_addr
.
s_addr
=
inet_addr
(
"127.0.0.1"
);
address
.
sin_family
=
AF_INET
;
address
.
sin_port
=
htons
(
SERVERPORT
);
/* invalid socket tests */
SetLastError
(
0xdeadbeef
);
ok
((
listen
(
0
,
0
)
==
SOCKET_ERROR
),
"listen did not fail
\n
"
);
ret
=
WSAGetLastError
();
todo_wine
ok
(
ret
==
WSAENOTSOCK
,
"expected 10038, received %d
\n
"
,
ret
);
SetLastError
(
0xdeadbeef
);
ok
((
listen
(
0xdeadbeef
,
0
)
==
SOCKET_ERROR
),
"listen did not fail
\n
"
);
ret
=
WSAGetLastError
();
todo_wine
ok
(
ret
==
WSAENOTSOCK
,
"expected 10038, received %d
\n
"
,
ret
);
/* tcp tests */
fdA
=
socket
(
AF_INET
,
SOCK_STREAM
,
0
);
ok
((
fdA
!=
INVALID_SOCKET
),
"socket failed unexpectedly: %d
\n
"
,
WSAGetLastError
()
);
fdB
=
socket
(
AF_INET
,
SOCK_STREAM
,
0
);
ok
((
fdB
!=
INVALID_SOCKET
),
"socket failed unexpectedly: %d
\n
"
,
WSAGetLastError
()
);
todo_wine
{
SetLastError
(
0xdeadbeef
);
ok
((
listen
(
fdA
,
-
2
)
==
SOCKET_ERROR
),
"listen did not fail
\n
"
);
ret
=
WSAGetLastError
();
ok
(
ret
==
WSAEINVAL
,
"expected 10022, received %d
\n
"
,
ret
);
SetLastError
(
0xdeadbeef
);
ok
((
listen
(
fdA
,
1
)
==
SOCKET_ERROR
),
"listen did not fail
\n
"
);
ret
=
WSAGetLastError
();
ok
(
ret
==
WSAEINVAL
,
"expected 10022, received %d
\n
"
,
ret
);
SetLastError
(
0xdeadbeef
);
ok
((
listen
(
fdA
,
SOMAXCONN
)
==
SOCKET_ERROR
),
"listen did not fail
\n
"
);
ret
=
WSAGetLastError
();
ok
(
ret
==
WSAEINVAL
,
"expected 10022, received %d
\n
"
,
ret
);
ok
(
!
bind
(
fdA
,
(
struct
sockaddr
*
)
&
address
,
sizeof
(
address
)),
"bind failed
\n
"
);
SetLastError
(
0xdeadbeef
);
ok
(
bind
(
fdB
,
(
struct
sockaddr
*
)
&
address
,
sizeof
(
address
)),
"bind should have failed
\n
"
);
ok
(
ret
==
WSAEINVAL
,
"expected 10022, received %d
\n
"
,
ret
);
}
ok
(
!
listen
(
fdA
,
0
),
"listen failed
\n
"
);
ok
(
!
listen
(
fdA
,
SOMAXCONN
),
"double listen failed
\n
"
);
todo_wine
{
SetLastError
(
0xdeadbeef
);
ok
((
listen
(
fdB
,
SOMAXCONN
)
==
SOCKET_ERROR
),
"listen did not fail
\n
"
);
ret
=
WSAGetLastError
();
ok
(
ret
==
WSAEINVAL
,
"expected 10022, received %d
\n
"
,
ret
);
}
ret
=
closesocket
(
fdB
);
ok
(
ret
==
0
,
"closesocket failed unexpectedly: %d
\n
"
,
ret
);
fdB
=
socket
(
AF_INET
,
SOCK_STREAM
,
0
);
ok
((
fdB
!=
INVALID_SOCKET
),
"socket failed unexpectedly: %d
\n
"
,
WSAGetLastError
()
);
todo_wine
{
SetLastError
(
0xdeadbeef
);
ok
(
bind
(
fdB
,
(
struct
sockaddr
*
)
&
address
,
sizeof
(
address
)),
"bind should have failed
\n
"
);
ret
=
WSAGetLastError
();
ok
(
ret
==
WSAEADDRINUSE
,
"expected 10048, received %d
\n
"
,
ret
);
}
ret
=
closesocket
(
fdA
);
ok
(
ret
==
0
,
"closesocket failed unexpectedly: %d
\n
"
,
ret
);
ret
=
closesocket
(
fdB
);
ok
(
ret
==
0
,
"closesocket failed unexpectedly: %d
\n
"
,
ret
);
}
static
void
test_select
(
void
)
{
SOCKET
fdRead
,
fdWrite
;
...
...
@@ -6098,6 +6177,7 @@ START_TEST( sock )
test_WSAStringToAddressW
();
test_errors
();
test_listen
();
test_select
();
test_accept
();
test_getpeername
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment