* 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
+2004-10-18 Casper S. Hornstrup <chorns@users.sourceforge.net>
+
+ * 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 <chorns@users.sourceforge.net>
* tools/helper.mk: Support for kernel TARGET_TYPE.
-# $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
-# $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 = ../../../..
-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
-# $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 = ../..
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
-include Makefile.tests
TARGET_OBJECTS = \
+ _rtstub.o \
_regtests.o \
_hooks.o \
_stubs.o \
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
-ntdll.dll RtlAllocateHeap@12
-ntdll.dll RtlFreeHeap@12
-msvcrt.dll printf
#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")
-# $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
-# $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 = ../../..
-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
--- /dev/null
+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
--- /dev/null
+#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")
+++ /dev/null
-#include <windows.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
-#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;
-}
-# $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
+++ /dev/null
-*.o
-*.d
-*.exe
-*.coff
-*.sym
-*.sys
-*.map
-_regtests.c
-*.sys
-Makefile.tests
+++ /dev/null
-# $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
+++ /dev/null
-/*
- * 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 <ntos.h>
-#include "regtests.h"
-#include "kmregtests.h"
-
-#define NDEBUG
-#include <debug.h>
-
-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;
-}
+++ /dev/null
-/*
- * 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 <ntos.h>
-
-/* 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)
+++ /dev/null
-#include <ddk/ntddk.h>
-#include <ddk/ntifs.h>
-#include <windows.h>
-
-#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")
+++ /dev/null
-#include <ddk/ntddk.h>
-#include <windows.h>
-
-#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)")
+++ /dev/null
-#include <ddk/ntddk.h>
-#include <windows.h>
-
-#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)")
+++ /dev/null
-#include <ddk/ntddk.h>
-#include <windows.h>
-
-#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")
+++ /dev/null
-*.o
-*.d
-*.dll
-*.coff
-*.sym
-*.map
+++ /dev/null
-# $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
+++ /dev/null
-/*
- * 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 <ntos.h>
-#include "regtests.h"
-#include "kmregtests.h"
-
-#define NDEBUG
-#include <debug.h>
-
-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");
- }
-}
+++ /dev/null
-LIBRARY kmrtint.dll
-EXPORTS
-RegTestMain@8
+++ /dev/null
-*.o
-*.d
-*.exe
-*.coff
-*.sym
-*.map
+++ /dev/null
-# $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
+++ /dev/null
-/*
- * 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 <stdio.h>
-#include <ntos.h>
-#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;
-}
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;
#define TS_OK 0
#define TS_FAILED 1
+static int _Result;
+static char *_Buffer;
+
/* Macros to simplify tests */
#define DISPATCHER(FunctionName, TestName) \
int \
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; \
#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
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;
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;
}
}
PHOOK hook;
hook = &hookTable[0];
- _SetHook(hook->FunctionName,
- hook->FunctionAddress);
+ while (hook->FunctionName != NULL)
+ {
+ _SetHook(hook->FunctionName,
+ hook->FunctionAddress);
+ hook++;
+ }
}
static inline VOID
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;
+ }
}
+++ /dev/null
-*.o
-*.d
-*.dll
-*.coff
-*.sym
-*.map
-_regtests.c
-Makefile.tests
+++ /dev/null
-# $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
+++ /dev/null
-/*
- * 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 <ntos.h>
-#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);
-}
+++ /dev/null
-#include <stdio.h>
-#include <windows.h>
-#include <winsock2.h>
-
-#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;
-}
+++ /dev/null
-LIBRARY win32base.dll
-EXPORTS
-RegTestMain@8
-# $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 = ../..
TARGET_REGTESTS = yes
+TARGET_BUILDENV_TEST = yes
+
FREETYPE_DIR = $(PATH_TO_TOP)/lib/freetype
include $(PATH_TO_TOP)/config
-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
#include "regtests.h"
-static int RunTest(char *Buffer)
+static void RunTest()
{
+#if 0
VOID *pmem1, *pmem2;
ULONG AllocSize1, AllocSize2;
ULONG AllocTag1, AllocTag2;
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
/* Free memory with EngFreeUserMem */
EngFreeUserMem(pmem2);
-
- return TS_OK;
+#endif
}
DISPATCHER(Eng_mem_1Test, "Win32k Engine Memory API")
-# $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:
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)
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 :=
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) \
$(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)
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)
$(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
" 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";