2004-10-24 Casper S. Hornstrup <chorns@users.sourceforge.net>

* config (REGRESSIONTESTS): Remove.
	* tools/config.mk: Update.
	* lib/kernel32/misc/dllmain.c: Update.
	* drivers/net/tcpip/tests/Makefile (TARGET_OBJECTS): Add setup.o.
	* lib/gdiplus/tests/Makefile (TARGET_OBJECTS): Ditto.
	* lib/kernel32/tests/Makefile (TARGET_OBJECTS): Ditto.
	* lib/ws2_32/tests/Makefile (TARGET_OBJECTS): Ditto.
	* subsys/win32k/tests/makefile (TARGET_OBJECTS): Ditto.
	* regtests/shared/regtests.h (SetupOnce, _SetupOnce): Declare.
	(DISPATCHER): Rename to _Dispatcher.
	* lib/gdiplus/tests/tests/test-1.c: Update.
	* lib/kernel32/tests/tests/CreateFile.c: Ditto.
	* lib/ws2_32/tests/tests/WinsockEvent.c: Ditto.
	* subsys/win32k/tests/tests/eng-mem-1.c: Ditto.
	* tools/helper.mk: Be quiet when building tests.
	* tools/regtests.c: Remove unused code.
	* drivers/net/tcpip/tests/setup.c: New file.
	* lib/gdiplus/tests/setup.c: Ditto.
	* lib/kernel32/tests/setup.c: Ditto.
	* lib/ws2_32/tests/setup.c: Ditto.
	* subsys/win32k/tests/setup.c: Ditto.

svn path=/trunk/; revision=11414
This commit is contained in:
Casper Hornstrup 2004-10-24 12:39:54 +00:00
parent 40851010a8
commit 6003c5cb06
21 changed files with 114 additions and 187 deletions

View file

@ -1,3 +1,27 @@
2004-10-24 Casper S. Hornstrup <chorns@users.sourceforge.net>
* config (REGRESSIONTESTS): Remove.
* tools/config.mk: Update.
* lib/kernel32/misc/dllmain.c: Update.
* drivers/net/tcpip/tests/Makefile (TARGET_OBJECTS): Add setup.o.
* lib/gdiplus/tests/Makefile (TARGET_OBJECTS): Ditto.
* lib/kernel32/tests/Makefile (TARGET_OBJECTS): Ditto.
* lib/ws2_32/tests/Makefile (TARGET_OBJECTS): Ditto.
* subsys/win32k/tests/makefile (TARGET_OBJECTS): Ditto.
* regtests/shared/regtests.h (SetupOnce, _SetupOnce): Declare.
(DISPATCHER): Rename to _Dispatcher.
* lib/gdiplus/tests/tests/test-1.c: Update.
* lib/kernel32/tests/tests/CreateFile.c: Ditto.
* lib/ws2_32/tests/tests/WinsockEvent.c: Ditto.
* subsys/win32k/tests/tests/eng-mem-1.c: Ditto.
* tools/helper.mk: Be quiet when building tests.
* tools/regtests.c: Remove unused code.
* drivers/net/tcpip/tests/setup.c: New file.
* lib/gdiplus/tests/setup.c: Ditto.
* lib/kernel32/tests/setup.c: Ditto.
* lib/ws2_32/tests/setup.c: Ditto.
* subsys/win32k/tests/setup.c: Ditto.
2004-10-23 Casper S. Hornstrup <chorns@users.sourceforge.net>
* Makefile: Support regtests_implib.

View file

@ -47,11 +47,6 @@ ACPI := 0
#
3GB := 1
#
# Whether to build regression tests
#
REGRESSIONTESTS := 0
#
# Whether to use Structured Exception Handling
#

View file

@ -12,7 +12,9 @@ TARGET_CFLAGS = -I$(REGTESTS_PATH_INC)
-include Makefile.tests
TARGET_OBJECTS = $(addprefix tests/, $(TESTS))
TARGET_OBJECTS = \
setup.o \
$(addprefix tests/, $(TESTS))
include $(PATH_TO_TOP)/rules.mak

View file

@ -0,0 +1,5 @@
#include "regtests.h"
_SetupOnce()
{
}

