Signed-off-by: Rémi Bernon rbernon@codeweavers.com ---
An alternative implementation of 212857-212859, in a much cleaner way IMHO. This however introduces a new "winetest" static library, although it is optional for tests which do not require driver testing.
The library is used to share the driver signing, loading, and interop code, using a separate "wine/test_driver.h" header file.
If "wine/test.h" was previously included, the header is defining the user-space interface, if not it declares the driver-space test functions instead.
I can imagine that the library could also be used to share other testing code, although keeping it optional is probably better.
The individual drivers would still need to be implemented in each module (and driver_hid potentially duplicated) but it's not too bad.
dlls/ntoskrnl.exe/tests/utils.h | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/dlls/ntoskrnl.exe/tests/utils.h b/dlls/ntoskrnl.exe/tests/utils.h index f73f6f938ca..de632c65b7c 100644 --- a/dlls/ntoskrnl.exe/tests/utils.h +++ b/dlls/ntoskrnl.exe/tests/utils.h @@ -178,19 +178,31 @@ static inline NTSTATUS winetest_init(void) FILE_SHARE_READ | FILE_SHARE_WRITE, FILE_SYNCHRONOUS_IO_NONALERT); }
-static inline void winetest_cleanup(void) +#define winetest_cleanup() winetest_cleanup_(__FILE__) +static inline void winetest_cleanup_(const char *file) { + char test_name[MAX_PATH], *tmp; struct test_data *data; SIZE_T size = sizeof(*data); + const char *source_file; OBJECT_ATTRIBUTES attr; UNICODE_STRING string; void *addr = NULL; HANDLE section;
+ source_file = strrchr(file, '/'); + if (!source_file) source_file = strrchr(file, '\'); + if (!source_file) source_file = file; + else source_file++; + + strcpy(test_name, source_file); + if ((tmp = strrchr(test_name, '.'))) *tmp = 0; + if (winetest_debug) { - kprintf("%04x:ntoskrnl: %d tests executed (%d marked as todo, %d %s), %d skipped.\n", - (DWORD)(DWORD_PTR)PsGetCurrentProcessId(), successes + failures + todo_successes + todo_failures, + kprintf("%04x:%s: %d tests executed (%d marked as todo, %d %s), %d skipped.\n", + (DWORD)(DWORD_PTR)PsGetCurrentProcessId(), test_name, + successes + failures + todo_successes + todo_failures, todo_successes, failures + todo_failures, (failures + todo_failures != 1) ? "failures" : "failure", skipped ); }