Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
2da8f9a9
Commit
2da8f9a9
authored
Apr 12, 2015
by
Bruno Jesus
Committed by
Alexandre Julliard
Apr 13, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ws2_32/tests: Add more select() tests.
parent
9f622f1f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
0 deletions
+51
-0
sock.c
dlls/ws2_32/tests/sock.c
+51
-0
No files found.
dlls/ws2_32/tests/sock.c
View file @
2da8f9a9
...
...
@@ -3368,6 +3368,14 @@ static DWORD WINAPI SelectReadThread(void *param)
return
0
;
}
static
DWORD
WINAPI
SelectCloseThread
(
void
*
param
)
{
SOCKET
s
=
*
(
SOCKET
*
)
param
;
Sleep
(
500
);
closesocket
(
s
);
return
0
;
}
static
void
test_errors
(
void
)
{
SOCKET
sock
;
...
...
@@ -3792,6 +3800,49 @@ static void test_select(void)
ok
(
FD_ISSET
(
fdWrite
,
&
exceptfds
),
"fdWrite socket is not in the set
\n
"
);
ok
(
select_timeout
.
tv_usec
==
250000
,
"select timeout should not have changed
\n
"
);
closesocket
(
fdWrite
);
/* Try select() on a closed socket after connection */
ok
(
!
tcp_socketpair
(
&
fdRead
,
&
fdWrite
),
"creating socket pair failed
\n
"
);
closesocket
(
fdRead
);
FD_ZERO_ALL
();
FD_SET_ALL
(
fdWrite
);
FD_SET_ALL
(
fdRead
);
SetLastError
(
0xdeadbeef
);
ret
=
select
(
0
,
&
readfds
,
NULL
,
&
exceptfds
,
&
select_timeout
);
ok
(
ret
==
SOCKET_ERROR
,
"expected 1, got %d
\n
"
,
ret
);
todo_wine
ok
(
GetLastError
()
==
WSAENOTSOCK
,
"expected 10038, got %d
\n
"
,
GetLastError
());
/* descriptor sets are unchanged */
ok
(
readfds
.
fd_count
==
2
,
"expected 2, got %d
\n
"
,
readfds
.
fd_count
);
ok
(
exceptfds
.
fd_count
==
2
,
"expected 2, got %d
\n
"
,
exceptfds
.
fd_count
);
closesocket
(
fdWrite
);
/* Close the socket currently being selected in a thread - bug 38399 */
ok
(
!
tcp_socketpair
(
&
fdRead
,
&
fdWrite
),
"creating socket pair failed
\n
"
);
thread_handle
=
CreateThread
(
NULL
,
0
,
SelectCloseThread
,
&
fdWrite
,
0
,
&
id
);
ok
(
thread_handle
!=
NULL
,
"CreateThread failed unexpectedly: %d
\n
"
,
GetLastError
());
FD_ZERO_ALL
();
FD_SET_ALL
(
fdWrite
);
ret
=
select
(
0
,
&
readfds
,
NULL
,
&
exceptfds
,
&
select_timeout
);
todo_wine
ok
(
ret
==
1
,
"expected 1, got %d
\n
"
,
ret
);
ok
(
FD_ISSET
(
fdWrite
,
&
readfds
),
"fdWrite socket is not in the set
\n
"
);
WaitForSingleObject
(
thread_handle
,
1000
);
closesocket
(
fdRead
);
/* test again with only the except descriptor */
ok
(
!
tcp_socketpair
(
&
fdRead
,
&
fdWrite
),
"creating socket pair failed
\n
"
);
thread_handle
=
CreateThread
(
NULL
,
0
,
SelectCloseThread
,
&
fdWrite
,
0
,
&
id
);
ok
(
thread_handle
!=
NULL
,
"CreateThread failed unexpectedly: %d
\n
"
,
GetLastError
());
FD_ZERO_ALL
();
FD_SET
(
fdWrite
,
&
exceptfds
);
SetLastError
(
0xdeadbeef
);
ret
=
select
(
0
,
NULL
,
NULL
,
&
exceptfds
,
&
select_timeout
);
todo_wine
ok
(
ret
==
SOCKET_ERROR
,
"expected 1, got %d
\n
"
,
ret
);
todo_wine
ok
(
GetLastError
()
==
WSAENOTSOCK
,
"expected 10038, got %d
\n
"
,
GetLastError
());
WaitForSingleObject
(
thread_handle
,
1000
);
closesocket
(
fdRead
);
}
#undef FD_SET_ALL
#undef FD_ZERO_ALL
...
...
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