View file

@ -21,7 +21,9 @@ TARGET_LIBS = ../gdiplus.a
-include Makefile.tests
TARGET_OBJECTS = $(addprefix tests/, $(TESTS))
TARGET_OBJECTS = \
setup.o \
$(addprefix tests/, $(TESTS))
include $(PATH_TO_TOP)/rules.mak

View file

@ -0,0 +1,12 @@
#include "regtests.h"
extern BOOL
STDCALL
DllMain(HANDLE hInstDll,
ULONG dwReason,
LPVOID lpReserved);
_SetupOnce()
{
DllMain(NULL, DLL_PROCESS_ATTACH, NULL);
}

View file

@ -8,4 +8,4 @@ RunTest()
{
}
DISPATCHER(Test_1Test, "Test 1")
_Dispatcher(Test_1Test, "Test 1")

View file

@ -1,4 +1,4 @@
/* $Id: dllmain.c,v 1.36 2004/08/24 17:21:11 navaraf Exp $
/* $Id: dllmain.c,v 1.37 2004/10/24 12:39:53 chorns Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
@ -11,7 +11,6 @@
/* INCLUDES ******************************************************************/
#include <roscfg.h>
#include <k32.h>
#define NDEBUG
@ -95,18 +94,7 @@ DllMain(HANDLE hDll,
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

View file

@ -1,4 +1,4 @@
# $Id: Makefile,v 1.4 2004/10/23 21:05:11 chorns Exp $
# $Id: Makefile,v 1.5 2004/10/24 12:39:53 chorns Exp $
PATH_TO_TOP = ../../..
@ -14,7 +14,9 @@ TARGET_LIBS = ../kernel32.a
-include Makefile.tests
TARGET_OBJECTS = $(addprefix tests/, $(TESTS))
TARGET_OBJECTS = \
setup.o \
$(addprefix tests/, $(TESTS))
include $(PATH_TO_TOP)/rules.mak

View file

@ -0,0 +1,5 @@
#include "regtests.h"
_SetupOnce()
{
}

View file

@ -123,4 +123,4 @@ static void RunTest()
TestFile();
}
DISPATCHER(CreatefileTest, "CreateFileW")
_Dispatcher(CreatefileTest, "CreateFileW")

View file

@ -12,7 +12,9 @@ TARGET_LIBS = ../ws2_32.a
-include Makefile.tests
TARGET_OBJECTS = $(addprefix tests/, $(TESTS))
TARGET_OBJECTS = \
setup.o \
$(addprefix tests/, $(TESTS))
include $(PATH_TO_TOP)/rules.mak

View file

@ -0,0 +1,12 @@
#include "regtests.h"
extern BOOL
STDCALL
DllMain(HANDLE hInstDll,
ULONG dwReason,
LPVOID lpReserved);
_SetupOnce()
{
DllMain(NULL, DLL_PROCESS_ATTACH, NULL);
}

View file

@ -70,21 +70,14 @@ TestWSACloseEvent()
TestWSACloseEventFailure();
}
extern BOOL
STDCALL
DllMain(HANDLE hInstDll,
ULONG dwReason,
LPVOID lpReserved);
static void
RunTest()
{
WSADATA WSAData;
DllMain(NULL, DLL_PROCESS_ATTACH, NULL);
WSAStartup(MAKEWORD(2, 0), &WSAData);
TestWSACloseEvent();
WSACleanup();
}
DISPATCHER(WinsockeventTest, "Winsock 2 event")
_Dispatcher(WinsockeventTest, "Winsock 2 event")

View file

