mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 01:24:38 +00:00
2004-03-09 Casper S. Hornstrup <chorns@users.sourceforge.net>
* regtests/Makefile: Make REGTEST_TARGETS depend on *.c. * regtests/kmregtests/driver.c: Update call to PerformTests(). * regtests/kmrtint/kmrtint.c (RegTestMain): Update to match prototype. * regtests/kmrtint/kmrtint.def (RegTestMain): Ditto. * regtests/kmrtint/kmrtint.edf (RegTestMain): Ditto. * regtests/win32base/tests/ws2event.c: New file. * regtests/regtests/regtests.c (OUPUT_MODE_DbgPrint, OUPUT_MODE_OutputDebugString, OUPUT_MODE_printf): Define. (OutputMode): New variable. (OutputRoutine): New function. (RunTestDriver): Add TestName parameter. (main): Parse command line to find output routine and test name. * regtests/shared/regtests.c (PerformTest): Use specified output routine if specified. Run only specified test if specified. (PerformTests): Update call to PerformTest(). * regtests/shared/regtests.h (TestOutputRoutine): Add prototype. (TestDriverMain): Add OutputRoutine and TestName parameter. (PerformTests): Ditto. * regtests/win32base/Makefile (TARGET_SDKLIBS): Add ws2_32.a. * regtests/win32base/driver.c (RegTestMain): Update to match prototype. * regtests/win32base/win32base.def (RegTestMain): Ditto. * regtests/win32base/win32base.edf (RegTestMain): Ditto. * tools/regtests.c (UMSTUB): Update call to PerformTests(). svn path=/trunk/; revision=8617
This commit is contained in:
parent
6616abd532
commit
e2b29d7f6c
15 changed files with 273 additions and 35 deletions
|
@ -1,3 +1,29 @@
|
|||
2004-03-09 Casper S. Hornstrup <chorns@users.sourceforge.net>
|
||||
|
||||
* regtests/Makefile: Make REGTEST_TARGETS depend on *.c.
|
||||
* regtests/kmregtests/driver.c: Update call to PerformTests().
|
||||
* regtests/kmrtint/kmrtint.c (RegTestMain): Update to match prototype.
|
||||
* regtests/kmrtint/kmrtint.def (RegTestMain): Ditto.
|
||||
* regtests/kmrtint/kmrtint.edf (RegTestMain): Ditto.
|
||||
* regtests/win32base/tests/ws2event.c: New file.
|
||||
* regtests/regtests/regtests.c (OUPUT_MODE_DbgPrint,
|
||||
OUPUT_MODE_OutputDebugString, OUPUT_MODE_printf): Define.
|
||||
(OutputMode): New variable.
|
||||
(OutputRoutine): New function.
|
||||
(RunTestDriver): Add TestName parameter.
|
||||
(main): Parse command line to find output routine and test name.
|
||||
* regtests/shared/regtests.c (PerformTest): Use specified output routine
|
||||
if specified. Run only specified test if specified.
|
||||
(PerformTests): Update call to PerformTest().
|
||||
* regtests/shared/regtests.h (TestOutputRoutine): Add prototype.
|
||||
(TestDriverMain): Add OutputRoutine and TestName parameter.
|
||||
(PerformTests): Ditto.
|
||||
* regtests/win32base/Makefile (TARGET_SDKLIBS): Add ws2_32.a.
|
||||
* regtests/win32base/driver.c (RegTestMain): Update to match prototype.
|
||||
* regtests/win32base/win32base.def (RegTestMain): Ditto.
|
||||
* regtests/win32base/win32base.edf (RegTestMain): Ditto.
|
||||
* tools/regtests.c (UMSTUB): Update call to PerformTests().
|
||||
|
||||
2004-03-04 Casper S. Hornstrup <chorns@users.sourceforge.net>
|
||||
|
||||
* drivers/net/tcpip/tcpip/i386: New directory.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $Id: Makefile,v 1.3 2004/02/22 18:53:39 dwelch Exp $
|
||||
# $Id: Makefile,v 1.4 2004/03/09 22:08:04 chorns Exp $
|
||||
|
||||
PATH_TO_TOP = ..
|
||||
|
||||
|
@ -27,7 +27,7 @@ install:
|
|||
$(MAKE) -C kmrtint install
|
||||
$(MAKE) -C regtests install
|
||||
|
||||
$(REGTEST_TARGETS): kmregtests/tests/* win32base/tests/*
|
||||
$(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
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ KMRegTestsRun(
|
|||
PIRP Irp,
|
||||
PIO_STACK_LOCATION IrpSp)
|
||||
{
|
||||
PerformTests();
|
||||
PerformTests(NULL, NULL);
|
||||
ShutdownBochs();
|
||||
|
||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||
|
|
|
@ -53,7 +53,7 @@ OpenDevice()
|
|||
}
|
||||
|
||||
VOID STDCALL
|
||||
RegTestMain()
|
||||
RegTestMain(TestOutputRoutine OutputRoutine, LPSTR TestName)
|
||||
{
|
||||
IO_STATUS_BLOCK Iosb;
|
||||
HANDLE DeviceHandle;
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
LIBRARY kmrtint.dll
|
||||
EXPORTS
|
||||
RegTestMain@0
|
||||
RegTestMain@8
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
LIBRARY kmrtint.dll
|
||||
EXPORTS
|
||||
RegTestMain=RegTestMain@0
|
||||
RegTestMain=RegTestMain@8
|
||||
|
|
|
@ -7,11 +7,34 @@
|
|||
* 06-07-2003 CSH Created
|
||||
*/
|
||||
#define NTOS_MODE_USER
|
||||
#include <stdio.h>
|
||||
#include <ntos.h>
|
||||
#include "regtests.h"
|
||||
|
||||
VOID
|
||||
RunTestDriver(LPTSTR FileName)
|
||||
#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;
|
||||
|
@ -20,9 +43,9 @@ RunTestDriver(LPTSTR FileName)
|
|||
if (hModule != NULL)
|
||||
{
|
||||
Main = (TestDriverMain) GetProcAddress(hModule, "RegTestMain");
|
||||
if (Main != NULL)
|
||||
if (Main != NULL)
|
||||
{
|
||||
(Main)();
|
||||
(Main)(OutputRoutine, TestName);
|
||||
}
|
||||
FreeLibrary(hModule);
|
||||
}
|
||||
|
@ -31,7 +54,36 @@ RunTestDriver(LPTSTR FileName)
|
|||
int
|
||||
main(int argc, char* argv[])
|
||||
{
|
||||
RunTestDriver("win32base.dll");
|
||||
RunTestDriver("kmrtint.dll");
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
* 06-07-2003 CSH Created
|
||||
*/
|
||||
#include <roscfg.h>
|
||||
#include <stdio.h>
|
||||
#define NTOS_MODE_USER
|
||||
#include <ntos.h>
|
||||
#include "regtests.h"
|
||||
|
@ -40,18 +41,31 @@ InitializeTests()
|
|||
}
|
||||
|
||||
VOID
|
||||
PerformTest(PROS_TEST Test)
|
||||
PerformTest(TestOutputRoutine OutputRoutine, PROS_TEST Test, LPSTR TestName)
|
||||
{
|
||||
char TestName[200];
|
||||
char OutputBuffer[200];
|
||||
char Buffer[200];
|
||||
char Name[200];
|
||||
int Result;
|
||||
|
||||
memset(TestName, 0, sizeof(TestName));
|
||||
memset(Name, 0, sizeof(Name));
|
||||
memset(Buffer, 0, sizeof(Buffer));
|
||||
|
||||
if (!((Test->Routine)(TESTCMD_TESTNAME, TestName) == 0))
|
||||
if (!((Test->Routine)(TESTCMD_TESTNAME, Name) == 0))
|
||||
{
|
||||
strcpy(TestName, "Unnamed");
|
||||
if (TestName != NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
strcpy(Name, "Unnamed");
|
||||
}
|
||||
|
||||
if (TestName != NULL)
|
||||
{
|
||||
if (_stricmp(Name, TestName) != 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef SEH
|
||||
|
@ -67,16 +81,24 @@ PerformTest(PROS_TEST Test)
|
|||
|
||||
if (Result != TS_OK)
|
||||
{
|
||||
DbgPrint("ROSREGTEST: (%s) Status: Failed (%s)\n", TestName, Buffer);
|
||||
sprintf(OutputBuffer, "ROSREGTEST: (%s) Status: Failed (%s)\n", Name, Buffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
DbgPrint("ROSREGTEST: (%s) Status: Success\n", TestName);
|
||||
sprintf(OutputBuffer, "ROSREGTEST: (%s) Status: Success\n", Name);
|
||||
}
|
||||
if (OutputRoutine != NULL)
|
||||
{
|
||||
(*OutputRoutine)(OutputBuffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
DbgPrint(OutputBuffer);
|
||||
}
|
||||
}
|
||||
|
||||
VOID
|
||||
PerformTests()
|
||||
PerformTests(TestOutputRoutine OutputRoutine, LPSTR TestName)
|
||||
{
|
||||
PLIST_ENTRY CurrentEntry;
|
||||
PLIST_ENTRY NextEntry;
|
||||
|
@ -87,7 +109,7 @@ PerformTests()
|
|||
{
|
||||
NextEntry = CurrentEntry->Flink;
|
||||
Current = CONTAINING_RECORD(CurrentEntry, ROS_TEST, ListEntry);
|
||||
PerformTest(Current);
|
||||
PerformTest(OutputRoutine, Current, TestName);
|
||||
CurrentEntry = NextEntry;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,8 +24,18 @@
|
|||
*/
|
||||
typedef int (*TestRoutine)(int Command, char *Buffer);
|
||||
|
||||
/* Test driver entry routine */
|
||||
typedef VOID STDCALL (*TestDriverMain)();
|
||||
/*
|
||||
* Test output routine prototype
|
||||
* Buffer - Address of buffer with text to output
|
||||
*/
|
||||
typedef void (*TestOutputRoutine)(char *Buffer);
|
||||
|
||||
/*
|
||||
* Test driver entry routine.
|
||||
* OutputRoutine - Output routine.
|
||||
* TestName - If NULL all tests are run. If non-NULL specifies the test to be run
|
||||
*/
|
||||
typedef void STDCALL (*TestDriverMain)(TestOutputRoutine OutputRoutine, char *TestName);
|
||||
|
||||
typedef struct _ROS_TEST
|
||||
{
|
||||
|
@ -37,7 +47,7 @@ extern LIST_ENTRY AllTests;
|
|||
|
||||
extern VOID InitializeTests();
|
||||
extern VOID RegisterTests();
|
||||
extern VOID PerformTests();
|
||||
extern VOID PerformTests(TestOutputRoutine OutputRoutine, LPSTR TestName);
|
||||
|
||||
/* Routines provided by the driver */
|
||||
extern PVOID AllocateMemory(ULONG Size);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $Id: Makefile,v 1.3 2003/12/07 11:34:41 chorns Exp $
|
||||
# $Id: Makefile,v 1.4 2004/03/09 22:08:04 chorns Exp $
|
||||
|
||||
PATH_TO_TOP = ../..
|
||||
|
||||
|
@ -8,7 +8,7 @@ TARGET_TYPE = dynlink
|
|||
|
||||
TARGET_NAME = win32base
|
||||
|
||||
TARGET_SDKLIBS = rtshared.a ntdll.a kernel32.a
|
||||
TARGET_SDKLIBS = rtshared.a ntdll.a kernel32.a ws2_32.a
|
||||
|
||||
TARGET_CFLAGS = -I../shared -Wall -Werror
|
||||
|
||||
|
|
|
@ -55,15 +55,15 @@ RunPrivateTests(LPTSTR FileName)
|
|||
/*
|
||||
* 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.
|
||||
* 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);
|
||||
ErrorCode = WaitForSingleObject(hEvent, 5000); /* Wait up to 5 seconds */
|
||||
CloseHandle(hThread);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -81,12 +81,13 @@ RunPrivateTests(LPTSTR FileName)
|
|||
|
||||
|
||||
VOID STDCALL
|
||||
RegTestMain()
|
||||
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 */
|
||||
|
@ -94,5 +95,5 @@ RegTestMain()
|
|||
/* Cross-module regression tests */
|
||||
InitializeTests();
|
||||
RegisterTests();
|
||||
PerformTests();
|
||||
PerformTests(OutputRoutine, TestName);
|
||||
}
|
||||
|
|
127
reactos/regtests/win32base/tests/ws2event.c
Normal file
127
reactos/regtests/win32base/tests/ws2event.c
Normal file
|
@ -0,0 +1,127 @@
|
|||
#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;
|
||||
}
|
|
@ -1,3 +1,3 @@
|
|||
LIBRARY win32base.dll
|
||||
EXPORTS
|
||||
RegTestMain@0
|
||||
RegTestMain@8
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
LIBRARY win32base.dll
|
||||
EXPORTS
|
||||
RegTestMain=RegTestMain@0
|
||||
RegTestMain=RegTestMain@8
|
||||
|
|
|
@ -480,7 +480,7 @@ static char UMSTUB[] =
|
|||
" testsRegistered = 1;\n"
|
||||
" InitializeTests();\n"
|
||||
" RegisterTests();\n"
|
||||
" PerformTests();\n"
|
||||
" PerformTests(NULL, NULL);\n"
|
||||
" }\n"
|
||||
" }\n"
|
||||
"}\n";
|
||||
|
|
Loading…
Reference in a new issue