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
6d5b7c73
Commit
6d5b7c73
authored
Nov 27, 2014
by
Piotr Caban
Committed by
Alexandre Julliard
Nov 28, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ws2_32/tests: Add more select tests.
parent
459837ec
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
75 additions
and
0 deletions
+75
-0
sock.c
dlls/ws2_32/tests/sock.c
+75
-0
No files found.
dlls/ws2_32/tests/sock.c
View file @
6d5b7c73
...
...
@@ -3229,6 +3229,8 @@ static void test_listen(void)
static
void
test_select
(
void
)
{
static
const
char
tmp_buf
[
1024
];
SOCKET
fdRead
,
fdWrite
;
fd_set
readfds
,
writefds
,
exceptfds
;
unsigned
int
maxfd
;
...
...
@@ -3327,6 +3329,79 @@ static void test_select(void)
ok
(
(
ret
==
SOCKET_ERROR
),
"expected SOCKET_ERROR, got %i
\n
"
,
ret
);
ok
(
WSAGetLastError
()
==
WSAENOTSOCK
,
"expected WSAENOTSOCK, got %i
\n
"
,
WSAGetLastError
());
ok
(
!
FD_ISSET
(
fdRead
,
&
exceptfds
),
"FD should not be set
\n
"
);
ok
(
!
tcp_socketpair
(
&
fdRead
,
&
fdWrite
),
"creating socket pair failed
\n
"
);
maxfd
=
fdRead
;
if
(
fdWrite
>
maxfd
)
maxfd
=
fdWrite
;
FD_ZERO
(
&
readfds
);
FD_SET
(
fdRead
,
&
readfds
);
ret
=
select
(
fdRead
+
1
,
&
readfds
,
NULL
,
NULL
,
&
select_timeout
);
ok
(
!
ret
,
"select returned %d
\n
"
,
ret
);
FD_ZERO
(
&
writefds
);
FD_SET
(
fdWrite
,
&
writefds
);
ret
=
select
(
fdWrite
+
1
,
NULL
,
&
writefds
,
NULL
,
&
select_timeout
);
ok
(
ret
==
1
,
"select returned %d
\n
"
,
ret
);
ok
(
FD_ISSET
(
fdWrite
,
&
writefds
),
"fdWrite socket is not in the set
\n
"
);
/* tests for overlapping fd_set pointers */
FD_ZERO
(
&
readfds
);
FD_SET
(
fdWrite
,
&
readfds
);
ret
=
select
(
fdWrite
+
1
,
&
readfds
,
&
readfds
,
NULL
,
&
select_timeout
);
ok
(
ret
==
1
,
"select returned %d
\n
"
,
ret
);
ok
(
FD_ISSET
(
fdWrite
,
&
readfds
),
"fdWrite socket is not in the set
\n
"
);
FD_ZERO
(
&
readfds
);
FD_SET
(
fdWrite
,
&
readfds
);
FD_SET
(
fdRead
,
&
readfds
);
ret
=
select
(
maxfd
+
1
,
&
readfds
,
&
readfds
,
NULL
,
&
select_timeout
);
ok
(
ret
==
2
,
"select returned %d
\n
"
,
ret
);
ok
(
FD_ISSET
(
fdWrite
,
&
readfds
),
"fdWrite socket is not in the set
\n
"
);
ok
(
FD_ISSET
(
fdRead
,
&
readfds
),
"fdWrite socket is not in the set
\n
"
);
ok
(
send
(
fdWrite
,
"test"
,
4
,
0
)
==
4
,
"failed to send data
\n
"
);
FD_ZERO
(
&
readfds
);
FD_SET
(
fdRead
,
&
readfds
);
ret
=
select
(
fdRead
+
1
,
&
readfds
,
NULL
,
NULL
,
&
select_timeout
);
ok
(
ret
==
1
,
"select returned %d
\n
"
,
ret
);
ok
(
FD_ISSET
(
fdRead
,
&
readfds
),
"fdWrite socket is not in the set
\n
"
);
FD_ZERO
(
&
readfds
);
FD_SET
(
fdWrite
,
&
readfds
);
FD_SET
(
fdRead
,
&
readfds
);
ret
=
select
(
maxfd
+
1
,
&
readfds
,
&
readfds
,
NULL
,
&
select_timeout
);
ok
(
ret
==
2
,
"select returned %d
\n
"
,
ret
);
ok
(
FD_ISSET
(
fdWrite
,
&
readfds
),
"fdWrite socket is not in the set
\n
"
);
ok
(
FD_ISSET
(
fdRead
,
&
readfds
),
"fdWrite socket is not in the set
\n
"
);
while
(
1
)
{
FD_ZERO
(
&
writefds
);
FD_SET
(
fdWrite
,
&
writefds
);
ret
=
select
(
fdWrite
+
1
,
NULL
,
&
writefds
,
NULL
,
&
select_timeout
);
if
(
!
ret
)
break
;
ok
(
send
(
fdWrite
,
tmp_buf
,
sizeof
(
tmp_buf
),
0
)
>
0
,
"failed to send data
\n
"
);
}
FD_ZERO
(
&
readfds
);
FD_SET
(
fdWrite
,
&
readfds
);
FD_SET
(
fdRead
,
&
readfds
);
ret
=
select
(
maxfd
+
1
,
&
readfds
,
&
readfds
,
NULL
,
&
select_timeout
);
ok
(
ret
==
1
,
"select returned %d
\n
"
,
ret
);
ok
(
!
FD_ISSET
(
fdWrite
,
&
readfds
),
"fdWrite socket is in the set
\n
"
);
ok
(
FD_ISSET
(
fdRead
,
&
readfds
),
"fdWrite socket is not in the set
\n
"
);
ok
(
send
(
fdRead
,
"test"
,
4
,
0
)
==
4
,
"failed to send data
\n
"
);
Sleep
(
100
);
FD_ZERO
(
&
readfds
);
FD_SET
(
fdWrite
,
&
readfds
);
FD_SET
(
fdRead
,
&
readfds
);
ret
=
select
(
maxfd
+
1
,
&
readfds
,
&
readfds
,
NULL
,
&
select_timeout
);
ok
(
ret
==
2
,
"select returned %d
\n
"
,
ret
);
ok
(
FD_ISSET
(
fdWrite
,
&
readfds
),
"fdWrite socket is not in the set
\n
"
);
ok
(
FD_ISSET
(
fdRead
,
&
readfds
),
"fdWrite socket is not in the set
\n
"
);
closesocket
(
fdRead
);
closesocket
(
fdWrite
);
}
static
DWORD
WINAPI
AcceptKillThread
(
void
*
param
)
...
...
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