@ -10,6 +10,11 @@
#include <string.h>
#include <windows.h>
extern void SetupOnce();
#define _SetupOnce() \
void SetupOnce()
/* Valid values for Command parameter of TestRoutine */
#define TESTCMD_RUN 0 /* Buffer contains information about what failed */
#define TESTCMD_TESTNAME 1 /* Buffer contains description of test */
@ -23,7 +28,7 @@ extern int _Result;
extern char *_Buffer;
/* Macros to simplify tests */
#define DISPATCHER(FunctionName, TestName) \
#define _Dispatcher(FunctionName, TestName) \
void \
FunctionName(int Command) \
{ \

View file

@ -14,7 +14,9 @@ TARGET_LIBS = ../win32k.a
-include Makefile.tests
TARGET_OBJECTS = $(addprefix tests/, $(TESTS))
TARGET_OBJECTS = \
setup.o \
$(addprefix tests/, $(TESTS))
include $(PATH_TO_TOP)/rules.mak

View file

@ -0,0 +1,5 @@
#include "regtests.h"
_SetupOnce()
{
}

View file

@ -45,4 +45,4 @@ static void RunTest()
#endif
}
DISPATCHER(Eng_mem_1Test, "Win32k Engine Memory API")
_Dispatcher(Eng_mem_1Test, "Win32k Engine Memory API")

View file

@ -25,10 +25,6 @@ ifeq ($(ACPI), 1)
CONFIG += ACPI
endif
ifeq ($(REGRESSIONTESTS), 1)
CONFIG += REGTESTS
endif
ifeq ($(SEH), 1)
CONFIG += SEH
endif

View file

@ -1,4 +1,4 @@
# $Id: helper.mk,v 1.91 2004/10/23 21:05:12 chorns Exp $
# $Id: helper.mk,v 1.92 2004/10/24 12:39:54 chorns Exp $
#
# Helper makefile for ReactOS modules
# Variables this makefile accepts:
@ -722,7 +722,7 @@ else
endif
$(MK_BASENAME).a: $(MK_OBJECTS)
$(AR) -r $(MK_BASENAME).a $(MK_OBJECTS)
$(AR) -rc $(MK_BASENAME).a $(MK_OBJECTS)
$(MK_NOSTRIPNAME): $(MK_EXTRADEP) $(MK_FULLRES) $(MK_BASENAME).a $(MK_LIBS)
ifeq ($(MK_EXETYPE),dll)
@ -815,7 +815,7 @@ else
endif
$(MK_BASENAME).a: $(MK_OBJECTS)
$(AR) -r $(MK_BASENAME).a $(MK_OBJECTS)
$(AR) -rc $(MK_BASENAME).a $(MK_OBJECTS)
$(MK_NOSTRIPNAME): $(MK_EXTRADEP) $(MK_FULLRES) $(MK_BASENAME).a $(MK_LIBS)
$(LD_CC) -Wl,--base-file,base.tmp \
@ -882,8 +882,10 @@ endif # MK_MODE
ifeq ($(MK_MODE),static)
$(MK_FULLNAME): $(MK_EXTRADEP) $(MK_OBJECTS)
$(AR) -r $(MK_FULLNAME) $(MK_OBJECTS)
@echo $(MK_BASENAME)$(MK_EXT) was successfully built.
$(AR) -rc $(MK_FULLNAME) $(MK_OBJECTS)
ifneq ($(TARGET_TYPE),test)
@echo $(MK_FULLNAME) was successfully built.
endif
# Static libraries dont have a nostrip version
$(MK_NOSTRIPNAME):

View file

