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
70d30cb5
Commit
70d30cb5
authored
Apr 24, 2005
by
Mike McCormack
Committed by
Alexandre Julliard
Apr 24, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tests for SignalObjectAndWait.
parent
0cd4317c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
119 additions
and
0 deletions
+119
-0
.cvsignore
dlls/kernel/tests/.cvsignore
+1
-0
Makefile.in
dlls/kernel/tests/Makefile.in
+1
-0
sync.c
dlls/kernel/tests/sync.c
+117
-0
No files found.
dlls/kernel/tests/.cvsignore
View file @
70d30cb5
...
...
@@ -19,6 +19,7 @@ path.ok
pipe.ok
process.ok
profile.ok
sync.ok
testlist.c
thread.ok
time.ok
...
...
dlls/kernel/tests/Makefile.in
View file @
70d30cb5
...
...
@@ -26,6 +26,7 @@ CTESTS = \
pipe.c
\
process.c
\
profile.c
\
sync.c
\
thread.c
\
time.c
\
timer.c
\
...
...
dlls/kernel/tests/sync.c
0 → 100644
View file @
70d30cb5
/*
* Synchronization tests
*
* Copyright 2005 Mike McCormack for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <stdarg.h>
#include <stdlib.h>
#include <stdio.h>
#include <windef.h>
#include <winbase.h>
#include "wine/test.h"
static
void
test_signalandwait
(
void
)
{
DWORD
(
WINAPI
*
pSignalObjectAndWait
)(
HANDLE
,
HANDLE
,
DWORD
,
BOOL
);
HMODULE
kernel32
;
DWORD
r
;
HANDLE
event
[
2
],
semaphore
[
2
],
file
;
kernel32
=
GetModuleHandle
(
"kernel32"
);
pSignalObjectAndWait
=
(
void
*
)
GetProcAddress
(
kernel32
,
"SignalObjectAndWait"
);
if
(
!
pSignalObjectAndWait
)
return
;
/* events */
event
[
0
]
=
CreateEvent
(
NULL
,
0
,
0
,
NULL
);
event
[
1
]
=
CreateEvent
(
NULL
,
1
,
1
,
NULL
);
ok
(
event
[
0
]
&&
event
[
1
],
"failed to create event flags
\n
"
);
/* invalid parameters */
r
=
pSignalObjectAndWait
(
NULL
,
NULL
,
0
,
0
);
ok
(
r
==
WAIT_FAILED
,
"should fail
\n
"
);
r
=
pSignalObjectAndWait
(
event
[
0
],
NULL
,
0
,
FALSE
);
ok
(
r
==
WAIT_FAILED
,
"should fail
\n
"
);
r
=
pSignalObjectAndWait
(
NULL
,
event
[
0
],
0
,
FALSE
);
ok
(
r
==
WAIT_FAILED
,
"should fail
\n
"
);
/* valid parameters */
r
=
pSignalObjectAndWait
(
event
[
0
],
event
[
1
],
0
,
FALSE
);
ok
(
r
==
WAIT_OBJECT_0
,
"should succeed
\n
"
);
/* event[0] is now signalled */
r
=
pSignalObjectAndWait
(
event
[
0
],
event
[
0
],
0
,
FALSE
);
ok
(
r
==
WAIT_OBJECT_0
,
"should succeed
\n
"
);
/* event[0] is not signalled */
r
=
WaitForSingleObject
(
event
[
0
],
0
);
ok
(
r
==
WAIT_TIMEOUT
,
"event was signalled
\n
"
);
r
=
pSignalObjectAndWait
(
event
[
0
],
event
[
0
],
0
,
FALSE
);
ok
(
r
==
WAIT_OBJECT_0
,
"should succeed
\n
"
);
/* clear event[1] and check for a timeout */
ok
(
ResetEvent
(
event
[
1
]),
"failed to clear event[1]
\n
"
);
r
=
pSignalObjectAndWait
(
event
[
0
],
event
[
1
],
0
,
FALSE
);
ok
(
r
==
WAIT_TIMEOUT
,
"should timeout
\n
"
);
CloseHandle
(
event
[
0
]);
CloseHandle
(
event
[
1
]);
/* semaphores */
semaphore
[
0
]
=
CreateSemaphore
(
NULL
,
0
,
1
,
NULL
);
semaphore
[
1
]
=
CreateSemaphore
(
NULL
,
1
,
1
,
NULL
);
ok
(
semaphore
[
0
]
&&
semaphore
[
1
],
"failed to create semaphore
\n
"
);
r
=
pSignalObjectAndWait
(
semaphore
[
0
],
semaphore
[
1
],
0
,
FALSE
);
ok
(
r
==
WAIT_OBJECT_0
,
"should succeed
\n
"
);
r
=
pSignalObjectAndWait
(
semaphore
[
0
],
semaphore
[
1
],
0
,
FALSE
);
ok
(
r
==
WAIT_FAILED
,
"should fail
\n
"
);
r
=
ReleaseSemaphore
(
semaphore
[
0
],
1
,
NULL
);
ok
(
r
==
FALSE
,
"should fail
\n
"
);
r
=
ReleaseSemaphore
(
semaphore
[
1
],
1
,
NULL
);
ok
(
r
==
TRUE
,
"should succeed
\n
"
);
CloseHandle
(
semaphore
[
0
]);
CloseHandle
(
semaphore
[
1
]);
/* try a registry key */
file
=
CreateFile
(
"x"
,
GENERIC_READ
|
GENERIC_WRITE
,
0
,
NULL
,
CREATE_ALWAYS
,
FILE_ATTRIBUTE_NORMAL
|
FILE_FLAG_DELETE_ON_CLOSE
,
NULL
);
r
=
pSignalObjectAndWait
(
file
,
file
,
0
,
FALSE
);
ok
(
r
==
WAIT_FAILED
,
"should fail
\n
"
);
todo_wine
{
ok
(
ERROR_INVALID_HANDLE
==
GetLastError
(),
"should return invalid handle error
\n
"
);
}
CloseHandle
(
file
);
}
START_TEST
(
sync
)
{
test_signalandwait
();
}
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