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
f81e31b3
Commit
f81e31b3
authored
Jun 11, 2020
by
Paul Gofman
Committed by
Alexandre Julliard
Jun 11, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntoskrnl.exe/tests: Move test functions to the new utils.h header.
Signed-off-by:
Paul Gofman
<
pgofman@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
3db619d4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
162 additions
and
138 deletions
+162
-138
driver.c
dlls/ntoskrnl.exe/tests/driver.c
+2
-138
utils.h
dlls/ntoskrnl.exe/tests/utils.h
+160
-0
No files found.
dlls/ntoskrnl.exe/tests/driver.c
View file @
f81e31b3
...
...
@@ -35,6 +35,8 @@
#include "driver.h"
#include "utils.h"
static
const
WCHAR
device_name
[]
=
{
'\\'
,
'D'
,
'e'
,
'v'
,
'i'
,
'c'
,
'e'
,
'\\'
,
'W'
,
'i'
,
'n'
,
'e'
,
'T'
,
'e'
,
's'
,
't'
,
'D'
,
'r'
,
'i'
,
'v'
,
'e'
,
'r'
,
0
};
static
const
WCHAR
upper_name
[]
=
{
'\\'
,
'D'
,
'e'
,
'v'
,
'i'
,
'c'
,
'e'
,
...
...
@@ -45,17 +47,6 @@ static const WCHAR driver_link[] = {'\\','D','o','s','D','e','v','i','c','e','s'
static
DRIVER_OBJECT
*
driver_obj
;
static
DEVICE_OBJECT
*
lower_device
,
*
upper_device
;
static
HANDLE
okfile
;
static
LONG
successes
;
static
LONG
failures
;
static
LONG
skipped
;
static
LONG
todo_successes
;
static
LONG
todo_failures
;
static
int
todo_level
,
todo_do_loop
;
static
int
running_under_wine
;
static
int
winetest_debug
;
static
int
winetest_report_success
;
static
POBJECT_TYPE
*
pExEventObjectType
,
*
pIoFileObjectType
,
*
pPsThreadType
,
*
pIoDriverObjectType
;
static
PEPROCESS
*
pPsInitialSystemProcess
;
static
void
*
create_caller_thread
;
...
...
@@ -64,133 +55,6 @@ static PETHREAD create_irp_thread;
NTSTATUS
WINAPI
ZwQueryInformationProcess
(
HANDLE
,
PROCESSINFOCLASS
,
void
*
,
ULONG
,
ULONG
*
);
static
void
kvprintf
(
const
char
*
format
,
__ms_va_list
ap
)
{
static
char
buffer
[
512
];
IO_STATUS_BLOCK
io
;
int
len
=
vsnprintf
(
buffer
,
sizeof
(
buffer
),
format
,
ap
);
ZwWriteFile
(
okfile
,
NULL
,
NULL
,
NULL
,
&
io
,
buffer
,
len
,
NULL
,
NULL
);
}
static
void
WINAPIV
kprintf
(
const
char
*
format
,
...)
{
__ms_va_list
valist
;
__ms_va_start
(
valist
,
format
);
kvprintf
(
format
,
valist
);
__ms_va_end
(
valist
);
}
static
void
WINAPIV
vok_
(
const
char
*
file
,
int
line
,
int
condition
,
const
char
*
msg
,
__ms_va_list
args
)
{
const
char
*
current_file
;
if
(
!
(
current_file
=
drv_strrchr
(
file
,
'/'
))
&&
!
(
current_file
=
drv_strrchr
(
file
,
'\\'
)))
current_file
=
file
;
else
current_file
++
;
if
(
todo_level
)
{
if
(
condition
)
{
kprintf
(
"%s:%d: Test succeeded inside todo block: "
,
current_file
,
line
);
kvprintf
(
msg
,
args
);
InterlockedIncrement
(
&
todo_failures
);
}
else
{
if
(
winetest_debug
>
0
)
{
kprintf
(
"%s:%d: Test marked todo: "
,
current_file
,
line
);
kvprintf
(
msg
,
args
);
}
InterlockedIncrement
(
&
todo_successes
);
}
}
else
{
if
(
!
condition
)
{
kprintf
(
"%s:%d: Test failed: "
,
current_file
,
line
);
kvprintf
(
msg
,
args
);
InterlockedIncrement
(
&
failures
);
}
else
{
if
(
winetest_report_success
)
kprintf
(
"%s:%d: Test succeeded
\n
"
,
current_file
,
line
);
InterlockedIncrement
(
&
successes
);
}
}
}
static
void
WINAPIV
ok_
(
const
char
*
file
,
int
line
,
int
condition
,
const
char
*
msg
,
...)
{
__ms_va_list
args
;
__ms_va_start
(
args
,
msg
);
vok_
(
file
,
line
,
condition
,
msg
,
args
);
__ms_va_end
(
args
);
}
static
void
vskip_
(
const
char
*
file
,
int
line
,
const
char
*
msg
,
__ms_va_list
args
)
{
const
char
*
current_file
;
if
(
!
(
current_file
=
drv_strrchr
(
file
,
'/'
))
&&
!
(
current_file
=
drv_strrchr
(
file
,
'\\'
)))
current_file
=
file
;
else
current_file
++
;
kprintf
(
"%s:%d: Tests skipped: "
,
current_file
,
line
);
kvprintf
(
msg
,
args
);
skipped
++
;
}
static
void
WINAPIV
win_skip_
(
const
char
*
file
,
int
line
,
const
char
*
msg
,
...)
{
__ms_va_list
args
;
__ms_va_start
(
args
,
msg
);
if
(
running_under_wine
)
vok_
(
file
,
line
,
0
,
msg
,
args
);
else
vskip_
(
file
,
line
,
msg
,
args
);
__ms_va_end
(
args
);
}
static
void
winetest_start_todo
(
int
is_todo
)
{
todo_level
=
(
todo_level
<<
1
)
|
(
is_todo
!=
0
);
todo_do_loop
=
1
;
}
static
int
winetest_loop_todo
(
void
)
{
int
do_loop
=
todo_do_loop
;
todo_do_loop
=
0
;
return
do_loop
;
}
static
void
winetest_end_todo
(
void
)
{
todo_level
>>=
1
;
}
static
int
broken
(
int
condition
)
{
return
!
running_under_wine
&&
condition
;
}
#define ok(condition, ...) ok_(__FILE__, __LINE__, condition, __VA_ARGS__)
#define todo_if(is_todo) for (winetest_start_todo(is_todo); \
winetest_loop_todo(); \
winetest_end_todo())
#define todo_wine todo_if(running_under_wine)
#define todo_wine_if(is_todo) todo_if((is_todo) && running_under_wine)
#define win_skip(...) win_skip_(__FILE__, __LINE__, __VA_ARGS__)
static
void
*
get_proc_address
(
const
char
*
name
)
{
UNICODE_STRING
name_u
;
...
...
dlls/ntoskrnl.exe/tests/utils.h
0 → 100644
View file @
f81e31b3
/*
* ntoskrnl.exe testing framework
*
* Copyright 2015 Sebastian Lackner
* Copyright 2015 Michael Müller
* Copyright 2015 Christian Costa
* Copyright 2020 Paul Gofman 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
static
HANDLE
okfile
;
static
LONG
successes
;
static
LONG
failures
;
static
LONG
skipped
;
static
LONG
todo_successes
;
static
LONG
todo_failures
;
static
int
todo_level
,
todo_do_loop
;
static
int
running_under_wine
;
static
int
winetest_debug
;
static
int
winetest_report_success
;
static
inline
void
kvprintf
(
const
char
*
format
,
__ms_va_list
ap
)
{
static
char
buffer
[
512
];
IO_STATUS_BLOCK
io
;
int
len
=
vsnprintf
(
buffer
,
sizeof
(
buffer
),
format
,
ap
);
ZwWriteFile
(
okfile
,
NULL
,
NULL
,
NULL
,
&
io
,
buffer
,
len
,
NULL
,
NULL
);
}
static
inline
void
WINAPIV
kprintf
(
const
char
*
format
,
...)
{
__ms_va_list
valist
;
__ms_va_start
(
valist
,
format
);
kvprintf
(
format
,
valist
);
__ms_va_end
(
valist
);
}
static
inline
void
WINAPIV
vok_
(
const
char
*
file
,
int
line
,
int
condition
,
const
char
*
msg
,
__ms_va_list
args
)
{
const
char
*
current_file
;
if
(
!
(
current_file
=
drv_strrchr
(
file
,
'/'
))
&&
!
(
current_file
=
drv_strrchr
(
file
,
'\\'
)))
current_file
=
file
;
else
current_file
++
;
if
(
todo_level
)
{
if
(
condition
)
{
kprintf
(
"%s:%d: Test succeeded inside todo block: "
,
current_file
,
line
);
kvprintf
(
msg
,
args
);
InterlockedIncrement
(
&
todo_failures
);
}
else
{
if
(
winetest_debug
>
0
)
{
kprintf
(
"%s:%d: Test marked todo: "
,
current_file
,
line
);
kvprintf
(
msg
,
args
);
}
InterlockedIncrement
(
&
todo_successes
);
}
}
else
{
if
(
!
condition
)
{
kprintf
(
"%s:%d: Test failed: "
,
current_file
,
line
);
kvprintf
(
msg
,
args
);
InterlockedIncrement
(
&
failures
);
}
else
{
if
(
winetest_report_success
)
kprintf
(
"%s:%d: Test succeeded
\n
"
,
current_file
,
line
);
InterlockedIncrement
(
&
successes
);
}
}
}
static
inline
void
WINAPIV
ok_
(
const
char
*
file
,
int
line
,
int
condition
,
const
char
*
msg
,
...)
{
__ms_va_list
args
;
__ms_va_start
(
args
,
msg
);
vok_
(
file
,
line
,
condition
,
msg
,
args
);
__ms_va_end
(
args
);
}
static
inline
void
vskip_
(
const
char
*
file
,
int
line
,
const
char
*
msg
,
__ms_va_list
args
)
{
const
char
*
current_file
;
if
(
!
(
current_file
=
drv_strrchr
(
file
,
'/'
))
&&
!
(
current_file
=
drv_strrchr
(
file
,
'\\'
)))
current_file
=
file
;
else
current_file
++
;
kprintf
(
"%s:%d: Tests skipped: "
,
current_file
,
line
);
kvprintf
(
msg
,
args
);
skipped
++
;
}
static
inline
void
WINAPIV
win_skip_
(
const
char
*
file
,
int
line
,
const
char
*
msg
,
...)
{
__ms_va_list
args
;
__ms_va_start
(
args
,
msg
);
if
(
running_under_wine
)
vok_
(
file
,
line
,
0
,
msg
,
args
);
else
vskip_
(
file
,
line
,
msg
,
args
);
__ms_va_end
(
args
);
}
static
inline
void
winetest_start_todo
(
int
is_todo
)
{
todo_level
=
(
todo_level
<<
1
)
|
(
is_todo
!=
0
);
todo_do_loop
=
1
;
}
static
inline
int
winetest_loop_todo
(
void
)
{
int
do_loop
=
todo_do_loop
;
todo_do_loop
=
0
;
return
do_loop
;
}
static
inline
void
winetest_end_todo
(
void
)
{
todo_level
>>=
1
;
}
static
inline
int
broken
(
int
condition
)
{
return
!
running_under_wine
&&
condition
;
}
#define ok(condition, ...) ok_(__FILE__, __LINE__, condition, __VA_ARGS__)
#define todo_if(is_todo) for (winetest_start_todo(is_todo); \
winetest_loop_todo(); \
winetest_end_todo())
#define todo_wine todo_if(running_under_wine)
#define todo_wine_if(is_todo) todo_if((is_todo) && running_under_wine)
#define win_skip(...) win_skip_(__FILE__, __LINE__, __VA_ARGS__)
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