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
803418c2
Commit
803418c2
authored
Feb 25, 2017
by
Bruno Jesus
Committed by
Alexandre Julliard
Feb 27, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ws2_32/tests: Add a 2 buffer WSARecv test.
Signed-off-by:
Bruno Jesus
<
bjesus@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
b32fb231
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
13 deletions
+31
-13
sock.c
dlls/ws2_32/tests/sock.c
+31
-13
No files found.
dlls/ws2_32/tests/sock.c
View file @
803418c2
...
...
@@ -6626,7 +6626,7 @@ static void test_WSARecv(void)
{
SOCKET
src
,
dest
,
server
=
INVALID_SOCKET
;
char
buf
[
20
];
WSABUF
bufs
;
WSABUF
bufs
[
2
]
;
WSAOVERLAPPED
ov
;
DWORD
bytesReturned
,
flags
,
id
;
struct
linger
ling
;
...
...
@@ -6645,8 +6645,8 @@ static void test_WSARecv(void)
memset
(
&
ov
,
0
,
sizeof
(
ov
));
flags
=
0
;
bufs
.
len
=
2
;
bufs
.
buf
=
buf
;
bufs
[
0
]
.
len
=
2
;
bufs
[
0
]
.
buf
=
buf
;
/* Send 4 bytes and receive in two calls of 2 */
SetLastError
(
0xdeadbeef
);
...
...
@@ -6655,31 +6655,49 @@ static void test_WSARecv(void)
ok
(
GetLastError
()
==
ERROR_SUCCESS
,
"Expected 0, got %d
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
bytesReturned
=
0xdeadbeef
;
iret
=
WSARecv
(
dest
,
&
bufs
,
1
,
&
bytesReturned
,
&
flags
,
NULL
,
NULL
);
iret
=
WSARecv
(
dest
,
bufs
,
1
,
&
bytesReturned
,
&
flags
,
NULL
,
NULL
);
ok
(
!
iret
,
"Expected 0, got %d
\n
"
,
iret
);
ok
(
bytesReturned
,
"Expected 2, got %d
\n
"
,
bytesReturned
);
ok
(
bytesReturned
==
2
,
"Expected 2, got %d
\n
"
,
bytesReturned
);
ok
(
GetLastError
()
==
ERROR_SUCCESS
,
"Expected 0, got %d
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
bytesReturned
=
0xdeadbeef
;
iret
=
WSARecv
(
dest
,
&
bufs
,
1
,
&
bytesReturned
,
&
flags
,
NULL
,
NULL
);
iret
=
WSARecv
(
dest
,
bufs
,
1
,
&
bytesReturned
,
&
flags
,
NULL
,
NULL
);
ok
(
!
iret
,
"Expected 0, got %d
\n
"
,
iret
);
ok
(
bytesReturned
,
"Expected 2, got %d
\n
"
,
bytesReturned
);
ok
(
bytesReturned
==
2
,
"Expected 2, got %d
\n
"
,
bytesReturned
);
ok
(
GetLastError
()
==
ERROR_SUCCESS
,
"Expected 0, got %d
\n
"
,
GetLastError
());
bufs
.
len
=
4
;
bufs
[
0
]
.
len
=
4
;
SetLastError
(
0xdeadbeef
);
iret
=
send
(
src
,
"test"
,
4
,
0
);
ok
(
iret
==
4
,
"Expected 4, got %d
\n
"
,
iret
);
ok
(
GetLastError
()
==
ERROR_SUCCESS
,
"Expected 0, got %d
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
bytesReturned
=
0xdeadbeef
;
iret
=
WSARecv
(
dest
,
&
bufs
,
1
,
&
bytesReturned
,
&
flags
,
NULL
,
NULL
);
iret
=
WSARecv
(
dest
,
bufs
,
1
,
&
bytesReturned
,
&
flags
,
NULL
,
NULL
);
ok
(
!
iret
,
"Expected 0, got %d
\n
"
,
iret
);
ok
(
bytesReturned
,
"Expected 4, got %d
\n
"
,
bytesReturned
);
ok
(
bytesReturned
==
4
,
"Expected 4, got %d
\n
"
,
bytesReturned
);
ok
(
GetLastError
()
==
ERROR_SUCCESS
,
"Expected 0, got %d
\n
"
,
GetLastError
());
bufs
.
len
=
sizeof
(
buf
);
/* Test 2 buffers */
bufs
[
0
].
len
=
4
;
bufs
[
1
].
len
=
5
;
bufs
[
1
].
buf
=
buf
+
10
;
SetLastError
(
0xdeadbeef
);
iret
=
send
(
src
,
"deadbeefs"
,
9
,
0
);
ok
(
iret
==
9
,
"Expected 9, got %d
\n
"
,
iret
);
ok
(
GetLastError
()
==
ERROR_SUCCESS
,
"Expected 0, got %d
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
bytesReturned
=
0xdeadbeef
;
iret
=
WSARecv
(
dest
,
bufs
,
2
,
&
bytesReturned
,
&
flags
,
NULL
,
NULL
);
ok
(
!
iret
,
"Expected 0, got %d
\n
"
,
iret
);
ok
(
bytesReturned
==
9
,
"Expected 9, got %d
\n
"
,
bytesReturned
);
bufs
[
0
].
buf
[
4
]
=
'\0'
;
bufs
[
1
].
buf
[
5
]
=
'\0'
;
ok
(
!
strcmp
(
bufs
[
0
].
buf
,
"dead"
),
"buf[0] doesn't match: %s != dead
\n
"
,
bufs
[
0
].
buf
);
ok
(
!
strcmp
(
bufs
[
1
].
buf
,
"beefs"
),
"buf[1] doesn't match: %s != beefs
\n
"
,
bufs
[
1
].
buf
);
ok
(
GetLastError
()
==
ERROR_SUCCESS
,
"Expected 0, got %d
\n
"
,
GetLastError
());
bufs
[
0
].
len
=
sizeof
(
buf
);
ov
.
hEvent
=
CreateEventA
(
NULL
,
FALSE
,
FALSE
,
NULL
);
ok
(
ov
.
hEvent
!=
NULL
,
"could not create event object, errno = %d
\n
"
,
GetLastError
());
if
(
!
ov
.
hEvent
)
...
...
@@ -6690,10 +6708,10 @@ static void test_WSARecv(void)
iret
=
setsockopt
(
src
,
SOL_SOCKET
,
SO_LINGER
,
(
char
*
)
&
ling
,
sizeof
(
ling
));
ok
(
!
iret
,
"Failed to set linger %d
\n
"
,
GetLastError
());
iret
=
WSARecv
(
dest
,
&
bufs
,
1
,
NULL
,
&
flags
,
&
ov
,
NULL
);
iret
=
WSARecv
(
dest
,
bufs
,
1
,
NULL
,
&
flags
,
&
ov
,
NULL
);
ok
(
iret
==
SOCKET_ERROR
&&
GetLastError
()
==
ERROR_IO_PENDING
,
"WSARecv failed - %d error %d
\n
"
,
iret
,
GetLastError
());
iret
=
WSARecv
(
dest
,
&
bufs
,
1
,
&
bytesReturned
,
&
flags
,
&
ov
,
NULL
);
iret
=
WSARecv
(
dest
,
bufs
,
1
,
&
bytesReturned
,
&
flags
,
&
ov
,
NULL
);
ok
(
iret
==
SOCKET_ERROR
&&
GetLastError
()
==
ERROR_IO_PENDING
,
"WSARecv failed - %d error %d
\n
"
,
iret
,
GetLastError
());
closesocket
(
src
);
...
...
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