From 9af4f499f3f188c2c7554c38422225c702eb46e3 Mon Sep 17 00:00:00 2001 From: Casper Hornstrup Date: Mon, 18 Oct 2004 19:11:09 +0000 Subject: [PATCH] 2004-10-18 Casper S. Hornstrup * lib/kernel32/makefile (TARGET_BUILDENV_TEST): Set to yes. * lib/kernel32/tests/Makefile: New target run. * lib/kernel32/tests/tests/file-1.c: Remove. * lib/kernel32/tests/tests/CreateFile.c: New file. * lib/kernel32/tests/stubs.tst: New file. * lib/gdiplus/tests/tests/test-1.c: Update. * lib/gdiplus/tests/stubs.tst: Update. * lib/gdiplus/tests/Makefile: Update. * lib/tools/helper.mk: Better support for TARGET_BUILDENV_TEST. * tools/regtests.c: Terminate process after running tests. * regtests/shared/regtests.c (PerformTest): Increase buffer sizes. * regtests/Makefile: Update. * regtests/kmregtests/*: Remove. * regtests/kmrtint/*: Remove. * regtests/regtests/*: Remove. * regtests/win32base/*: Remove. * subsys/win32k/tests/tests/eng-mem-1.c: Update. * subsys/win32k/tests/stubs.tst: New file. * drivers/net/tcpip/tests/Makefile: Update. * drivers/net/tcpip/makefile: Update. * drivers/net/tcpip/stubs.tst: New file. * drivers/net/tcpip/tests/Makefile: Update. svn path=/trunk/; revision=11321 --- reactos/ChangeLog | 25 +++ reactos/drivers/net/tcpip/makefile | 4 +- reactos/drivers/net/tcpip/tests/Makefile | 10 +- reactos/drivers/net/tcpip/tests/stubs.tst | 0 reactos/hal/halx86/Makefile | 4 +- reactos/lib/gdiplus/tests/Makefile | 3 +- reactos/lib/gdiplus/tests/stubs.tst | 3 - reactos/lib/gdiplus/tests/tests/test-1.c | 32 +-- reactos/lib/kernel32/makefile | 4 +- reactos/lib/kernel32/tests/Makefile | 12 +- reactos/lib/kernel32/tests/stubs.tst | 131 +++++++++++ reactos/lib/kernel32/tests/tests/CreateFile.c | 126 +++++++++++ reactos/lib/kernel32/tests/tests/file-1.c | 73 ------ reactos/regtests/Makefile | 26 +-- reactos/regtests/kmregtests/.cvsignore | 10 - reactos/regtests/kmregtests/Makefile | 25 --- reactos/regtests/kmregtests/driver.c | 207 ------------------ reactos/regtests/kmregtests/kmregtests.h | 22 -- reactos/regtests/kmregtests/tests/.cvsignore | 1 - reactos/regtests/kmregtests/tests/fs-1.c | 24 -- reactos/regtests/kmregtests/tests/mdl-1.c | 52 ----- reactos/regtests/kmregtests/tests/mdl-2.c | 48 ---- reactos/regtests/kmregtests/tests/mm-1.c | 121 ---------- reactos/regtests/kmrtint/.cvsignore | 6 - reactos/regtests/kmrtint/Makefile | 24 -- reactos/regtests/kmrtint/kmrtint.c | 86 -------- reactos/regtests/kmrtint/kmrtint.def | 3 - reactos/regtests/regtests/.cvsignore | 6 - reactos/regtests/regtests/Makefile | 24 -- reactos/regtests/regtests/regtests.c | 89 -------- reactos/regtests/shared/regtests.c | 4 +- reactos/regtests/shared/regtests.h | 94 +++++++- reactos/regtests/win32base/.cvsignore | 8 - reactos/regtests/win32base/Makefile | 26 --- reactos/regtests/win32base/driver.c | 99 --------- reactos/regtests/win32base/tests/.cvsignore | 1 - reactos/regtests/win32base/tests/ws2event.c | 127 ----------- reactos/regtests/win32base/win32base.def | 3 - reactos/subsys/win32k/makefile | 4 +- reactos/subsys/win32k/tests/makefile | 9 + reactos/subsys/win32k/tests/stubs.tst | 0 reactos/subsys/win32k/tests/tests/eng-mem-1.c | 14 +- reactos/tools/helper.mk | 23 +- reactos/tools/regtests.c | 13 +- 44 files changed, 445 insertions(+), 1181 deletions(-) create mode 100644 reactos/drivers/net/tcpip/tests/stubs.tst create mode 100644 reactos/lib/kernel32/tests/stubs.tst create mode 100644 reactos/lib/kernel32/tests/tests/CreateFile.c delete mode 100644 reactos/lib/kernel32/tests/tests/file-1.c delete mode 100755 reactos/regtests/kmregtests/.cvsignore delete mode 100755 reactos/regtests/kmregtests/Makefile delete mode 100755 reactos/regtests/kmregtests/driver.c delete mode 100755 reactos/regtests/kmregtests/kmregtests.h delete mode 100644 reactos/regtests/kmregtests/tests/.cvsignore delete mode 100755 reactos/regtests/kmregtests/tests/fs-1.c delete mode 100644 reactos/regtests/kmregtests/tests/mdl-1.c delete mode 100644 reactos/regtests/kmregtests/tests/mdl-2.c delete mode 100644 reactos/regtests/kmregtests/tests/mm-1.c delete mode 100755 reactos/regtests/kmrtint/.cvsignore delete mode 100755 reactos/regtests/kmrtint/Makefile delete mode 100755 reactos/regtests/kmrtint/kmrtint.c delete mode 100755 reactos/regtests/kmrtint/kmrtint.def delete mode 100755 reactos/regtests/regtests/.cvsignore delete mode 100755 reactos/regtests/regtests/Makefile delete mode 100755 reactos/regtests/regtests/regtests.c delete mode 100755 reactos/regtests/win32base/.cvsignore delete mode 100755 reactos/regtests/win32base/Makefile delete mode 100755 reactos/regtests/win32base/driver.c delete mode 100644 reactos/regtests/win32base/tests/.cvsignore delete mode 100644 reactos/regtests/win32base/tests/ws2event.c delete mode 100755 reactos/regtests/win32base/win32base.def create mode 100644 reactos/subsys/win32k/tests/stubs.tst diff --git a/reactos/ChangeLog b/reactos/ChangeLog index 7ac2269df8e..1f518eba0f2 100644 --- a/reactos/ChangeLog +++ b/reactos/ChangeLog @@ -1,3 +1,28 @@ +2004-10-18 Casper S. Hornstrup + + * lib/kernel32/makefile (TARGET_BUILDENV_TEST): Set to yes. + * lib/kernel32/tests/Makefile: New target run. + * lib/kernel32/tests/tests/file-1.c: Remove. + * lib/kernel32/tests/tests/CreateFile.c: New file. + * lib/kernel32/tests/stubs.tst: New file. + * lib/gdiplus/tests/tests/test-1.c: Update. + * lib/gdiplus/tests/stubs.tst: Update. + * lib/gdiplus/tests/Makefile: Update. + * lib/tools/helper.mk: Better support for TARGET_BUILDENV_TEST. + * tools/regtests.c: Terminate process after running tests. + * regtests/shared/regtests.c (PerformTest): Increase buffer sizes. + * regtests/Makefile: Update. + * regtests/kmregtests/*: Remove. + * regtests/kmrtint/*: Remove. + * regtests/regtests/*: Remove. + * regtests/win32base/*: Remove. + * subsys/win32k/tests/tests/eng-mem-1.c: Update. + * subsys/win32k/tests/stubs.tst: New file. + * drivers/net/tcpip/tests/Makefile: Update. + * drivers/net/tcpip/makefile: Update. + * drivers/net/tcpip/stubs.tst: New file. + * drivers/net/tcpip/tests/Makefile: Update. + 2004-10-04 Casper S. Hornstrup * tools/helper.mk: Support for kernel TARGET_TYPE. diff --git a/reactos/drivers/net/tcpip/makefile b/reactos/drivers/net/tcpip/makefile index 560a282ea9b..8b0cdb989c3 100644 --- a/reactos/drivers/net/tcpip/makefile +++ b/reactos/drivers/net/tcpip/makefile @@ -1,9 +1,11 @@ -# $Id: makefile,v 1.27 2004/10/08 01:28:32 arty Exp $ +# $Id: makefile,v 1.28 2004/10/18 19:11:06 chorns Exp $ PATH_TO_TOP = ../../.. TARGET_REGTESTS = yes +TARGET_BUILDENV_TEST = yes + TARGET_TYPE = export_driver TARGET_NAME = tcpip diff --git a/reactos/drivers/net/tcpip/tests/Makefile b/reactos/drivers/net/tcpip/tests/Makefile index c7ad417c3d1..4e5023c7b5c 100644 --- a/reactos/drivers/net/tcpip/tests/Makefile +++ b/reactos/drivers/net/tcpip/tests/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.2 2004/08/15 23:41:26 chorns Exp $ +# $Id: Makefile,v 1.3 2004/10/18 19:11:07 chorns Exp $ PATH_TO_TOP = ../../../.. @@ -15,9 +15,17 @@ TARGET_CFLAGS = -I$(REGTESTS_PATH_INC) -include Makefile.tests TARGET_OBJECTS = \ + _rtstub.o \ _regtests.o \ + _hooks.o \ + _stubs.o \ $(addprefix tests/, $(TESTS)) include $(PATH_TO_TOP)/rules.mak include $(TOOLS_PATH)/helper.mk + +run: all + @$(CC) -o _runtest.exe _rtstub.o regtests.a $(SDK_PATH_LIB)/rtshared.a $(LIBS) -lntdll + @_runtest.exe + @$(RM) _runtest.exe diff --git a/reactos/drivers/net/tcpip/tests/stubs.tst b/reactos/drivers/net/tcpip/tests/stubs.tst new file mode 100644 index 00000000000..e69de29bb2d diff --git a/reactos/hal/halx86/Makefile b/reactos/hal/halx86/Makefile index 207b94c2b26..de80398c4b0 100644 --- a/reactos/hal/halx86/Makefile +++ b/reactos/hal/halx86/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.13 2004/02/22 09:59:17 chorns Exp $ +# $Id: Makefile,v 1.14 2004/10/18 19:11:07 chorns Exp $ PATH_TO_TOP = ../.. @@ -22,8 +22,6 @@ TARGET_BASENAME = hal TARGET_DEFNAME = ../hal/hal -TARGET_IMPLIBPATH = . - TARGET_ASFLAGS = -I$(PATH_TO_TOP)/include -I$(PATH_TO_TOP)/ntoskrnl/include -D__ASM__ TARGET_CFLAGS = -I./include -I$(PATH_TO_TOP)/ntoskrnl/include -Wall -Werror diff --git a/reactos/lib/gdiplus/tests/Makefile b/reactos/lib/gdiplus/tests/Makefile index b82159efb8c..7a7b1786ed1 100644 --- a/reactos/lib/gdiplus/tests/Makefile +++ b/reactos/lib/gdiplus/tests/Makefile @@ -20,6 +20,7 @@ TARGET_CFLAGS = \ -include Makefile.tests TARGET_OBJECTS = \ + _rtstub.o \ _regtests.o \ _hooks.o \ _stubs.o \ @@ -32,6 +33,6 @@ include $(TOOLS_PATH)/helper.mk LIBS = ../gdiplus.a run: all - @$(CC) -o _runtest.exe _rtstub.o regtests.a $(SDK_PATH_LIB)/rtshared.a $(LIBS) + @$(CC) -o _runtest.exe _rtstub.o regtests.a $(SDK_PATH_LIB)/rtshared.a $(LIBS) -lntdll @_runtest.exe @$(RM) _runtest.exe diff --git a/reactos/lib/gdiplus/tests/stubs.tst b/reactos/lib/gdiplus/tests/stubs.tst index 512ef0874b1..e69de29bb2d 100644 --- a/reactos/lib/gdiplus/tests/stubs.tst +++ b/reactos/lib/gdiplus/tests/stubs.tst @@ -1,3 +0,0 @@ -ntdll.dll RtlAllocateHeap@12 -ntdll.dll RtlFreeHeap@12 -msvcrt.dll printf diff --git a/reactos/lib/gdiplus/tests/tests/test-1.c b/reactos/lib/gdiplus/tests/tests/test-1.c index ec3e11e5272..8ddacb8e335 100644 --- a/reactos/lib/gdiplus/tests/tests/test-1.c +++ b/reactos/lib/gdiplus/tests/tests/test-1.c @@ -3,37 +3,9 @@ #include "regtests.h" -BOOL -ReturnTrue() +static void +RunTest() { - return TRUE; -} - -static BOOL MyRtlFreeHeapCalled = FALSE; - -VOID STDCALL -MyRtlFreeHeap(ULONG a1, ULONG a2, ULONG a3) -{ - MyRtlFreeHeapCalled = TRUE; -} - -extern VOID STDCALL -RtlFreeHeap(ULONG a1, ULONG a2, ULONG a3); - -HOOK Hooks[] = -{ - {"RtlFreeHeap", MyRtlFreeHeap} -}; - -static int -RunTest(char *Buffer) -{ - _SetHooks(Hooks); - RtlFreeHeap(0,0,0); - FAIL_IF_FALSE(MyRtlFreeHeapCalled, "RtlFreeHeap() must be called."); - - FAIL_IF_FALSE(ReturnTrue(), "ReturnTrue() must always return TRUE."); - return TS_OK; } DISPATCHER(Test_1Test, "Test 1") diff --git a/reactos/lib/kernel32/makefile b/reactos/lib/kernel32/makefile index 204621df75c..efadc88de57 100644 --- a/reactos/lib/kernel32/makefile +++ b/reactos/lib/kernel32/makefile @@ -1,9 +1,11 @@ -# $Id: makefile,v 1.87 2004/10/04 19:17:58 gvg Exp $ +# $Id: makefile,v 1.88 2004/10/18 19:11:07 chorns Exp $ PATH_TO_TOP = ../.. TARGET_REGTESTS = yes +TARGET_BUILDENV_TEST = yes + TARGET_TYPE = dynlink TARGET_NAME = kernel32 diff --git a/reactos/lib/kernel32/tests/Makefile b/reactos/lib/kernel32/tests/Makefile index 8f525c250bf..ca891c0cbcb 100644 --- a/reactos/lib/kernel32/tests/Makefile +++ b/reactos/lib/kernel32/tests/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.1 2004/02/22 17:30:32 chorns Exp $ +# $Id: Makefile,v 1.2 2004/10/18 19:11:07 chorns Exp $ PATH_TO_TOP = ../../.. @@ -13,9 +13,19 @@ TARGET_CFLAGS = -I$(REGTESTS_PATH_INC) -include Makefile.tests TARGET_OBJECTS = \ + _rtstub.o \ _regtests.o \ + _hooks.o \ + _stubs.o \ $(addprefix tests/, $(TESTS)) include $(PATH_TO_TOP)/rules.mak include $(TOOLS_PATH)/helper.mk + +LIBS = ../kernel32.a + +run: all + @$(CC) -o _runtest.exe _rtstub.o regtests.a $(SDK_PATH_LIB)/rtshared.a $(LIBS) -lntdll + @_runtest.exe + @$(RM) _runtest.exe diff --git a/reactos/lib/kernel32/tests/stubs.tst b/reactos/lib/kernel32/tests/stubs.tst new file mode 100644 index 00000000000..922ba0c5c3f --- /dev/null +++ b/reactos/lib/kernel32/tests/stubs.tst @@ -0,0 +1,131 @@ +ntdll.dll CsrCaptureParameterBuffer@16 +ntdll.dll CsrClientCallServer@16 +ntdll.dll CsrClientConnectToServer@0 +ntdll.dll CsrReleaseParameterBuffer@4 +ntdll.dll DbgUiContinue@8 +ntdll.dll LdrAccessResource@16 +ntdll.dll LdrDisableThreadCalloutsForDll@4 +ntdll.dll LdrFindResource_U@16 +ntdll.dll LdrLoadDll@16 +ntdll.dll LdrShutdownProcess@0 +ntdll.dll LdrShutdownThread@0 +ntdll.dll LdrUnloadDll@4 +ntdll.dll NtAllocateVirtualMemory@24 +ntdll.dll NtClose@4 +ntdll.dll NtCreateDirectoryObject@12 +ntdll.dll NtCreateEvent@20 +ntdll.dll NtCreateFile@44 +ntdll.dll NtCreateKey@28 +ntdll.dll NtCreateProcess@32 +ntdll.dll NtCreateSection@28 +ntdll.dll NtDelayExecution@8 +ntdll.dll NtDeviceIoControlFile@40 +ntdll.dll _imp__NtDuplicateObject@28 +ntdll.dll NtFlushBuffersFile@8 +ntdll.dll NtFlushInstructionCache@12 +ntdll.dll NtFlushVirtualMemory@16 +ntdll.dll NtFreeVirtualMemory@16 +ntdll.dll NtFsControlFile@40 +ntdll.dll NtGetContextThread@8 +ntdll.dll NtLockVirtualMemory@16 +ntdll.dll NtOpenDirectoryObject@12 +ntdll.dll NtOpenEvent@12 +ntdll.dll NtOpenFile@24 +ntdll.dll NtOpenKey@12 +ntdll.dll NtOpenProcess@16 +ntdll.dll NtOpenSection@12 +ntdll.dll NtOpenThread@16 +ntdll.dll NtProtectVirtualMemory@20 +ntdll.dll NtPulseEvent@8 +ntdll.dll NtQueryDefaultLocale@8 +ntdll.dll NtQueryDefaultUILanguage@4 +ntdll.dll NtQueryDirectoryFile@44 +ntdll.dll NtQueryInformationFile@20 +ntdll.dll _imp__NtQueryInformationProcess@20 +ntdll.dll NtQueryInformationThread@20 +ntdll.dll NtQueryObject@20 +ntdll.dll NtQuerySystemInformation@16 +ntdll.dll NtQuerySystemTime@4 +ntdll.dll NtQueryValueKey@24 +ntdll.dll NtQueryVirtualMemory@24 +ntdll.dll NtQueryVolumeInformationFile@20 +ntdll.dll NtReadFile@36 +ntdll.dll NtReadVirtualMemory@20 +ntdll.dll NtResetEvent@8 +ntdll.dll NtResumeThread@8 +ntdll.dll NtSetContextThread@8 +ntdll.dll NtSetEvent@8 +ntdll.dll NtSetInformationFile@20 +ntdll.dll NtSetInformationObject@16 +ntdll.dll _imp__NtSetInformationProcess@16 +ntdll.dll NtSetInformationThread@16 +ntdll.dll NtSetSystemInformation@12 +ntdll.dll NtSetSystemTime@8 +ntdll.dll NtSignalAndWaitForSingleObject@16 +ntdll.dll NtSuspendThread@8 +ntdll.dll NtTerminateThread@8 +ntdll.dll NtUnlockVirtualMemory@16 +ntdll.dll NtUnmapViewOfSection@8 +ntdll.dll NtWaitForMultipleObjects@20 +ntdll.dll NtWaitForSingleObject@12 +ntdll.dll NtWriteFile@36 +ntdll.dll NtWriteVirtualMemory@20 +ntdll.dll NtYieldExecution@0 +ntdll.dll RtlAcquirePebLock@0 +ntdll.dll RtlAnsiStringToUnicodeSize@4 +ntdll.dll _imp__RtlBaseProcessStartRoutine +ntdll.dll RtlCompactHeap@8 +ntdll.dll RtlCopyUnicodeString@8 +ntdll.dll RtlCreateHeap@24 +ntdll.dll RtlCreateProcessParameters@40 +ntdll.dll RtlCreateUnicodeString@8 +ntdll.dll RtlCreateUnicodeStringFromAsciiz@8 +ntdll.dll RtlDeleteCriticalSection@4 +ntdll.dll RtlDestroyHeap@4 +ntdll.dll RtlDestroyProcessParameters@4 +ntdll.dll RtlDoesFileExists_U@4 +ntdll.dll RtlDosPathNameToNtPathName_U@16 +ntdll.dll RtlDosSearchPath_U@24 +ntdll.dll RtlEnterCriticalSection@4 +ntdll.dll RtlExpandEnvironmentStrings_U@16 +ntdll.dll RtlFreeHeap@12 +ntdll.dll RtlGetCurrentDirectory_U@8 +ntdll.dll RtlGetFullPathName_U@16 +ntdll.dll RtlGetProcessHeaps@8 +ntdll.dll RtlImageNtHeader@4 +ntdll.dll RtlInitCodePageTable@8 +ntdll.dll RtlInitializeCriticalSection@4 +ntdll.dll RtlInitUnicodeString@8 +ntdll.dll RtlIntegerToChar@16 +ntdll.dll RtlIntegerToUnicodeString@12 +ntdll.dll RtlIsNameLegalDOS8Dot3@12 +ntdll.dll RtlLeaveCriticalSection@4 +ntdll.dll RtlLockHeap@4 +ntdll.dll RtlNtStatusToDosError@4 +ntdll.dll RtlOemStringToUnicodeSize@4 +ntdll.dll RtlOemStringToUnicodeString@12 +ntdll.dll RtlOpenCurrentUser@8 +ntdll.dll RtlQueryEnvironmentVariable_U@12 +ntdll.dll RtlRaiseException@4 +ntdll.dll RtlReAllocateHeap@16 +ntdll.dll RtlReleasePebLock@0 +ntdll.dll RtlRosCreateUserThreadVa +ntdll.dll RtlRosExitUserThread@4 +ntdll.dll RtlSetCurrentDirectory_U@4 +ntdll.dll RtlSetEnvironmentVariable@12 +ntdll.dll RtlSetTimeZoneInformation@4 +ntdll.dll RtlTimeFieldsToTime@8 +ntdll.dll RtlTimeToTimeFields@8 +ntdll.dll RtlUnicodeStringToAnsiSize@4 +ntdll.dll RtlUnicodeStringToAnsiString@12 +ntdll.dll RtlUnicodeStringToInteger@12 +ntdll.dll RtlUnicodeStringToOemString@12 +ntdll.dll RtlUnicodeToOemN@20 +ntdll.dll RtlUnlockHeap@4 +ntdll.dll RtlValidateHeap@12 +ntdll.dll ZwMapViewOfSection@40 +ntdll.dll ZwOpenSection@12 +ntdll.dll ZwQuerySection@20 +ntdll.dll ZwQuerySystemInformation@16 +ntdll.dll ZwReadFile@36 +ntdll.dll ZwTerminateProcess@8 diff --git a/reactos/lib/kernel32/tests/tests/CreateFile.c b/reactos/lib/kernel32/tests/tests/CreateFile.c new file mode 100644 index 00000000000..092916c6aef --- /dev/null +++ b/reactos/lib/kernel32/tests/tests/CreateFile.c @@ -0,0 +1,126 @@ +#include "../../k32.h" +#include "regtests.h" + +#define NDEBUG +#include "../../include/debug.h" + +#define TestFilename L"C:\\File" +#define TestExpectedFilename L"\\??\\" TestFilename +#define TestHandle (HANDLE) 1 + +typedef struct +{ + LPCWSTR lpFileName; + DWORD dwDesiredAccess; + DWORD dwShareMode; + LPSECURITY_ATTRIBUTES lpSecurityAttributes; + DWORD dwCreationDisposition; + DWORD dwFlagsAndAttributes; + HANDLE hTemplateFile; +} CreateFile_PARAMETERS; + +typedef struct +{ + PWCHAR ObjectName; + ACCESS_MASK DesiredAccess; + ULONG FileAttributes; + ULONG ShareAccess; + ULONG CreateDisposition; + ULONG CreateOptions; + PVOID EaBuffer; + ULONG EaLength; +} NtCreateFile_PARAMETERS; + +typedef struct +{ + CreateFile_PARAMETERS CreateFileParameters; + NtCreateFile_PARAMETERS NtCreateFileParameters; +} CreateFileTest_Parameters; + +static CreateFileTest_Parameters CreateFileTests[] = +{ + { + CreateFileParameters: + { + lpFileName: TestFilename, + dwDesiredAccess: GENERIC_ALL, + dwShareMode: FILE_SHARE_WRITE, + lpSecurityAttributes: NULL, + dwCreationDisposition: CREATE_ALWAYS, + dwFlagsAndAttributes: 0, + hTemplateFile: NULL + }, + NtCreateFileParameters: + { + ObjectName: TestExpectedFilename, + DesiredAccess: GENERIC_ALL|SYNCHRONIZE|FILE_READ_ATTRIBUTES, + FileAttributes: 0, + ShareAccess: FILE_SHARE_WRITE, + CreateDisposition: FILE_OVERWRITE_IF, + CreateOptions: FILE_NON_DIRECTORY_FILE|FILE_SYNCHRONOUS_IO_NONALERT, + NULL, + 0 + } + } +}; + +static CreateFileTest_Parameters *CurrentTest; + +static NTSTATUS STDCALL +MockNtCreateFile(PHANDLE FileHandle, + ACCESS_MASK DesiredAccess, + POBJECT_ATTRIBUTES ObjectAttributes, + PIO_STATUS_BLOCK IoStatusBlock, + PLARGE_INTEGER AllocateSize, + ULONG FileAttributes, + ULONG ShareAccess, + ULONG CreateDisposition, + ULONG CreateOptions, + PVOID EaBuffer, + ULONG EaLength) +{ + _AssertEqualWideString(CurrentTest->NtCreateFileParameters.ObjectName, + ObjectAttributes->ObjectName->Buffer); + _AssertEqualValue(CurrentTest->NtCreateFileParameters.DesiredAccess, DesiredAccess); + _AssertEqualValue(CurrentTest->NtCreateFileParameters.FileAttributes, FileAttributes); + _AssertEqualValue(CurrentTest->NtCreateFileParameters.ShareAccess, ShareAccess); + _AssertEqualValue(CurrentTest->NtCreateFileParameters.CreateDisposition, CreateDisposition); + _AssertEqualValue(CurrentTest->NtCreateFileParameters.CreateOptions, CreateOptions); + *FileHandle = TestHandle; + return STATUS_SUCCESS; +} + +static HOOK NtCreateFileHooks[] = +{ + {"NtCreateFile", MockNtCreateFile}, + NULL, NULL +}; + +static void TestFile() +{ + HANDLE FileHandle; + int index; + + _SetHooks(NtCreateFileHooks); + for (index = 0; index < sizeof(CreateFileTests) / sizeof(CreateFileTests[0]); index++) + { + CurrentTest = &CreateFileTests[index]; + FileHandle = CreateFileW(CurrentTest->CreateFileParameters.lpFileName, + CurrentTest->CreateFileParameters.dwDesiredAccess, + CurrentTest->CreateFileParameters.dwShareMode, + CurrentTest->CreateFileParameters.lpSecurityAttributes, + CurrentTest->CreateFileParameters.dwCreationDisposition, + CurrentTest->CreateFileParameters.dwFlagsAndAttributes, + CurrentTest->CreateFileParameters.hTemplateFile); + _AssertEqualValue(NO_ERROR, GetLastError()); + _AssertEqualValue(TestHandle, FileHandle); + } + _ResetAllHooks(); +} + +static void RunTest() +{ + TestFile(); +} + +DISPATCHER(CreatefileTest, "CreateFileW") diff --git a/reactos/lib/kernel32/tests/tests/file-1.c b/reactos/lib/kernel32/tests/tests/file-1.c deleted file mode 100644 index c497695c92e..00000000000 --- a/reactos/lib/kernel32/tests/tests/file-1.c +++ /dev/null @@ -1,73 +0,0 @@ -#include -#include -#include -#include - -#include "regtests.h" - -static int RunTest(char *Buffer) -{ - char buffer[4096]; - HANDLE file; - DWORD wrote; - int c; - - file = CreateFile("test.dat", - GENERIC_READ | GENERIC_WRITE, - 0, - NULL, - CREATE_ALWAYS, - 0, - 0); - - if (file == INVALID_HANDLE_VALUE) - { - sprintf(Buffer, "Error opening file (Status %lx)", GetLastError()); - return TS_FAILED; - } - - for (c = 0; c < sizeof(buffer); c++) - buffer[c] = (char)c; - - if (WriteFile( file, buffer, 4096, &wrote, NULL) == FALSE) - { - sprintf(Buffer, "Error writing file (Status %lx)", GetLastError()); - return TS_FAILED; - } - - SetFilePointer(file, 0, 0, FILE_BEGIN); - - if (ReadFile( file, buffer, 4096, &wrote, NULL) == FALSE) - { - sprintf(Buffer, "Error reading file (Status %lx)", GetLastError()); - return TS_FAILED; - } - for (c = 0; c < sizeof(buffer); c++) - { - if (buffer[c] != (char)c) - { - strcpy(Buffer, "Error: data read back is not what was written"); - CloseHandle(file); - return TS_FAILED; - } - } - - CloseHandle(file); - return TS_OK; -} - -int -File_1Test(int Command, char *Buffer) -{ - switch (Command) - { - case TESTCMD_RUN: - return RunTest(Buffer); - case TESTCMD_TESTNAME: - strcpy(Buffer, "File read/write"); - return TS_OK; - default: - break; - } - return TS_FAILED; -} diff --git a/reactos/regtests/Makefile b/reactos/regtests/Makefile index 958a95a6141..c8c760555cf 100755 --- a/reactos/regtests/Makefile +++ b/reactos/regtests/Makefile @@ -1,36 +1,16 @@ -# $Id: Makefile,v 1.4 2004/03/09 22:08:04 chorns Exp $ +# $Id: Makefile,v 1.5 2004/10/18 19:11:07 chorns Exp $ PATH_TO_TOP = .. -REGTEST_TARGETS = kmregtests/_regtests.c kmregtests/Makefile.tests win32base/_regtests.c win32base/Makefile.tests - -all: $(REGTEST_TARGETS) +all: $(MAKE) -C shared all - $(MAKE) -C win32base all - $(MAKE) -C kmregtests all - $(MAKE) -C kmrtint all - $(MAKE) -C regtests all clean: - $(MAKE) -C shared clean - - $(MAKE) -C win32base clean - - $(MAKE) -C kmregtests clean - - $(MAKE) -C kmrtint clean - - $(MAKE) -C regtests clean - - $(RM) ./kmregtests/_regtests.c ./kmregtests/Makefile.tests - - $(RM) ./win32base/_regtests.c ./win32base/Makefile.tests install: $(MAKE) -C shared install - $(MAKE) -C win32base install - $(MAKE) -C kmregtests install - $(MAKE) -C kmrtint install - $(MAKE) -C regtests install -$(REGTEST_TARGETS): kmregtests/tests/*.c win32base/tests/*.c - $(REGTESTS) ./kmregtests/tests ./kmregtests/_regtests.c ./kmregtests/Makefile.tests - $(REGTESTS) ./win32base/tests ./win32base/_regtests.c ./win32base/Makefile.tests - -.PHONY: all clean install registrations +.PHONY: all clean install include $(PATH_TO_TOP)/rules.mak diff --git a/reactos/regtests/kmregtests/.cvsignore b/reactos/regtests/kmregtests/.cvsignore deleted file mode 100755 index 90b639a6107..00000000000 --- a/reactos/regtests/kmregtests/.cvsignore +++ /dev/null @@ -1,10 +0,0 @@ -*.o -*.d -*.exe -*.coff -*.sym -*.sys -*.map -_regtests.c -*.sys -Makefile.tests diff --git a/reactos/regtests/kmregtests/Makefile b/reactos/regtests/kmregtests/Makefile deleted file mode 100755 index 48bfe0cafe9..00000000000 --- a/reactos/regtests/kmregtests/Makefile +++ /dev/null @@ -1,25 +0,0 @@ -# $Id: Makefile,v 1.4 2004/04/13 20:29:29 jfilby Exp $ - -PATH_TO_TOP = ../.. - -TARGET_NORC = yes - -TARGET_TYPE = driver - -TARGET_NAME = kmregtests - -TARGET_LIBS = $(SDK_PATH_LIB)/rtshared.a - -TARGET_CFLAGS = -I../shared -Werror -Wall -TARGET_CFLAGS += -D__USE_W32API - -include Makefile.tests - -TARGET_OBJECTS = \ - _regtests.o \ - driver.o \ - $(addprefix tests/, $(TESTS)) - -include $(PATH_TO_TOP)/rules.mak - -include $(TOOLS_PATH)/helper.mk diff --git a/reactos/regtests/kmregtests/driver.c b/reactos/regtests/kmregtests/driver.c deleted file mode 100755 index b031d8604ac..00000000000 --- a/reactos/regtests/kmregtests/driver.c +++ /dev/null @@ -1,207 +0,0 @@ -/* - * PROJECT: ReactOS kernel - * FILE: regtests/kmregtests/driver.c - * PURPOSE: Kernel-mode regression testing driver - * PROGRAMMER: Casper S. Hornstrup (chorns@users.sourceforge.net) - * UPDATE HISTORY: - * 06-07-2003 CSH Created - */ -#define NTOS_MODE_KERNEL -#include -#include "regtests.h" -#include "kmregtests.h" - -#define NDEBUG -#include - -extern void AddTest(TestRoutine Routine); - -PVOID -AllocateMemory(ULONG Size) -{ - return ExAllocatePool(NonPagedPool, Size); -} - - -VOID -FreeMemory(PVOID Base) -{ - ExFreePool(NonPagedPool); -} - -VOID -ShutdownBochs() -{ - /* Shutdown bochs programmatically */ - WRITE_PORT_BUFFER_UCHAR((PUCHAR) 0x8900, - (PUCHAR) "Shutdown", - strlen("Shutdown")); -} - -NTSTATUS -STDCALL -KMRegTestsRegister( - PIRP Irp, - PIO_STACK_LOCATION IrpSp) -{ - TestRoutine *pTestRoutine; - - pTestRoutine = (TestRoutine*)Irp->AssociatedIrp.SystemBuffer; - AddTest(*pTestRoutine); - - Irp->IoStatus.Status = STATUS_SUCCESS; - Irp->IoStatus.Information = 0; - return STATUS_SUCCESS; -} - -NTSTATUS -STDCALL -KMRegTestsRun( - PIRP Irp, - PIO_STACK_LOCATION IrpSp) -{ - PerformTests(NULL, NULL); - ShutdownBochs(); - - Irp->IoStatus.Status = STATUS_SUCCESS; - Irp->IoStatus.Information = 0; - return STATUS_SUCCESS; -} - -NTSTATUS -STDCALL -KMRegTestsDispatch( - PDEVICE_OBJECT DeviceObject, - PIRP Irp) -/* - * FUNCTION: IOCTL dispatch routine - * ARGUMENTS: - * DeviceObject = Pointer to a device object for this driver - * Irp = Pointer to a I/O request packet - * RETURNS: - * Status of the operation - */ -{ - NTSTATUS Status; - PIO_STACK_LOCATION IrpSp; - - IrpSp = IoGetCurrentIrpStackLocation(Irp); - - DPRINT("Called. DeviceObject is at (0x%X), IRP is at (0x%X), IrpSp->FileObject (0x%X).\n", - DeviceObject, Irp, IrpSp->FileObject); - - Irp->IoStatus.Information = 0; - - switch (IrpSp->Parameters.DeviceIoControl.IoControlCode) { - case IOCTL_KMREGTESTS_REGISTER: - Status = KMRegTestsRegister(Irp, IrpSp); - break; - - case IOCTL_KMREGTESTS_RUN: - Status = KMRegTestsRun(Irp, IrpSp); - break; - - default: - DPRINT("Unknown IOCTL (0x%X).\n", - IrpSp->Parameters.DeviceIoControl.IoControlCode); - Status = STATUS_NOT_IMPLEMENTED; - break; - } - - if (Status != STATUS_PENDING) { - Irp->IoStatus.Status = Status; - IoCompleteRequest(Irp, IO_NO_INCREMENT); - } - - DPRINT("Leaving. Status (0x%X).\n", Status); - - return Status; -} - -NTSTATUS STDCALL -KMRegTestsOpenClose(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp) -{ - PIO_STACK_LOCATION IrpSp = IoGetCurrentIrpStackLocation(Irp); - NTSTATUS Status; - - DPRINT("Called. DeviceObject is at (0x%X), IRP is at (0x%X), IrpSp->FileObject (0x%X).\n", - DeviceObject, Irp, IrpSp->FileObject); - - Status = STATUS_SUCCESS; - - switch (IrpSp->MajorFunction) - { - /* Opening and closing handles to the device */ - case IRP_MJ_CREATE: - case IRP_MJ_CLOSE: - break; - - /* Write data */ - case IRP_MJ_WRITE: - /* Ignore */ - Irp->IoStatus.Information = 0; - break; - - /* Read data */ - case IRP_MJ_READ: - /* Ignore */ - Irp->IoStatus.Information = 0; - Status = STATUS_END_OF_FILE; - break; - - /* Unsupported operations */ - default: - Status = STATUS_NOT_IMPLEMENTED; - } - - Irp->IoStatus.Status = Status; - IoCompleteRequest(Irp, IO_NO_INCREMENT); - - return Status; -} - -NTSTATUS STDCALL -KMRegTestsUnload(PDRIVER_OBJECT DriverObject) -{ - return STATUS_SUCCESS; -} - -NTSTATUS STDCALL -DriverEntry(PDRIVER_OBJECT DriverObject, - PUNICODE_STRING RegistryPath) -{ - PDEVICE_OBJECT DeviceObject; - UNICODE_STRING DeviceName; - NTSTATUS Status; - - /* Register driver routines */ - DriverObject->MajorFunction[IRP_MJ_CLOSE] = (PDRIVER_DISPATCH) KMRegTestsOpenClose; - DriverObject->MajorFunction[IRP_MJ_CREATE] = (PDRIVER_DISPATCH) KMRegTestsOpenClose; - DriverObject->MajorFunction[IRP_MJ_WRITE] = (PDRIVER_DISPATCH) KMRegTestsOpenClose; - DriverObject->MajorFunction[IRP_MJ_READ] = (PDRIVER_DISPATCH) KMRegTestsOpenClose; - DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = (PDRIVER_DISPATCH) KMRegTestsDispatch; - DriverObject->DriverUnload = (PDRIVER_UNLOAD) KMRegTestsUnload; - - /* Create device */ - RtlInitUnicodeString(&DeviceName, - L"\\Device\\KMRegTests"); - - Status = IoCreateDevice(DriverObject, - 0, - &DeviceName, - FILE_DEVICE_NULL, - 0, - FALSE, - &DeviceObject); - if (!NT_SUCCESS(Status)) - { - return Status; - } - - DeviceObject->Flags |= DO_BUFFERED_IO; - - InitializeTests(); - RegisterTests(); - - return Status; -} diff --git a/reactos/regtests/kmregtests/kmregtests.h b/reactos/regtests/kmregtests/kmregtests.h deleted file mode 100755 index d16f56e93d8..00000000000 --- a/reactos/regtests/kmregtests/kmregtests.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * PROJECT: ReactOS kernel - * FILE: regtests/kmregtests/kmregtests.h - * PURPOSE: Kernel-mode component regression testing - * PROGRAMMER: Casper S. Hornstrup (chorns@users.sourceforge.net) - * UPDATE HISTORY: - * 06-07-2003 CSH Created - */ -#include - -/* KMREGTESTS IOCTL code definitions */ - -#define FSCTL_KMREGTESTS_BASE FILE_DEVICE_NAMED_PIPE - -#define KMREGTESTS_CTL_CODE(Function, Method, Access) \ - CTL_CODE(FSCTL_KMREGTESTS_BASE, Function, Method, Access) - -#define IOCTL_KMREGTESTS_REGISTER \ - KMREGTESTS_CTL_CODE(0, METHOD_BUFFERED, FILE_ANY_ACCESS) - -#define IOCTL_KMREGTESTS_RUN \ - KMREGTESTS_CTL_CODE(1, METHOD_BUFFERED, FILE_ANY_ACCESS) diff --git a/reactos/regtests/kmregtests/tests/.cvsignore b/reactos/regtests/kmregtests/tests/.cvsignore deleted file mode 100644 index 5761abcfdf0..00000000000 --- a/reactos/regtests/kmregtests/tests/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -*.o diff --git a/reactos/regtests/kmregtests/tests/fs-1.c b/reactos/regtests/kmregtests/tests/fs-1.c deleted file mode 100755 index 271427bdf65..00000000000 --- a/reactos/regtests/kmregtests/tests/fs-1.c +++ /dev/null @@ -1,24 +0,0 @@ -#include -#include -#include - -#include "regtests.h" - -static int -RunTest(char *Buffer) -{ - UNICODE_STRING Expression, Name; - - RtlInitUnicodeString(&Expression, L"f0_*.*"); - RtlInitUnicodeString(&Name, L"F0_000"); - FAIL_IF_FALSE(FsRtlDoesNameContainWildCards(&Expression), - "FsRtlDoesNameContainWildCards didn't recognize valid expression"); - FAIL_IF_FALSE(FsRtlIsNameInExpression(&Expression, &Name, TRUE, NULL), - "FsRtlIsNameInExpression failed to recognize valid match"); - FAIL_IF_TRUE(FsRtlIsNameInExpression(&Expression, &Name, FALSE, NULL), - "FsRtlIsNameInExpression fails to enforce case sensitivity rules"); - - return TS_OK; -} - -DISPATCHER(Fs_1Test, "Kernel File System Runtime Library API") diff --git a/reactos/regtests/kmregtests/tests/mdl-1.c b/reactos/regtests/kmregtests/tests/mdl-1.c deleted file mode 100644 index 89e7d400890..00000000000 --- a/reactos/regtests/kmregtests/tests/mdl-1.c +++ /dev/null @@ -1,52 +0,0 @@ -#include -#include - -#include "regtests.h" - -static int -RunTest(char *Buffer) -{ - VOID *pmem1, *MdlPfnArray, *MdlVirtAddr; - ULONG MdlSize, MdlOffset, AllocSize; - PMDL Mdl; - - /* Allocate memory for use in testing */ - AllocSize = 512; - pmem1 = ExAllocatePool(NonPagedPool, - AllocSize); - - /* MmSizeOfMdl test */ - MdlSize = 0; - MdlSize = MmSizeOfMdl(pmem1, AllocSize); - FAIL_IF_LESS_EQUAL(MdlSize, sizeof(MDL), "MmSizeOfMdl() failed"); - - /* MmCreateMdl test */ - Mdl = NULL; - Mdl = MmCreateMdl(NULL, pmem1, AllocSize); - FAIL_IF_NULL(Mdl, "MmCreateMdl() failed for Mdl"); - - /* MmGetMdlByteCount test */ - MdlSize = 0; - MdlSize = MmGetMdlByteCount(Mdl); - FAIL_IF_NOT_EQUAL(MdlSize, AllocSize, "MmGetMdlByteCount() failed for Mdl"); - - /* MmGetMdlByteOffset test */ - MdlOffset = MmGetMdlByteOffset(Mdl); - - /* MmGetMdlPfnArray test */ - MdlPfnArray = NULL; - MdlPfnArray = MmGetMdlPfnArray(Mdl); - FAIL_IF_NULL(MdlPfnArray, "MmGetMdlPfnArray() failed for Mdl"); - - /* MmGetMdlVirtualAddress test */ - MdlVirtAddr = NULL; - MdlVirtAddr = MmGetMdlVirtualAddress(Mdl); - FAIL_IF_NULL(MdlVirtAddr, "MmGetMdlVirtualAddress() failed for Mdl"); - - /* Free memory used in test */ - ExFreePool(pmem1); - - return TS_OK; -} - -DISPATCHER(Mdl_1Test, "Kernel Memory MDL API (1)") diff --git a/reactos/regtests/kmregtests/tests/mdl-2.c b/reactos/regtests/kmregtests/tests/mdl-2.c deleted file mode 100644 index 99e5983785a..00000000000 --- a/reactos/regtests/kmregtests/tests/mdl-2.c +++ /dev/null @@ -1,48 +0,0 @@ -#include -#include - -#include "regtests.h" - -static int -RunTest(char *Buffer) -{ - VOID *pmem1, *sysaddr1, *sysaddr2; - ULONG AllocSize; - BOOLEAN BoolVal; - PMDL Mdl; - - /* Allocate memory for use in testing */ - AllocSize = 1024; - pmem1 = ExAllocatePool(NonPagedPool, AllocSize); - - /* MmCreateMdl test */ - Mdl = NULL; - Mdl = MmCreateMdl(NULL, pmem1, AllocSize); - FAIL_IF_NULL(Mdl, "MmCreateMdl() failed for Mdl"); - - /* MmBuildMdlForNonPagedPool test */ - MmBuildMdlForNonPagedPool(Mdl); - - /* MmGetSystemAddressForMdl test for buffer built by MmBuildMdlForNonPagedPool */ - sysaddr1 = MmGetSystemAddressForMdl(Mdl); - FAIL_IF_NULL(sysaddr1, "MmGetSystemAddressForMdl() failed for Mdl after MmBuildMdlForNonPagedPool"); - - /* MmIsNonPagedSystemAddressValid test */ - BoolVal = MmIsNonPagedSystemAddressValid(sysaddr1); - FAIL_IF_FALSE(BoolVal, "MmIsNonPagedSystemAddressValid() failed for Mdl for sysaddr1"); - - /* MmGetSystemAddressForMdlSafe test */ - sysaddr2 = MmGetSystemAddressForMdlSafe(Mdl, HighPagePriority); - FAIL_IF_NULL(sysaddr2, "MmGetSystemAddressForMdlSafe() failed for Mdl after MmBuildMdlForNonPagedPool"); - - /* MmIsNonPagedSystemAddressValid test */ - BoolVal = MmIsNonPagedSystemAddressValid(sysaddr2); - FAIL_IF_FALSE(BoolVal, "MmIsNonPagedSystemAddressValid() failed for Mdl for sysaddr2"); - - /* Free memory used in test */ - ExFreePool(pmem1); - - return TS_OK; -} - -DISPATCHER(Mdl_2Test, "Kernel Memory MDL API (2)") diff --git a/reactos/regtests/kmregtests/tests/mm-1.c b/reactos/regtests/kmregtests/tests/mm-1.c deleted file mode 100644 index dbd95ced487..00000000000 --- a/reactos/regtests/kmregtests/tests/mm-1.c +++ /dev/null @@ -1,121 +0,0 @@ -#include -#include - -#include "regtests.h" - -static int -RunTest(char *Buffer) -{ - VOID *pmem1, *pmem2, *pmem3, *pmem4, *pmem5; - PHYSICAL_ADDRESS LowestAcceptableAddress, HighestAcceptableAddress, BoundryAddressMultiple, - PhysicalAddress; - ULONG AllocSize1, AllocSize2, AllocSize3, AllocSize4, AllocSize5, MemSize; - BOOL Server, BoolVal; - - /* Various ways to allocate memory */ - HighestAcceptableAddress.QuadPart = 0x00000000FFFFFF; /* 16MB */ - AllocSize1 = 512; - pmem1 = 0; - pmem1 = MmAllocateContiguousMemory(AllocSize1, HighestAcceptableAddress); - FAIL_IF_EQUAL(pmem1, 0, "MmAllocateContiguousMemory() for pmem1 failed"); - - LowestAcceptableAddress.QuadPart = 0x00000000F00000; /* 15MB */ - HighestAcceptableAddress.QuadPart = 0x00000000FFFFFF; /* 16MB */ - BoundryAddressMultiple.QuadPart = 512; - AllocSize2 = 512; - pmem2 = 0; - pmem2 = MmAllocateContiguousMemorySpecifyCache(AllocSize2, - LowestAcceptableAddress, HighestAcceptableAddress, - BoundryAddressMultiple, MmNonCached); - FAIL_IF_EQUAL(pmem2, 0, "MmAllocateContiguousMemorySpecifyCache() for pmem2 failed"); - - LowestAcceptableAddress.QuadPart = 0x00000000000000; /* 15MB */ - HighestAcceptableAddress.QuadPart = 0x0000000F000000; /* 250MB */ - BoundryAddressMultiple.QuadPart = 1024; - AllocSize3 = 512; - pmem3 = 0; - pmem3 = MmAllocateContiguousMemorySpecifyCache(AllocSize3, - LowestAcceptableAddress, HighestAcceptableAddress, - BoundryAddressMultiple, MmCached); - FAIL_IF_EQUAL(pmem3, 0, "MmAllocateContiguousMemorySpecifyCache() for pmem3 failed"); - - LowestAcceptableAddress.QuadPart = 0x00000000000000; /* 0MB */ - HighestAcceptableAddress.QuadPart = 0x00000000FFFFFF; /* 16MB */ - BoundryAddressMultiple.QuadPart = 4096; - AllocSize4 = 512; - pmem4 = 0; - pmem4 = MmAllocateContiguousMemorySpecifyCache(AllocSize4, - LowestAcceptableAddress, HighestAcceptableAddress, - BoundryAddressMultiple, MmWriteCombined); - FAIL_IF_EQUAL(pmem4, 0, "MmAllocateContiguousMemorySpecifyCache() for pmem4 failed"); - - AllocSize5 = 1048576; /* 1MB */ - pmem5 = 0; - pmem5 = MmAllocateNonCachedMemory(AllocSize5); - FAIL_IF_EQUAL(pmem5, 0, "MmAllocateNonCachedMemory() for pmem5 failed"); - - /* Memory checking functions */ - PhysicalAddress.QuadPart = 0; - PhysicalAddress = MmGetPhysicalAddress(pmem1); - FAIL_IF_EQUAL(PhysicalAddress.QuadPart, 0, "MmGetPhysicalAddress() failed"); - - BoolVal = MmIsAddressValid(pmem1); - FAIL_IF_FALSE(BoolVal, "MmIsAddressValid() failed for pmem1"); - - BoolVal = MmIsAddressValid(pmem2); - FAIL_IF_FALSE(BoolVal, "MmIsAddressValid() failed for pmem2"); - - BoolVal = MmIsAddressValid(pmem3); - FAIL_IF_FALSE(BoolVal, "MmIsAddressValid() failed for pmem3"); - - BoolVal = MmIsAddressValid(pmem4); - FAIL_IF_FALSE(BoolVal, "MmIsAddressValid() failed for pmem4"); - - BoolVal = MmIsAddressValid(pmem5); - FAIL_IF_FALSE(BoolVal, "MmIsAddressValid() failed for pmem5"); - - BoolVal = MmIsNonPagedSystemAddressValid(pmem1); - FAIL_IF_FALSE(BoolVal, "MmIsNonPagedSystemAddressValid() failed for pmem1"); - - BoolVal = MmIsNonPagedSystemAddressValid(pmem2); - FAIL_IF_FALSE(BoolVal, "MmIsNonPagedSystemAddressValid() failed for pmem2"); - - BoolVal = MmIsNonPagedSystemAddressValid(pmem3); - FAIL_IF_FALSE(BoolVal, "MmIsNonPagedSystemAddressValid() failed for pmem3"); - - BoolVal = MmIsNonPagedSystemAddressValid(pmem4); - FAIL_IF_FALSE(BoolVal, "MmIsNonPagedSystemAddressValid() failed for pmem4"); - - BoolVal = MmIsNonPagedSystemAddressValid(pmem5); - FAIL_IF_FALSE(BoolVal, "MmIsNonPagedSystemAddressValid() failed for pmem5"); - - /* Misc functions */ - Server = MmIsThisAnNtAsSystem(); - MemSize = 0; - MemSize = MmQuerySystemSize(); - if (MemSize != MmSmallSystem && - MemSize != MmMediumSystem && - MemSize != MmLargeSystem) - { - strcpy(Buffer, "MmQuerySystemSize() failed\n"); - return TS_FAILED; - } - - /* Free allocated memory */ - MmFreeContiguousMemory(pmem1); - MmFreeContiguousMemorySpecifyCache(pmem2, - AllocSize2, - MmNonCached); - MmFreeContiguousMemorySpecifyCache(pmem3, - AllocSize3, - MmCached); - MmFreeContiguousMemorySpecifyCache(pmem4, - AllocSize4, - MmWriteCombined); - MmFreeNonCachedMemory(pmem5, - AllocSize5); - - return TS_OK; -} - -DISPATCHER(Mm_1Test, "Kernel Core Memory API") diff --git a/reactos/regtests/kmrtint/.cvsignore b/reactos/regtests/kmrtint/.cvsignore deleted file mode 100755 index 611644d8c77..00000000000 --- a/reactos/regtests/kmrtint/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.o -*.d -*.dll -*.coff -*.sym -*.map diff --git a/reactos/regtests/kmrtint/Makefile b/reactos/regtests/kmrtint/Makefile deleted file mode 100755 index 3a0e384144b..00000000000 --- a/reactos/regtests/kmrtint/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -# $Id: Makefile,v 1.2 2003/11/19 05:53:37 vizzini Exp $ - -PATH_TO_TOP = ../.. - -TARGET_NORC = yes - -TARGET_TYPE = dynlink - -TARGET_NAME = kmrtint - -TARGET_SDKLIBS = ntdll.a kernel32.a - -TARGET_CFLAGS = -I../shared -I../kmregtests -Werror -Wall - -TARGET_BASE = 0x50000000 - -TARGET_OBJECTS = \ - kmrtint.o - -include $(PATH_TO_TOP)/rules.mak - -include $(TOOLS_PATH)/helper.mk - -# EOF diff --git a/reactos/regtests/kmrtint/kmrtint.c b/reactos/regtests/kmrtint/kmrtint.c deleted file mode 100755 index e14ac0fb0d7..00000000000 --- a/reactos/regtests/kmrtint/kmrtint.c +++ /dev/null @@ -1,86 +0,0 @@ -/* - * PROJECT: ReactOS kernel - * FILE: regtests/kmrtint/kmrtint.c - * PURPOSE: Kernel-mode regression testing driver user-mode interface - * PROGRAMMER: Casper S. Hornstrup (chorns@users.sourceforge.net) - * UPDATE HISTORY: - * 06-07-2003 CSH Created - */ -#define NTOS_MODE_USER -#include -#include "regtests.h" -#include "kmregtests.h" - -#define NDEBUG -#include - -HANDLE -OpenDevice() -{ - OBJECT_ATTRIBUTES ObjectAttributes; - UNICODE_STRING DeviceName; - IO_STATUS_BLOCK Iosb; - HANDLE DeviceHandle; - NTSTATUS Status; - - RtlInitUnicodeString(&DeviceName, - L"\\Device\\KMRegTests"); - InitializeObjectAttributes( - &ObjectAttributes, - &DeviceName, - 0, - NULL, - NULL); - - Status = NtCreateFile( - &DeviceHandle, - FILE_GENERIC_READ | FILE_GENERIC_WRITE, - &ObjectAttributes, - &Iosb, - NULL, - 0, - 0, - FILE_OPEN, - FILE_SYNCHRONOUS_IO_NONALERT, - NULL, - 0); - - if (!NT_SUCCESS(Status)) - { - return INVALID_HANDLE_VALUE; - } - return DeviceHandle; -} - -VOID STDCALL -RegTestMain(TestOutputRoutine OutputRoutine, LPSTR TestName) -{ - IO_STATUS_BLOCK Iosb; - HANDLE DeviceHandle; - NTSTATUS Status; - - DeviceHandle = OpenDevice(); - if (DeviceHandle != INVALID_HANDLE_VALUE) - { - Status = NtDeviceIoControlFile( - DeviceHandle, - NULL, - NULL, - NULL, - &Iosb, - IOCTL_KMREGTESTS_RUN, - NULL, - 0, - NULL, - 0); - if (Status == STATUS_PENDING) { - Status = NtWaitForSingleObject(DeviceHandle, FALSE, NULL); - } - - NtClose(DeviceHandle); - } - else - { - DPRINT("Cannot open KMRegTests device.\n"); - } -} diff --git a/reactos/regtests/kmrtint/kmrtint.def b/reactos/regtests/kmrtint/kmrtint.def deleted file mode 100755 index 39fa60a6217..00000000000 --- a/reactos/regtests/kmrtint/kmrtint.def +++ /dev/null @@ -1,3 +0,0 @@ -LIBRARY kmrtint.dll -EXPORTS -RegTestMain@8 diff --git a/reactos/regtests/regtests/.cvsignore b/reactos/regtests/regtests/.cvsignore deleted file mode 100755 index d63774a7353..00000000000 --- a/reactos/regtests/regtests/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -*.o -*.d -*.exe -*.coff -*.sym -*.map diff --git a/reactos/regtests/regtests/Makefile b/reactos/regtests/regtests/Makefile deleted file mode 100755 index d5160f633bd..00000000000 --- a/reactos/regtests/regtests/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -# $Id: Makefile,v 1.2 2003/11/19 05:53:37 vizzini Exp $ - -PATH_TO_TOP = ../.. - -TARGET_NORC = yes - -TARGET_TYPE = program - -TARGET_APPTYPE = console - -TARGET_NAME = regtests - -TARGET_SDKLIBS = rtshared.a ntdll.a kernel32.a - -TARGET_CFLAGS = -I../shared -Wall -Werror - -TARGET_OBJECTS = \ - regtests.o - -include $(PATH_TO_TOP)/rules.mak - -include $(TOOLS_PATH)/helper.mk - -# EOF diff --git a/reactos/regtests/regtests/regtests.c b/reactos/regtests/regtests/regtests.c deleted file mode 100755 index 40b0fb80e1a..00000000000 --- a/reactos/regtests/regtests/regtests.c +++ /dev/null @@ -1,89 +0,0 @@ -/* - * PROJECT: ReactOS kernel - * FILE: regtests/regtests/regtests.c - * PURPOSE: Regression testing host - * PROGRAMMER: Casper S. Hornstrup (chorns@users.sourceforge.net) - * UPDATE HISTORY: - * 06-07-2003 CSH Created - */ -#define NTOS_MODE_USER -#include -#include -#include "regtests.h" - -#define OUPUT_MODE_DbgPrint 0 -#define OUPUT_MODE_OutputDebugString 1 -#define OUPUT_MODE_printf 2 - -static int OutputMode = 0; - -static void OutputRoutine(char *Buffer) -{ - if (OutputMode == OUPUT_MODE_DbgPrint) - { - DbgPrint(Buffer); - } - else if (OutputMode == OUPUT_MODE_OutputDebugString) - { - OutputDebugString(Buffer); - } - else if (OutputMode == OUPUT_MODE_printf) - { - printf(Buffer); - } -} - -static VOID -RunTestDriver(LPSTR FileName, LPSTR TestName) -{ - TestDriverMain Main; - HMODULE hModule; - - hModule = LoadLibrary(FileName); - if (hModule != NULL) - { - Main = (TestDriverMain) GetProcAddress(hModule, "RegTestMain"); - if (Main != NULL) - { - (Main)(OutputRoutine, TestName); - } - FreeLibrary(hModule); - } -} - -int -main(int argc, char* argv[]) -{ - LPSTR testname = NULL; - int i; - - if (argc > 1) - { - i = 1; - if (argv[i][0] == '-') - { - switch (argv[i][1]) - { - case 'd': - OutputMode = OUPUT_MODE_DbgPrint; - break; - case 'o': - OutputMode = OUPUT_MODE_OutputDebugString; - break; - case 'p': - OutputMode = OUPUT_MODE_printf; - break; - default: - printf("Usage: regtests [-dop] [testname]"); - return 0; - } - i++; - } - - testname = argv[i]; - } - - RunTestDriver("win32base.dll", testname); - RunTestDriver("kmrtint.dll", testname); - return 0; -} diff --git a/reactos/regtests/shared/regtests.c b/reactos/regtests/shared/regtests.c index 1d6348f4981..7031ebbd58a 100755 --- a/reactos/regtests/shared/regtests.c +++ b/reactos/regtests/shared/regtests.c @@ -45,8 +45,8 @@ InitializeTests() VOID PerformTest(TestOutputRoutine OutputRoutine, PROS_TEST Test, LPSTR TestName) { - char OutputBuffer[200]; - char Buffer[200]; + char OutputBuffer[5000]; + char Buffer[5000]; char Name[200]; int Result; diff --git a/reactos/regtests/shared/regtests.h b/reactos/regtests/shared/regtests.h index 03620c04b58..33dcd3e79c9 100755 --- a/reactos/regtests/shared/regtests.h +++ b/reactos/regtests/shared/regtests.h @@ -19,6 +19,9 @@ #define TS_OK 0 #define TS_FAILED 1 +static int _Result; +static char *_Buffer; + /* Macros to simplify tests */ #define DISPATCHER(FunctionName, TestName) \ int \ @@ -28,7 +31,10 @@ FunctionName(int Command, \ switch (Command) \ { \ case TESTCMD_RUN: \ - return RunTest(Buffer); \ + _Result = TS_OK; \ + _Buffer = Buffer; \ + RunTest(); \ + return _Result; \ case TESTCMD_TESTNAME: \ strcpy(Buffer, TestName); \ return TS_OK; \ @@ -50,6 +56,48 @@ FunctionName(int Command, \ #define FAIL_IF_LESS_EQUAL(GivenValue, FailValue, ErrorMessage) if (GivenValue <= FailValue) { FAIL(ErrorMessage); } #define FAIL_IF_GREATER_EQUAL(GivenValue, FailValue, ErrorMessage) if (GivenValue >= FailValue) { FAIL(ErrorMessage); } +static inline void AppendAssertion(char *message) +{ + if (strlen(_Buffer) != 0) + strcat(_Buffer, "\n"); + strcat(_Buffer, message); + _Result = TS_FAILED; +} + +#define _AssertEqualValue(_Expected, _Actual) \ +{ \ + if ((_Expected) != (_Actual)) \ + { \ + char _message[100]; \ + sprintf(_message, "Expected %d/0x%.08x was %d/0x%.08x at %s:%d", \ + (_Expected), (_Expected), (_Actual), (_Actual), __FILE__, __LINE__); \ + AppendAssertion(_message); \ + } \ +} + +#define _AssertEqualWideString(_Expected, _Actual) \ +{ \ + if (wcscmp((_Expected), (_Actual)) != 0) \ + { \ + char _message[100]; \ + sprintf(_message, "Expected %S was %S at %s:%d", \ + (_Expected), (_Actual), __FILE__, __LINE__); \ + AppendAssertion(_message); \ + } \ +} + +#define _AssertNotEqualValue(_Expected, _Actual) \ +{ \ + if ((_Expected) == (_Actual)) \ + { \ + char _message[100]; \ + sprintf(_message, "Actual value expected to be different from %d/0x%.08x at %s:%d", \ + (_Expected), (_Expected), __FILE__, __LINE__); \ + AppendAssertion(_message); \ + } \ +} + + /* * Test routine prototype * Command - The command to process @@ -135,7 +183,18 @@ FrameworkGetHookInternal(ULONG index) if (ExternalDependencies[index].FunctionAddress != NULL) return ExternalDependencies[index].FunctionAddress; + printf("Calling function '%s' in DLL '%s'.\n", + ExternalDependencies[index].FunctionName, + ExternalDependencies[index].FileName); + address = FrameworkGetFunction(&ExternalDependencies[index]); + + if (address == NULL) + { + printf("Function '%s' not found in DLL '%s'.\n", + ExternalDependencies[index].FunctionName, + ExternalDependencies[index].FileName); + } ExternalDependencies[index].FunctionAddress = address; return address; @@ -149,12 +208,12 @@ _SetHook(PCHAR name, PAPI_DESCRIPTION api; ULONG index; - for (index = 0; index <= MaxExternalDependency; index++) + for (index = 0; index < MaxExternalDependency; index++) { api = &ExternalDependencies[index]; if (strcmp(api->FunctionName, name) == 0) { - api->FunctionAddress = address; + api->MockFunctionAddress = address; return; } } @@ -172,8 +231,12 @@ _SetHooks(PHOOK hookTable) PHOOK hook; hook = &hookTable[0]; - _SetHook(hook->FunctionName, - hook->FunctionAddress); + while (hook->FunctionName != NULL) + { + _SetHook(hook->FunctionName, + hook->FunctionAddress); + hook++; + } } static inline VOID @@ -182,6 +245,23 @@ _UnsetHooks(PHOOK hookTable) PHOOK hook; hook = &hookTable[0]; - _SetHook(hook->FunctionName, - NULL); + while (hook->FunctionName != NULL) + { + _SetHook(hook->FunctionName, + NULL); + hook++; + } +} + +static inline VOID +_ResetAllHooks() +{ + PAPI_DESCRIPTION api; + ULONG index; + + for (index = 0; index < MaxExternalDependency; index++) + { + api = &ExternalDependencies[index]; + api->MockFunctionAddress = NULL; + } } diff --git a/reactos/regtests/win32base/.cvsignore b/reactos/regtests/win32base/.cvsignore deleted file mode 100755 index 4ffa79bea45..00000000000 --- a/reactos/regtests/win32base/.cvsignore +++ /dev/null @@ -1,8 +0,0 @@ -*.o -*.d -*.dll -*.coff -*.sym -*.map -_regtests.c -Makefile.tests diff --git a/reactos/regtests/win32base/Makefile b/reactos/regtests/win32base/Makefile deleted file mode 100755 index ec482903ad2..00000000000 --- a/reactos/regtests/win32base/Makefile +++ /dev/null @@ -1,26 +0,0 @@ -# $Id: Makefile,v 1.4 2004/03/09 22:08:04 chorns Exp $ - -PATH_TO_TOP = ../.. - -TARGET_NORC = yes - -TARGET_TYPE = dynlink - -TARGET_NAME = win32base - -TARGET_SDKLIBS = rtshared.a ntdll.a kernel32.a ws2_32.a - -TARGET_CFLAGS = -I../shared -Wall -Werror - -TARGET_BASE = 0x60000000 - -include Makefile.tests - -TARGET_OBJECTS = \ - _regtests.o \ - driver.o \ - $(addprefix tests/, $(TESTS)) - -include $(PATH_TO_TOP)/rules.mak - -include $(TOOLS_PATH)/helper.mk diff --git a/reactos/regtests/win32base/driver.c b/reactos/regtests/win32base/driver.c deleted file mode 100755 index 9b043d3adc2..00000000000 --- a/reactos/regtests/win32base/driver.c +++ /dev/null @@ -1,99 +0,0 @@ -/* - * PROJECT: ReactOS kernel - * FILE: regtests/win32base/driver.c - * PURPOSE: Win32 base services regression testing driver - * PROGRAMMER: Casper S. Hornstrup (chorns@users.sourceforge.net) - * UPDATE HISTORY: - * 06-07-2003 CSH Created - */ -#define NTOS_MODE_USER -#include -#include "regtests.h" - -PVOID -AllocateMemory(ULONG Size) -{ - return (PVOID) RtlAllocateHeap(RtlGetProcessHeap(), 0, Size); -} - - -VOID -FreeMemory(PVOID Base) -{ - RtlFreeHeap(RtlGetProcessHeap(), 0, 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(TestOutputRoutine OutputRoutine, LPSTR TestName) -{ - /* - * Private module regression tests in components already mapped - * (ntdll.dll, kernel32.dll, msvcrt.dll) - */ - /* FIXME: Need to pass TestName to the driver */ - RunPrivateTests(_T("ntdll.dll")); - - /* Other private module regression tests */ - - /* Cross-module regression tests */ - InitializeTests(); - RegisterTests(); - PerformTests(OutputRoutine, TestName); -} diff --git a/reactos/regtests/win32base/tests/.cvsignore b/reactos/regtests/win32base/tests/.cvsignore deleted file mode 100644 index 5761abcfdf0..00000000000 --- a/reactos/regtests/win32base/tests/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -*.o diff --git a/reactos/regtests/win32base/tests/ws2event.c b/reactos/regtests/win32base/tests/ws2event.c deleted file mode 100644 index 5619c10522c..00000000000 --- a/reactos/regtests/win32base/tests/ws2event.c +++ /dev/null @@ -1,127 +0,0 @@ -#include -#include -#include - -#include "regtests.h" - -static int RunTest(char *Buffer) -{ - const WSAEVENT* lphEvents; - WORD wVersionRequested; - WSAEVENT hEvent; - WSADATA wsaData; - DWORD ErrorCode; - int startup; - - /* Require WinSock 2.0 or later */ - wVersionRequested = MAKEWORD(2, 0); - startup = WSAStartup(wVersionRequested, &wsaData); - if (startup != 0) - { - sprintf(Buffer, "WSAStartup() failed with status %d", startup); - return TS_FAILED; - } - - /* Check if the WinSock version is 2.0 */ - if (LOBYTE(wsaData.wVersion) != 2 || HIBYTE(wsaData.wVersion) != 0) - { - strcpy(Buffer, "Winsock dll version is not 2.0 or higher"); - WSACleanup(); - return TS_FAILED; - } - - /* Create an event */ - hEvent = WSACreateEvent(); - if (hEvent == WSA_INVALID_EVENT) - { - sprintf(Buffer, "WSACreateEvent() failed with status %d", WSAGetLastError()); - WSACleanup(); - return TS_FAILED; - } - - /* Check that the state of the event defaults to non-signalled */ - lphEvents = &hEvent; - ErrorCode = WSAWaitForMultipleEvents(1, - lphEvents, - FALSE, - 0, - FALSE); - if (ErrorCode != WSA_WAIT_TIMEOUT) - { - sprintf(Buffer, "WSAWaitForMultipleEvents() has bad status %ld (should be WSA_WAIT_TIMEOUT (%ld))", - ErrorCode, WSA_WAIT_TIMEOUT); - WSACleanup(); - return TS_FAILED; - } - - if (!WSASetEvent(hEvent)) - { - sprintf(Buffer, "WSASetEvent() failed with status %d", WSAGetLastError()); - WSACleanup(); - return TS_FAILED; - } - - /* Check that the state of the event is now signalled */ - lphEvents = &hEvent; - ErrorCode = WSAWaitForMultipleEvents(1, - lphEvents, - FALSE, - 0, - FALSE); - if (ErrorCode != WSA_WAIT_EVENT_0) - { - sprintf(Buffer, "WSAWaitForMultipleEvents() has bad status %ld (should be WSA_WAIT_EVENT_0 (%ld))", - ErrorCode, WSA_WAIT_EVENT_0); - WSACleanup(); - return TS_FAILED; - } - - if (!WSAResetEvent(hEvent)) - { - sprintf(Buffer, "WSAResetEvent() failed with status %d", WSAGetLastError()); - WSACleanup(); - return TS_FAILED; - } - - /* Check that the state of the event is now non-signalled */ - lphEvents = &hEvent; - ErrorCode = WSAWaitForMultipleEvents(1, - lphEvents, - FALSE, - 0, - FALSE); - if (ErrorCode != WSA_WAIT_TIMEOUT) - { - /*sprintf(Buffer, "WSAWaitForMultipleEvents() now has bad status %d (should be WSA_WAIT_TIMEOUT (%d))", - ErrorCode, WSA_WAIT_TIMEOUT);*/ - WSACleanup(); - return TS_FAILED; - } - - if (!WSACloseEvent(hEvent)) - { - sprintf(Buffer, "WSACloseEvent() failed with status %d", WSAGetLastError()); - WSACleanup(); - return TS_FAILED; - } - - WSACleanup(); - - return TS_OK; -} - -int -Ws2eventTest(int Command, char *Buffer) -{ - switch (Command) - { - case TESTCMD_RUN: - return RunTest(Buffer); - case TESTCMD_TESTNAME: - strcpy(Buffer, "Winsock 2 event"); - return TS_OK; - default: - break; - } - return TS_FAILED; -} diff --git a/reactos/regtests/win32base/win32base.def b/reactos/regtests/win32base/win32base.def deleted file mode 100755 index 40c09bb895b..00000000000 --- a/reactos/regtests/win32base/win32base.def +++ /dev/null @@ -1,3 +0,0 @@ -LIBRARY win32base.dll -EXPORTS -RegTestMain@8 diff --git a/reactos/subsys/win32k/makefile b/reactos/subsys/win32k/makefile index 11bc6d48450..dcf5f964b95 100644 --- a/reactos/subsys/win32k/makefile +++ b/reactos/subsys/win32k/makefile @@ -1,4 +1,4 @@ -# $Id: makefile,v 1.102 2004/07/19 04:52:24 ion Exp $ +# $Id: makefile,v 1.103 2004/10/18 19:11:09 chorns Exp $ PATH_TO_TOP = ../.. @@ -16,6 +16,8 @@ TARGET_DDKLIBS = freetype.a TARGET_REGTESTS = yes +TARGET_BUILDENV_TEST = yes + FREETYPE_DIR = $(PATH_TO_TOP)/lib/freetype include $(PATH_TO_TOP)/config diff --git a/reactos/subsys/win32k/tests/makefile b/reactos/subsys/win32k/tests/makefile index 3beaf27bb8b..08d813444ae 100644 --- a/reactos/subsys/win32k/tests/makefile +++ b/reactos/subsys/win32k/tests/makefile @@ -13,10 +13,19 @@ TARGET_CFLAGS = -I$(REGTESTS_PATH_INC) \ -include Makefile.tests TARGET_OBJECTS = \ + _rtstub.o \ _regtests.o \ + _hooks.o \ + _stubs.o \ $(addprefix tests/, $(TESTS)) include $(PATH_TO_TOP)/rules.mak include $(TOOLS_PATH)/helper.mk +LIBS = ../win32k.a + +run: all + @$(CC) -o _runtest.exe _rtstub.o regtests.a $(SDK_PATH_LIB)/rtshared.a $(LIBS) -lntdll + @_runtest.exe + @$(RM) _runtest.exe diff --git a/reactos/subsys/win32k/tests/stubs.tst b/reactos/subsys/win32k/tests/stubs.tst new file mode 100644 index 00000000000..e69de29bb2d diff --git a/reactos/subsys/win32k/tests/tests/eng-mem-1.c b/reactos/subsys/win32k/tests/tests/eng-mem-1.c index e2ee59c91dc..9e45aefc1ba 100644 --- a/reactos/subsys/win32k/tests/tests/eng-mem-1.c +++ b/reactos/subsys/win32k/tests/tests/eng-mem-1.c @@ -3,8 +3,9 @@ #include "regtests.h" -static int RunTest(char *Buffer) +static void RunTest() { +#if 0 VOID *pmem1, *pmem2; ULONG AllocSize1, AllocSize2; ULONG AllocTag1, AllocTag2; @@ -15,21 +16,21 @@ static int RunTest(char *Buffer) AllocSize1 = 1024; AllocTag1 = TAG('D','x','y','z'); pmem1 = EngAllocMem(FL_ZERO_MEMORY, AllocSize1, AllocTag1); - FAIL_IF_EQUAL(pmem1, 0, "EngAllocMem() for pmem1 failed"); + _AssertNotEqualValue(pmem1, NULL); /* Allocate memory with EngAllocMem */ pmem2 = 0; AllocSize2 = 1024; AllocTag2 = TAG('D','x','y','z'); pmem2 = EngAllocUserMem(AllocSize2, AllocTag2); - FAIL_IF_EQUAL(pmem1, 0, "EngAllocUserMem() for pmem2 failed"); + _AssertNotEqualValue(pmem1, NULL); /* Lock down memory with EngSecureMem ** Dependant functions in ntoskrnl.exe are currently unimplemented Handle1 = EngSecureMem(pmem1, AllocSize1); - FAIL_IF_NULL(pmem1, "EngSecureMem() for pmem1 failed"); + _AssertNotEqualValue(pmem1, NULL); Handle2 = EngSecureMem(pmem2, AllocSize2); - FAIL_IF_NULL(pmem2, "EngSecureMem() for pmem2 failed"); */ + _AssertNotEqualValue(pmem2, NULL); /* Unlock down memory with EngSecureMem ** Dependant functions in ntoskrnl.exe are currently unimplemented @@ -41,8 +42,7 @@ static int RunTest(char *Buffer) /* Free memory with EngFreeUserMem */ EngFreeUserMem(pmem2); - - return TS_OK; +#endif } DISPATCHER(Eng_mem_1Test, "Win32k Engine Memory API") diff --git a/reactos/tools/helper.mk b/reactos/tools/helper.mk index 54fffc33d5d..efff99b97de 100644 --- a/reactos/tools/helper.mk +++ b/reactos/tools/helper.mk @@ -1,4 +1,4 @@ -# $Id: helper.mk,v 1.86 2004/10/04 20:04:49 chorns Exp $ +# $Id: helper.mk,v 1.87 2004/10/18 19:11:09 chorns Exp $ # # Helper makefile for ReactOS modules # Variables this makefile accepts: @@ -653,6 +653,10 @@ else endif ifeq ($(TARGET_REGTESTS),yes) +ifeq ($(TARGET_BUILDENV_TEST),yes) + REGTEST_TARGETS := tests/_hooks.c tests/_regtests.c tests/_stubs.S tests/Makefile.tests tests/_rtstub.c + MK_REGTESTS_CLEAN := clean_regtests +else REGTEST_TARGETS := tests/_regtests.c tests/Makefile.tests tests/_rtstub.c ifeq ($(MK_MODE),user) MK_LIBS := $(SDK_PATH_LIB)/rtshared.a $(MK_LIBS) @@ -660,6 +664,7 @@ endif MK_REGTESTS_CLEAN := clean_regtests MK_OBJECTS += tests/_rtstub.o tests/regtests.a TARGET_CFLAGS += -I$(REGTESTS_PATH_INC) +endif else REGTEST_TARGETS := MK_REGTESTS_CLEAN := @@ -794,7 +799,10 @@ else MK_EXTRACMD := endif -$(MK_NOSTRIPNAME): $(MK_EXTRADEP) $(MK_FULLRES) $(MK_OBJECTS) $(MK_LIBS) +$(MK_BASENAME).a: $(MK_OBJECTS) + $(AR) -r $(MK_BASENAME).a $(MK_OBJECTS) + +$(MK_NOSTRIPNAME): $(MK_EXTRADEP) $(MK_FULLRES) $(MK_BASENAME).a $(MK_LIBS) $(LD_CC) -Wl,--base-file,base.tmp \ -Wl,--entry,$(TARGET_ENTRY) \ $(TARGET_LFLAGS) \ @@ -822,7 +830,7 @@ else $(NM) --numeric-sort $(MK_NOSTRIPNAME) > $(MK_BASENAME).map endif -$(MK_FULLNAME): $(MK_EXTRADEP) $(MK_FULLRES) $(MK_OBJECTS) $(MK_LIBS) $(MK_NOSTRIPNAME) +$(MK_FULLNAME): $(MK_EXTRADEP) $(MK_FULLRES) $(MK_BASENAME).a $(MK_LIBS) $(MK_NOSTRIPNAME) - ifneq ($(TARGET_CPPAPP),yes) $(LD) --strip-debug -r -o $(MK_STRIPPED_OBJECT) $(MK_OBJECTS) @@ -1000,13 +1008,12 @@ endif REGTEST_TESTS = $(wildcard tests/tests/*.c) $(REGTEST_TARGETS): $(REGTEST_TESTS) -ifeq ($(MK_MODE),user) ifeq ($(TARGET_BUILDENV_TEST),yes) $(REGTESTS) ./tests/tests ./tests/_regtests.c ./tests/Makefile.tests -e ./tests/_rtstub.c $(REGTESTS) -s ./tests/stubs.tst ./tests/_stubs.S ./tests/_hooks.c else +ifeq ($(MK_MODE),user) $(REGTESTS) ./tests/tests ./tests/_regtests.c ./tests/Makefile.tests -u ./tests/_rtstub.c -endif $(MAKE) -C tests TARGET_REGTESTS=no all else ifeq ($(MK_MODE),kernel) @@ -1014,10 +1021,16 @@ ifeq ($(MK_MODE),kernel) $(MAKE) -C tests TARGET_REGTESTS=no all endif endif +endif clean_regtests: +ifeq ($(TARGET_BUILDENV_TEST),yes) + - $(MAKE) -C tests TARGET_REGTESTS=no clean + - $(RM) ./tests/_rtstub.c ./tests/_hooks.c ./tests/_regtests.c ./tests/_stubs.S ./tests/Makefile.tests +else $(MAKE) -C tests TARGET_REGTESTS=no clean $(RM) ./tests/_rtstub.c ./tests/_regtests.c ./tests/_hooks.c ./tests/_stubs.S ./tests/Makefile.tests +endif .PHONY: all depends implib clean install dist bootcd depends gen_regtests clean_regtests diff --git a/reactos/tools/regtests.c b/reactos/tools/regtests.c index 5a70d38c193..fe9ad7f38cd 100755 --- a/reactos/tools/regtests.c +++ b/reactos/tools/regtests.c @@ -539,20 +539,13 @@ static char EXESTUB[] = " printf(Buffer);\n" "}\n" "\n" - "ULONG\n" - "DbgPrint(PCH Format, ...)\n" - "{\n" - " return 0;\n" - "}\n" - "\n" - "int __stdcall WinMain(HINSTANCE hInstance,\n" - " HINSTANCE hPrevInstance,\n" - " LPSTR lpCmdLine,\n" - " int nCmdShow)\n" + "int\n" + "main()\n" "{\n" " InitializeTests();\n" " RegisterTests();\n" " PerformTests(ConsoleWrite, NULL);\n" + " NtTerminateProcess (NtCurrentProcess(), 0);\n" " return 0;\n" "}\n";