@ -36,8 +36,6 @@ static FILE *out;
static char *path;
static char *file;
static char *makefile;
static char *umstubfile;
static char *kmstubfile;
static char *exestubfile;
static char*
@ -430,88 +428,6 @@ write_file_if_changed(char *filename,
return 0;
}
static char KMSTUB[] =
"/* This file is autogenerated. */\n"
"\n"
"#include <roskrnl.h>\n"
"#include <../kmregtests/kmregtests.h>\n"
"\n"
"typedef int (*TestRoutine)(int Command, char *Buffer);\n"
"\n"
"extern void RegisterTests();\n"
"\n"
"static PDEVICE_OBJECT KMRegTestsDeviceObject = NULL;\n"
"static PFILE_OBJECT KMRegTestsFileObject = NULL;\n"
"\n"
"void AddTest(TestRoutine Routine)\n"
"{\n"
" UNICODE_STRING DriverName;\n"
" IO_STATUS_BLOCK IoStatus;\n"
" NTSTATUS Status;\n"
" KEVENT Event;\n"
" PIRP Irp;\n"
"\n"
" if (KMRegTestsDeviceObject == NULL)\n"
" {\n"
" RtlInitUnicodeString(&DriverName, L\"\\\\Device\\\\KMRegTests\");\n"
" Status = IoGetDeviceObjectPointer(&DriverName, FILE_WRITE_ATTRIBUTES,\n"
" &KMRegTestsFileObject, &KMRegTestsDeviceObject);\n"
" if (!NT_SUCCESS(Status)) return;\n"
" }\n"
" KeInitializeEvent(&Event, NotificationEvent, FALSE);\n"
" Irp = IoBuildDeviceIoControlRequest(IOCTL_KMREGTESTS_REGISTER,\n"
" KMRegTestsDeviceObject, &Routine, sizeof(TestRoutine), NULL, 0, FALSE, &Event, &IoStatus);\n"
" Status = IoCallDriver(KMRegTestsDeviceObject, Irp);\n"
"}\n"
"\n"
"void PrepareTests()\n"
"{\n"
" 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(NULL, NULL);\n"
" }\n"
" }\n"
"}\n";
static char EXESTUB[] =
"/* This file is autogenerated. */\n"
"\n"
@ -542,6 +458,7 @@ static char EXESTUB[] =
"{\n"
" InitializeTests();\n"
" RegisterTests();\n"
" SetupOnce();\n"
" PerformTests(ConsoleWrite, NULL);\n"
" NtTerminateProcess (NtCurrentProcess(), 0);\n"
" return 0;\n"
@ -574,15 +491,13 @@ static char HOOKS_FOOTER[] =
"ULONG MaxExternalDependency = ExternalDependencyCount - 1;\n";
static char HELP[] =
"REGTESTS path file makefile [-u umstubfile] [-k kmstubfile] [-e exestubfile]\n"
"REGTESTS path file makefile [-e exestubfile]\n"
"REGTESTS -s stublistfile stubsfile hooksfile\n"
"\n"
" path Path to files\n"
" file Registration file to create\n"
" makefile Makefile to create\n"
" umstubfile Optional stub for running tests internal to a user-mode module\n"
" kmstubfile Optional stub for running tests internal to a kernel-mode module\n"
" exestubfile Optional stub for running tests internal to a module in the build environment\n"
" exestubfile Optional stub for running tests in the build environment\n"
" stublistfile File with descriptions of stubs\n"
" stubsfile File with stubs to create\n"
" hooksfile File with hooks to create\n";
@ -834,45 +749,25 @@ int run_registrations(int argc,
return 1;
}
umstubfile = NULL;
kmstubfile = NULL;
exestubfile = NULL;
for (i = 4; i < argc; i++)
{
if (argv[i][0] == '-')
{
if (argv[i][1] == 'u')
{
umstubfile = convert_path(argv[++i]);
if (umstubfile[0] == 0)
{
printf("Missing umstubfile\n");
return 1;
}
}
else if (argv[i][1] == 'k')
{
kmstubfile = convert_path(argv[++i]);
if (kmstubfile[0] == 0)
{
printf("Missing kmstubfile\n");
return 1;
}
}
else if (argv[i][1] == 'e')
{
exestubfile = convert_path(argv[++i]);
if (exestubfile[0] == 0)
{
printf("Missing exestubfile\n");
return 1;
}
}
else
{
printf("Unknown switch\n");
return 1;
}
if (argv[i][1] == 'e')
{
exestubfile = convert_path(argv[++i]);
if (exestubfile[0] == 0)
{
printf("Missing exestubfile\n");
return 1;
}
}
else
{
printf("Unknown switch -%c\n", argv[i][1]);
return 1;
}
}
}
@ -923,26 +818,6 @@ int run_registrations(int argc,
fclose(out);
/* User-mode stubfile */
if (umstubfile != NULL)
{
if (write_file_if_changed(umstubfile, UMSTUB) != 0)
{
perror("Cannot create output user-mode stubfile");
return 1;
}
}
/* Kernel-mode stubfile */
if (kmstubfile != NULL)
{
if (write_file_if_changed(kmstubfile, KMSTUB) != 0)
{
perror("Cannot create output kernel-mode stubfile");
return 1;
}
}
/* Executable stubfile */
if (exestubfile != NULL)
{