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
b9f6f389
Commit
b9f6f389
authored
Apr 05, 2017
by
Jacek Caban
Committed by
Alexandre Julliard
Apr 05, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ws2_32/tests: Added WSARecv tests using completion function.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
da4688ff
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
5 deletions
+40
-5
sock.c
dlls/ws2_32/tests/sock.c
+40
-5
No files found.
dlls/ws2_32/tests/sock.c
View file @
b9f6f389
...
...
@@ -6656,6 +6656,13 @@ static DWORD WINAPI recv_thread(LPVOID arg)
return
0
;
}
static
int
completion_called
;
static
void
WINAPI
io_completion
(
DWORD
error
,
DWORD
transferred
,
WSAOVERLAPPED
*
overlapped
,
DWORD
flags
)
{
completion_called
++
;
}
static
void
test_WSARecv
(
void
)
{
SOCKET
src
,
dest
,
server
=
INVALID_SOCKET
;
...
...
@@ -6668,7 +6675,7 @@ static void test_WSARecv(void)
int
iret
,
len
;
DWORD
dwret
;
BOOL
bret
;
HANDLE
thread
;
HANDLE
thread
,
event
=
NULL
,
io_port
;
tcp_socketpair
(
&
src
,
&
dest
);
if
(
src
==
INVALID_SOCKET
||
dest
==
INVALID_SOCKET
)
...
...
@@ -6732,9 +6739,9 @@ static void test_WSARecv(void)
ok
(
GetLastError
()
==
ERROR_SUCCESS
,
"Expected 0, got %d
\n
"
,
GetLastError
());
bufs
[
0
].
len
=
sizeof
(
buf
);
ov
.
hEvent
=
CreateEventA
(
NULL
,
FALSE
,
FALSE
,
NULL
);
ov
.
hEvent
=
event
=
CreateEventA
(
NULL
,
FALSE
,
FALSE
,
NULL
);
ok
(
ov
.
hEvent
!=
NULL
,
"could not create event object, errno = %d
\n
"
,
GetLastError
());
if
(
!
ov
.
hE
vent
)
if
(
!
e
vent
)
goto
end
;
ling
.
l_onoff
=
1
;
...
...
@@ -6795,6 +6802,34 @@ static void test_WSARecv(void)
WaitForSingleObject
(
thread
,
3000
);
CloseHandle
(
thread
);
memset
(
&
ov
,
0
,
sizeof
(
ov
));
ov
.
hEvent
=
event
;
ResetEvent
(
event
);
iret
=
WSARecv
(
dest
,
bufs
,
1
,
NULL
,
&
flags
,
&
ov
,
io_completion
);
ok
(
iret
==
SOCKET_ERROR
&&
GetLastError
()
==
ERROR_IO_PENDING
,
"WSARecv failed - %d error %d
\n
"
,
iret
,
GetLastError
());
send
(
src
,
"test message"
,
sizeof
(
"test message"
),
0
);
completion_called
=
0
;
dwret
=
SleepEx
(
1000
,
TRUE
);
ok
(
dwret
==
WAIT_IO_COMPLETION
,
"got %u
\n
"
,
dwret
);
ok
(
completion_called
==
1
,
"completion not called
\n
"
);
dwret
=
WaitForSingleObject
(
event
,
1
);
ok
(
dwret
==
WAIT_TIMEOUT
,
"got %u
\n
"
,
dwret
);
io_port
=
CreateIoCompletionPort
(
(
HANDLE
)
dest
,
NULL
,
0
,
0
);
ok
(
io_port
!=
NULL
,
"failed to create completion port %u
\n
"
,
GetLastError
());
/* Using completion function on socket associated with completion port is not allowed. */
memset
(
&
ov
,
0
,
sizeof
(
ov
));
completion_called
=
0
;
iret
=
WSARecv
(
dest
,
bufs
,
1
,
NULL
,
&
flags
,
&
ov
,
io_completion
);
todo_wine
ok
(
iret
==
SOCKET_ERROR
&&
GetLastError
()
==
WSAEINVAL
,
"WSARecv failed - %d error %d
\n
"
,
iret
,
GetLastError
());
ok
(
!
completion_called
,
"completion called
\n
"
);
CloseHandle
(
io_port
);
end:
if
(
server
!=
INVALID_SOCKET
)
closesocket
(
server
);
...
...
@@ -6802,8 +6837,8 @@ end:
closesocket
(
dest
);
if
(
src
!=
INVALID_SOCKET
)
closesocket
(
src
);
if
(
ov
.
hE
vent
)
WSACloseEvent
(
ov
.
hE
vent
);
if
(
e
vent
)
WSACloseEvent
(
e
vent
);
}
#define POLL_CLEAR() ix = 0
...
...
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