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
801d1167
Commit
801d1167
authored
Apr 06, 2021
by
Zebediah Figura
Committed by
Alexandre Julliard
Apr 07, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntoskrnl/tests: Factor out winetest_init() and winetest_cleanup().
Signed-off-by:
Zebediah Figura
<
z.figura12@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
5c7057d2
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
35 deletions
+35
-35
driver.c
dlls/ntoskrnl.exe/tests/driver.c
+5
-18
driver_netio.c
dlls/ntoskrnl.exe/tests/driver_netio.c
+5
-17
utils.h
dlls/ntoskrnl.exe/tests/utils.h
+25
-0
No files found.
dlls/ntoskrnl.exe/tests/driver.c
View file @
801d1167
...
@@ -1782,15 +1782,7 @@ static void WINAPI main_test_task(DEVICE_OBJECT *device, void *context)
...
@@ -1782,15 +1782,7 @@ static void WINAPI main_test_task(DEVICE_OBJECT *device, void *context)
test_stack_limits
();
test_stack_limits
();
test_completion
();
test_completion
();
/* print process report */
winetest_cleanup
();
if
(
winetest_debug
)
{
kprintf
(
"%04x:ntoskrnl: %d tests executed (%d marked as todo, %d %s), %d skipped.
\n
"
,
PsGetCurrentProcessId
(),
successes
+
failures
+
todo_successes
+
todo_failures
,
todo_successes
,
failures
+
todo_failures
,
(
failures
+
todo_failures
!=
1
)
?
"failures"
:
"failure"
,
skipped
);
}
ZwClose
(
okfile
);
*
((
LONG
*
)
buffer
)
=
failures
;
*
((
LONG
*
)
buffer
)
=
failures
;
irp
->
IoStatus
.
Status
=
STATUS_SUCCESS
;
irp
->
IoStatus
.
Status
=
STATUS_SUCCESS
;
...
@@ -2116,24 +2108,19 @@ static NTSTATUS main_test(DEVICE_OBJECT *device, IRP *irp, IO_STACK_LOCATION *st
...
@@ -2116,24 +2108,19 @@ static NTSTATUS main_test(DEVICE_OBJECT *device, IRP *irp, IO_STACK_LOCATION *st
ULONG
length
=
stack
->
Parameters
.
DeviceIoControl
.
OutputBufferLength
;
ULONG
length
=
stack
->
Parameters
.
DeviceIoControl
.
OutputBufferLength
;
void
*
buffer
=
irp
->
AssociatedIrp
.
SystemBuffer
;
void
*
buffer
=
irp
->
AssociatedIrp
.
SystemBuffer
;
struct
test_input
*
test_input
=
(
struct
test_input
*
)
buffer
;
struct
test_input
*
test_input
=
(
struct
test_input
*
)
buffer
;
OBJECT_ATTRIBUTES
attr
=
{
0
};
NTSTATUS
status
;
UNICODE_STRING
pathU
;
IO_STATUS_BLOCK
io
;
if
(
!
buffer
)
if
(
!
buffer
)
return
STATUS_ACCESS_VIOLATION
;
return
STATUS_ACCESS_VIOLATION
;
if
(
length
<
sizeof
(
failures
))
if
(
length
<
sizeof
(
failures
))
return
STATUS_BUFFER_TOO_SMALL
;
return
STATUS_BUFFER_TOO_SMALL
;
attr
.
Length
=
sizeof
(
attr
);
RtlInitUnicodeString
(
&
pathU
,
L"
\\
??
\\
C:
\\
windows
\\
winetest_ntoskrnl_okfile"
);
running_under_wine
=
test_input
->
running_under_wine
;
running_under_wine
=
test_input
->
running_under_wine
;
winetest_debug
=
test_input
->
winetest_debug
;
winetest_debug
=
test_input
->
winetest_debug
;
winetest_report_success
=
test_input
->
winetest_report_success
;
winetest_report_success
=
test_input
->
winetest_report_success
;
attr
.
ObjectName
=
&
pathU
;
attr
.
Attributes
=
OBJ_CASE_INSENSITIVE
|
OBJ_KERNEL_HANDLE
;
/* needed to be accessible from system threads */
if
((
status
=
winetest_init
()))
ZwOpenFile
(
&
okfile
,
FILE_APPEND_DATA
|
SYNCHRONIZE
,
&
attr
,
&
io
,
return
status
;
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
FILE_SYNCHRONOUS_IO_NONALERT
);
pExEventObjectType
=
get_proc_address
(
"ExEventObjectType"
);
pExEventObjectType
=
get_proc_address
(
"ExEventObjectType"
);
ok
(
!!
pExEventObjectType
,
"ExEventObjectType not found
\n
"
);
ok
(
!!
pExEventObjectType
,
"ExEventObjectType not found
\n
"
);
...
...
dlls/ntoskrnl.exe/tests/driver_netio.c
View file @
801d1167
...
@@ -468,38 +468,26 @@ static NTSTATUS main_test(DEVICE_OBJECT *device, IRP *irp, IO_STACK_LOCATION *st
...
@@ -468,38 +468,26 @@ static NTSTATUS main_test(DEVICE_OBJECT *device, IRP *irp, IO_STACK_LOCATION *st
ULONG
length
=
stack
->
Parameters
.
DeviceIoControl
.
OutputBufferLength
;
ULONG
length
=
stack
->
Parameters
.
DeviceIoControl
.
OutputBufferLength
;
void
*
buffer
=
irp
->
AssociatedIrp
.
SystemBuffer
;
void
*
buffer
=
irp
->
AssociatedIrp
.
SystemBuffer
;
struct
test_input
*
test_input
=
buffer
;
struct
test_input
*
test_input
=
buffer
;
OBJECT_ATTRIBUTES
attr
=
{
0
};
NTSTATUS
status
;
UNICODE_STRING
pathU
;
IO_STATUS_BLOCK
io
;
if
(
!
buffer
)
if
(
!
buffer
)
return
STATUS_ACCESS_VIOLATION
;
return
STATUS_ACCESS_VIOLATION
;
if
(
length
<
sizeof
(
failures
))
if
(
length
<
sizeof
(
failures
))
return
STATUS_BUFFER_TOO_SMALL
;
return
STATUS_BUFFER_TOO_SMALL
;
attr
.
Length
=
sizeof
(
attr
);
RtlInitUnicodeString
(
&
pathU
,
L"
\\
??
\\
C:
\\
winetest_ntoskrnl_okfile"
);
running_under_wine
=
test_input
->
running_under_wine
;
running_under_wine
=
test_input
->
running_under_wine
;
winetest_debug
=
test_input
->
winetest_debug
;
winetest_debug
=
test_input
->
winetest_debug
;
winetest_report_success
=
test_input
->
winetest_report_success
;
winetest_report_success
=
test_input
->
winetest_report_success
;
attr
.
ObjectName
=
&
pathU
;
attr
.
Attributes
=
OBJ_CASE_INSENSITIVE
|
OBJ_KERNEL_HANDLE
;
/* needed to be accessible from system threads */
if
((
status
=
winetest_init
()))
ZwOpenFile
(
&
okfile
,
FILE_APPEND_DATA
|
SYNCHRONIZE
,
&
attr
,
&
io
,
return
status
;
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
FILE_SYNCHRONOUS_IO_NONALERT
);
netio_init
();
netio_init
();
test_wsk_get_address_info
();
test_wsk_get_address_info
();
test_wsk_listen_socket
();
test_wsk_listen_socket
();
test_wsk_connect_socket
();
test_wsk_connect_socket
();
if
(
winetest_debug
)
winetest_cleanup
();
{
kprintf
(
"%04x:ntoskrnl: %d tests executed (%d marked as todo, %d %s), %d skipped.
\n
"
,
PsGetCurrentProcessId
(),
successes
+
failures
+
todo_successes
+
todo_failures
,
todo_successes
,
failures
+
todo_failures
,
(
failures
+
todo_failures
!=
1
)
?
"failures"
:
"failure"
,
skipped
);
}
ZwClose
(
okfile
);
*
((
LONG
*
)
buffer
)
=
failures
;
*
((
LONG
*
)
buffer
)
=
failures
;
irp
->
IoStatus
.
Information
=
sizeof
(
failures
);
irp
->
IoStatus
.
Information
=
sizeof
(
failures
);
...
...
dlls/ntoskrnl.exe/tests/utils.h
View file @
801d1167
...
@@ -49,6 +49,31 @@ static inline void WINAPIV kprintf(const char *format, ...)
...
@@ -49,6 +49,31 @@ static inline void WINAPIV kprintf(const char *format, ...)
__ms_va_end
(
valist
);
__ms_va_end
(
valist
);
}
}
static
inline
NTSTATUS
winetest_init
(
void
)
{
OBJECT_ATTRIBUTES
attr
;
UNICODE_STRING
string
;
IO_STATUS_BLOCK
io
;
RtlInitUnicodeString
(
&
string
,
L"
\\
??
\\
C:
\\
windows
\\
winetest_ntoskrnl_okfile"
);
/* OBJ_KERNEL_HANDLE is necessary for the file to be accessible from system threads */
InitializeObjectAttributes
(
&
attr
,
&
string
,
OBJ_CASE_INSENSITIVE
|
OBJ_KERNEL_HANDLE
,
0
,
NULL
);
return
ZwOpenFile
(
&
okfile
,
FILE_APPEND_DATA
|
SYNCHRONIZE
,
&
attr
,
&
io
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
FILE_SYNCHRONOUS_IO_NONALERT
);
}
static
inline
void
winetest_cleanup
(
void
)
{
if
(
winetest_debug
)
{
kprintf
(
"%04x:ntoskrnl: %d tests executed (%d marked as todo, %d %s), %d skipped.
\n
"
,
PsGetCurrentProcessId
(),
successes
+
failures
+
todo_successes
+
todo_failures
,
todo_successes
,
failures
+
todo_failures
,
(
failures
+
todo_failures
!=
1
)
?
"failures"
:
"failure"
,
skipped
);
}
ZwClose
(
okfile
);
}
static
inline
void
WINAPIV
vok_
(
const
char
*
file
,
int
line
,
int
condition
,
const
char
*
msg
,
__ms_va_list
args
)
static
inline
void
WINAPIV
vok_
(
const
char
*
file
,
int
line
,
int
condition
,
const
char
*
msg
,
__ms_va_list
args
)
{
{
const
char
*
current_file
;
const
char
*
current_file
;
...
...
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