mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
2004-02-22 Casper S. Hornstrup <chorns@users.sourceforge.net>
* Makefile (all): Put REGTESTS dependency earlier in the list. * lib/kernel32/makefile: Support regression tests. * lib/kernel32/misc/dllmain.c: Prepare regression tests. * regtests/win32base/driver.c: (DummyThreadMain, RunPrivateTests): Add. (RegTestMain): Run private module regression tests. * tools/helper.mk: Add rtshared.a to MK_LIBS if building user-mode regression tests. * tools/regtests.c (UMSTUB): Add. (main): Output user-mode stub. * lib/kernel32/tests: New directory. * lib/kernel32/tests/.cvsignore: New file. * lib/kernel32/tests/Makefile: New file. * lib/kernel32/tests/tests: New directory. * lib/kernel32/tests/tests/.cvsignore: New file. * regtests/win32base/tests/file-1.c: move... * lib/kernel32/tests/tests/file-1.c: ...here. svn path=/trunk/; revision=8316
This commit is contained in:
parent
e8cc37fcec
commit
af770309fc
11 changed files with 183 additions and 11 deletions
|
@ -1,3 +1,23 @@
|
|||
2004-02-22 Casper S. Hornstrup <chorns@users.sourceforge.net>
|
||||
|
||||
* Makefile (all): Put REGTESTS dependency earlier in the list.
|
||||
* lib/kernel32/makefile: Support regression tests.
|
||||
* lib/kernel32/misc/dllmain.c: Prepare regression tests.
|
||||
* regtests/win32base/driver.c: (DummyThreadMain,
|
||||
RunPrivateTests): Add.
|
||||
(RegTestMain): Run private module regression tests.
|
||||
* tools/helper.mk: Add rtshared.a to MK_LIBS if building
|
||||
user-mode regression tests.
|
||||
* tools/regtests.c (UMSTUB): Add.
|
||||
(main): Output user-mode stub.
|
||||
* lib/kernel32/tests: New directory.
|
||||
* lib/kernel32/tests/.cvsignore: New file.
|
||||
* lib/kernel32/tests/Makefile: New file.
|
||||
* lib/kernel32/tests/tests: New directory.
|
||||
* lib/kernel32/tests/tests/.cvsignore: New file.
|
||||
* regtests/win32base/tests/file-1.c: move...
|
||||
* lib/kernel32/tests/tests/file-1.c: ...here.
|
||||
|
||||
2004-02-22 Casper S. Hornstrup <chorns@users.sourceforge.net>
|
||||
|
||||
* config (REGRESSIONTESTS): Add.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $Id: Makefile,v 1.210 2004/02/07 18:53:58 mf Exp $
|
||||
# $Id: Makefile,v 1.211 2004/02/22 17:30:32 chorns Exp $
|
||||
#
|
||||
# Global makefile
|
||||
#
|
||||
|
@ -117,9 +117,9 @@ KERNEL_DRIVERS = $(DRIVERS_LIB) $(DEVICE_DRIVERS) $(INPUT_DRIVERS) $(FS_DRIVERS)
|
|||
# Regression tests
|
||||
REGTESTS = regtests
|
||||
|
||||
all: tools dk implib $(LIB_STATIC) $(COMPONENTS) $(HALS) $(BUS) $(LIB_FSLIB) $(DLLS) $(SUBSYS) \
|
||||
all: tools dk implib $(LIB_STATIC) $(COMPONENTS) $(REGTESTS) $(HALS) $(BUS) $(LIB_FSLIB) $(DLLS) $(SUBSYS) \
|
||||
$(LOADERS) $(KERNEL_DRIVERS) $(SYS_APPS) $(SYS_SVC) \
|
||||
$(APPS) $(EXT_MODULES) $(REGTESTS)
|
||||
$(APPS) $(EXT_MODULES)
|
||||
|
||||
#config: $(TOOLS:%=%_config)
|
||||
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
# $Id: makefile,v 1.76 2004/02/15 07:03:55 arty Exp $
|
||||
# $Id: makefile,v 1.77 2004/02/22 17:30:32 chorns Exp $
|
||||
|
||||
PATH_TO_TOP = ../..
|
||||
|
||||
TARGET_REGTESTS = yes
|
||||
|
||||
TARGET_TYPE = dynlink
|
||||
|
||||
TARGET_NAME = kernel32
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: dllmain.c,v 1.33 2004/01/30 21:48:09 gvg Exp $
|
||||
/* $Id: dllmain.c,v 1.34 2004/02/22 17:30:32 chorns Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
|
@ -11,6 +11,7 @@
|
|||
|
||||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#include <roscfg.h>
|
||||
#include <k32.h>
|
||||
|
||||
#define NDEBUG
|
||||
|
@ -83,14 +84,25 @@ DllMain(HANDLE hDll,
|
|||
(void)lpReserved;
|
||||
|
||||
DPRINT("DllMain(hInst %lx, dwReason %lu)\n",
|
||||
hInst, dwReason);
|
||||
hDll, dwReason);
|
||||
|
||||
switch (dwReason)
|
||||
{
|
||||
case DLL_PROCESS_ATTACH:
|
||||
DPRINT("DLL_PROCESS_ATTACH\n");
|
||||
|
||||
#if !defined(REGTESTS)
|
||||
/*
|
||||
* When running regression tests, this module need to receive
|
||||
* thread attach/detach notifications. This is needed because
|
||||
* the module is already loaded when the regression test suite
|
||||
* driver would load this module using LoadLibrary() so a
|
||||
* DLL_PROCESS_ATTACH notification is not sent. The regression
|
||||
* test suite driver sends thread notifications instead in this
|
||||
* case.
|
||||
*/
|
||||
LdrDisableThreadCalloutsForDll ((PVOID)hDll);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Connect to the csrss server
|
||||
|
@ -170,6 +182,8 @@ DllMain(HANDLE hDll,
|
|||
break;
|
||||
}
|
||||
|
||||
PREPARE_TESTS
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
6
reactos/lib/kernel32/tests/.cvsignore
Normal file
6
reactos/lib/kernel32/tests/.cvsignore
Normal file
|
@ -0,0 +1,6 @@
|
|||
_regtests.c
|
||||
_rtstub.c
|
||||
Makefile.tests
|
||||
*.d
|
||||
*.o
|
||||
*.a
|
21
reactos/lib/kernel32/tests/Makefile
Normal file
21
reactos/lib/kernel32/tests/Makefile
Normal file
|
@ -0,0 +1,21 @@
|
|||
# $Id: Makefile,v 1.1 2004/02/22 17:30:32 chorns Exp $
|
||||
|
||||
PATH_TO_TOP = ../../..
|
||||
|
||||
TARGET_TYPE = library
|
||||
|
||||
TARGET_NAME = regtests
|
||||
|
||||
TARGET_LIBPATH = .
|
||||
|
||||
TARGET_CFLAGS = -I$(REGTESTS_PATH_INC)
|
||||
|
||||
-include Makefile.tests
|
||||
|
||||
TARGET_OBJECTS = \
|
||||
_regtests.o \
|
||||
$(addprefix tests/, $(TESTS))
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
2
reactos/lib/kernel32/tests/tests/.cvsignore
Normal file
2
reactos/lib/kernel32/tests/tests/.cvsignore
Normal file
|
@ -0,0 +1,2 @@
|
|||
*.d
|
||||
*.o
|
|
@ -24,9 +24,74 @@ FreeMemory(PVOID Base)
|
|||
}
|
||||
|
||||
|
||||
static DWORD WINAPI
|
||||
DummyThreadMain(LPVOID lpParameter)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
RunPrivateTests(LPTSTR FileName)
|
||||
{
|
||||
HMODULE hModule;
|
||||
HANDLE hEvent;
|
||||
|
||||
hEvent = CreateEventA(
|
||||
NULL,
|
||||
FALSE,
|
||||
FALSE,
|
||||
"WinRegTests");
|
||||
if (hEvent == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
hModule = GetModuleHandle(FileName);
|
||||
if (hModule != NULL)
|
||||
{
|
||||
HANDLE hThread;
|
||||
|
||||
/*
|
||||
* The module is a core OS component that is already
|
||||
* mapped into the current process.
|
||||
* NOTE: This will cause all core OS components that are already mapped
|
||||
* into the process to run their regression tests.
|
||||
*/
|
||||
hThread = CreateThread(NULL, 0, DummyThreadMain, NULL, 0, NULL);
|
||||
if (hThread != NULL)
|
||||
{
|
||||
DWORD ErrorCode;
|
||||
ErrorCode = WaitForSingleObject(hEvent, 5000); /* Wait up to 5 seconds */
|
||||
CloseHandle(hThread);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
hModule = LoadLibrary(FileName);
|
||||
if (hModule != NULL)
|
||||
{
|
||||
CloseHandle(hEvent);
|
||||
FreeLibrary(hModule);
|
||||
}
|
||||
}
|
||||
|
||||
CloseHandle(hEvent);
|
||||
}
|
||||
|
||||
|
||||
VOID STDCALL
|
||||
RegTestMain()
|
||||
{
|
||||
/*
|
||||
* Private module regression tests in components already mapped
|
||||
* (ntdll.dll, kernel32.dll, msvcrt.dll)
|
||||
*/
|
||||
RunPrivateTests(_T("ntdll.dll"));
|
||||
|
||||
/* Other private module regression tests */
|
||||
|
||||
/* Cross-module regression tests */
|
||||
InitializeTests();
|
||||
RegisterTests();
|
||||
PerformTests();
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $Id: helper.mk,v 1.54 2004/02/22 09:59:17 chorns Exp $
|
||||
# $Id: helper.mk,v 1.55 2004/02/22 17:30:33 chorns Exp $
|
||||
#
|
||||
# Helper makefile for ReactOS modules
|
||||
# Variables this makefile accepts:
|
||||
|
@ -618,6 +618,9 @@ else
|
|||
endif
|
||||
|
||||
ifeq ($(TARGET_REGTESTS),yes)
|
||||
ifeq ($(MK_MODE),user)
|
||||
MK_LIBS := $(SDK_PATH_LIB)/rtshared.a $(MK_LIBS)
|
||||
endif
|
||||
MK_REGTESTS := gen_regtests
|
||||
MK_REGTESTS_CLEAN := clean_regtests
|
||||
MK_OBJECTS += tests/_rtstub.o tests/regtests.a
|
||||
|
|
|
@ -442,6 +442,49 @@ static char KMSTUB[] =
|
|||
" RegisterTests();\n"
|
||||
"}\n";
|
||||
|
||||
static char UMSTUB[] =
|
||||
"/* This file is autogenerated. */\n"
|
||||
"\n"
|
||||
"#include <windows.h>\n"
|
||||
"#define NTOS_MODE_USER\n"
|
||||
"#include <ntos.h>\n"
|
||||
"#include \"regtests.h\"\n"
|
||||
"\n"
|
||||
"PVOID\n"
|
||||
"AllocateMemory(ULONG Size)\n"
|
||||
"{\n"
|
||||
" return (PVOID) RtlAllocateHeap(RtlGetProcessHeap(), 0, Size);\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"VOID\n"
|
||||
"FreeMemory(PVOID Base)\n"
|
||||
"{\n"
|
||||
" RtlFreeHeap(RtlGetProcessHeap(), 0, Base);\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"/* This function will be called several times */\n"
|
||||
"void PrepareTests()\n"
|
||||
"{\n"
|
||||
" static int testsRegistered = 0;\n"
|
||||
" if (testsRegistered == 0)\n"
|
||||
" {\n"
|
||||
" HANDLE hEvent;\n"
|
||||
" hEvent = OpenEventW(\n"
|
||||
" EVENT_ALL_ACCESS,\n"
|
||||
" FALSE,\n"
|
||||
" L\"WinRegTests\");\n"
|
||||
" if (hEvent != NULL)\n"
|
||||
" {\n"
|
||||
" SetEvent(hEvent);\n"
|
||||
" CloseHandle(hEvent);\n"
|
||||
" testsRegistered = 1;\n"
|
||||
" InitializeTests();\n"
|
||||
" RegisterTests();\n"
|
||||
" PerformTests();\n"
|
||||
" }\n"
|
||||
" }\n"
|
||||
"}\n";
|
||||
|
||||
static char HELP[] =
|
||||
"REGTESTS path file makefile [-u umstubfile] [-k kmstubfile]\n"
|
||||
"\n"
|
||||
|
@ -573,15 +616,11 @@ int main(int argc, char **argv)
|
|||
/* User-mode stubfile */
|
||||
if (umstubfile != NULL)
|
||||
{
|
||||
#if 0
|
||||
if (write_file_if_changed(umstubfile, UMSTUB) != 0)
|
||||
{
|
||||
perror("Cannot create output user-mode stubfile");
|
||||
return 1;
|
||||
}
|
||||
#else
|
||||
perror("WATNING: Cannot create output user-mode stubfile");
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Kernel-mode stubfile */
|
||||
|
|
Loading…
Reference in a new issue