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
6870f137
Commit
6870f137
authored
May 28, 2020
by
Paul Gofman
Committed by
Alexandre Julliard
May 28, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntoskrnl.exe/tests: Add more timer tests.
Signed-off-by:
Paul Gofman
<
pgofman@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
a4a903f9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
85 additions
and
3 deletions
+85
-3
driver.c
dlls/ntoskrnl.exe/tests/driver.c
+85
-3
No files found.
dlls/ntoskrnl.exe/tests/driver.c
View file @
6870f137
...
@@ -382,6 +382,14 @@ static void test_critical_region(BOOL is_dispatcher)
...
@@ -382,6 +382,14 @@ static void test_critical_region(BOOL is_dispatcher)
"KeAreApcsDisabled returned %x
\n
"
,
result
);
"KeAreApcsDisabled returned %x
\n
"
,
result
);
}
}
static
void
sleep_1ms
(
void
)
{
LARGE_INTEGER
timeout
;
timeout
.
QuadPart
=
-
1
*
10000
;
KeDelayExecutionThread
(
KernelMode
,
FALSE
,
&
timeout
);
}
static
void
sleep
(
void
)
static
void
sleep
(
void
)
{
{
LARGE_INTEGER
timeout
;
LARGE_INTEGER
timeout
;
...
@@ -447,18 +455,32 @@ static void WINAPI remove_lock_thread(void *arg)
...
@@ -447,18 +455,32 @@ static void WINAPI remove_lock_thread(void *arg)
PsTerminateSystemThread
(
STATUS_SUCCESS
);
PsTerminateSystemThread
(
STATUS_SUCCESS
);
}
}
struct
test_sync_dpc_context
{
BOOL
called
;
};
static
void
WINAPI
test_sync_dpc
(
KDPC
*
dpc
,
void
*
context
,
void
*
system_argument1
,
void
*
system_argument2
)
{
struct
test_sync_dpc_context
*
c
=
context
;
c
->
called
=
TRUE
;
}
static
void
test_sync
(
void
)
static
void
test_sync
(
void
)
{
{
static
const
ULONG
wine_tag
=
0x454e4957
;
/* WINE */
static
const
ULONG
wine_tag
=
0x454e4957
;
/* WINE */
KSEMAPHORE
semaphore
,
semaphore2
;
struct
test_sync_dpc_context
dpc_context
;
KEVENT
manual_event
,
auto_event
,
*
event
;
KEVENT
manual_event
,
auto_event
,
*
event
;
K
TIMER
timer
;
K
SEMAPHORE
semaphore
,
semaphore2
;
IO_REMOVE_LOCK
remove_lock
;
IO_REMOVE_LOCK
remove_lock
;
LARGE_INTEGER
timeout
;
LARGE_INTEGER
timeout
;
OBJECT_ATTRIBUTES
attr
;
OBJECT_ATTRIBUTES
attr
;
HANDLE
handle
,
thread
;
HANDLE
handle
,
thread
;
void
*
objs
[
2
];
void
*
objs
[
2
];
KTIMER
timer
;
NTSTATUS
ret
;
NTSTATUS
ret
;
KDPC
dpc
;
int
i
;
int
i
;
KeInitializeEvent
(
&
manual_event
,
NotificationEvent
,
FALSE
);
KeInitializeEvent
(
&
manual_event
,
NotificationEvent
,
FALSE
);
...
@@ -711,13 +733,19 @@ static void test_sync(void)
...
@@ -711,13 +733,19 @@ static void test_sync(void)
KeCancelTimer
(
&
timer
);
KeCancelTimer
(
&
timer
);
KeInitializeTimerEx
(
&
timer
,
SynchronizationTimer
);
KeInitializeTimerEx
(
&
timer
,
SynchronizationTimer
);
KeSetTimerEx
(
&
timer
,
timeout
,
0
,
NULL
);
memset
(
&
dpc_context
,
0
,
sizeof
(
dpc_context
));
KeInitializeDpc
(
&
dpc
,
test_sync_dpc
,
&
dpc_context
);
KeSetTimerEx
(
&
timer
,
timeout
,
0
,
&
dpc
);
ret
=
wait_single
(
&
timer
,
0
);
ret
=
wait_single
(
&
timer
,
0
);
ok
(
ret
==
WAIT_TIMEOUT
,
"got %#x
\n
"
,
ret
);
ok
(
ret
==
WAIT_TIMEOUT
,
"got %#x
\n
"
,
ret
);
ok
(
!
dpc_context
.
called
,
"DPC was called unexpectedly.
\n
"
);
ret
=
wait_single
(
&
timer
,
-
40
*
10000
);
ret
=
wait_single
(
&
timer
,
-
40
*
10000
);
ok
(
ret
==
0
,
"got %#x
\n
"
,
ret
);
ok
(
ret
==
0
,
"got %#x
\n
"
,
ret
);
sleep_1ms
();
ok
(
dpc_context
.
called
,
"DPC was not called.
\n
"
);
ret
=
wait_single
(
&
timer
,
-
40
*
10000
);
ret
=
wait_single
(
&
timer
,
-
40
*
10000
);
ok
(
ret
==
WAIT_TIMEOUT
,
"got %#x
\n
"
,
ret
);
ok
(
ret
==
WAIT_TIMEOUT
,
"got %#x
\n
"
,
ret
);
...
@@ -742,6 +770,60 @@ static void test_sync(void)
...
@@ -742,6 +770,60 @@ static void test_sync(void)
KeCancelTimer
(
&
timer
);
KeCancelTimer
(
&
timer
);
/* Test cancelling timer. */
dpc_context
.
called
=
0
;
KeSetTimerEx
(
&
timer
,
timeout
,
0
,
&
dpc
);
ret
=
wait_single
(
&
timer
,
0
);
ok
(
ret
==
WAIT_TIMEOUT
,
"got %#x
\n
"
,
ret
);
ok
(
!
dpc_context
.
called
,
"DPC was called.
\n
"
);
KeCancelTimer
(
&
timer
);
dpc_context
.
called
=
0
;
ret
=
wait_single
(
&
timer
,
-
40
*
10000
);
ok
(
ret
==
WAIT_TIMEOUT
,
"got %#x
\n
"
,
ret
);
ok
(
!
dpc_context
.
called
,
"DPC was called.
\n
"
);
KeSetTimerEx
(
&
timer
,
timeout
,
20
,
&
dpc
);
KeSetTimerEx
(
&
timer
,
timeout
,
0
,
&
dpc
);
ret
=
wait_single
(
&
timer
,
0
);
ok
(
ret
==
WAIT_TIMEOUT
,
"got %#x
\n
"
,
ret
);
ret
=
wait_single
(
&
timer
,
-
40
*
10000
);
ok
(
ret
==
0
,
"got %#x
\n
"
,
ret
);
ret
=
wait_single
(
&
timer
,
0
);
ok
(
ret
==
WAIT_TIMEOUT
,
"got %#x
\n
"
,
ret
);
ret
=
wait_single
(
&
timer
,
-
40
*
10000
);
ok
(
ret
==
WAIT_TIMEOUT
,
"got %#x
\n
"
,
ret
);
ret
=
wait_single
(
&
timer
,
-
40
*
10000
);
ok
(
ret
==
WAIT_TIMEOUT
,
"got %#x
\n
"
,
ret
);
KeCancelTimer
(
&
timer
);
/* Test reinitializing timer. */
KeSetTimerEx
(
&
timer
,
timeout
,
0
,
&
dpc
);
KeInitializeTimerEx
(
&
timer
,
SynchronizationTimer
);
dpc_context
.
called
=
0
;
ret
=
wait_single
(
&
timer
,
-
40
*
10000
);
ok
(
ret
==
0
,
"got %#x
\n
"
,
ret
);
sleep_1ms
();
todo_wine
ok
(
dpc_context
.
called
,
"DPC was not called.
\n
"
);
ret
=
wait_single
(
&
timer
,
0
);
ok
(
ret
==
WAIT_TIMEOUT
,
"got %#x
\n
"
,
ret
);
sleep_1ms
();
todo_wine
ok
(
dpc_context
.
called
,
"DPC was not called.
\n
"
);
dpc_context
.
called
=
0
;
KeSetTimerEx
(
&
timer
,
timeout
,
0
,
&
dpc
);
ret
=
wait_single
(
&
timer
,
-
40
*
10000
);
ok
(
ret
==
0
,
"got %#x
\n
"
,
ret
);
sleep_1ms
();
ok
(
dpc_context
.
called
,
"DPC was not called.
\n
"
);
KeCancelTimer
(
&
timer
);
/* remove locks */
/* remove locks */
IoInitializeRemoveLockEx
(
&
remove_lock
,
wine_tag
,
0
,
0
,
sizeof
(
IO_REMOVE_LOCK_COMMON_BLOCK
));
IoInitializeRemoveLockEx
(
&
remove_lock
,
wine_tag
,
0
,
0
,
sizeof
(
IO_REMOVE_LOCK_COMMON_BLOCK
));
...
...
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