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

* lib/gdiplus/makefile (TARGET_BUILDENV_TEST): Remove.
	(TARGET_TYPE): Set to test.
	* lib/kernel32/makefile: Ditto.
	* subsys/win32k/makefile: Ditto.
	* tools/helper.mk (TARGET_BUILDENV_TEST): Remove.
	(TARGET_TYPE): New value test.
	* regtests/shared/regtests.c (_Result, _Buffer): Add.
	* regtests/shared/regtests.h (_Result, _Buffer): Declare extern.
	(TestRoutine): Make void return type and remove Buffer parameter.
	(FAIL*): Remove.

svn path=/trunk/; revision=11356
This commit is contained in:
Casper Hornstrup 2004-10-20 20:51:21 +00:00
parent 8139ac2333
commit e1a7bb0d2f
11 changed files with 84 additions and 105 deletions

View file

@ -1,3 +1,16 @@
2004-10-20 Casper S. Hornstrup <chorns@users.sourceforge.net>
* lib/gdiplus/makefile (TARGET_BUILDENV_TEST): Remove.
(TARGET_TYPE): Set to test.
* lib/kernel32/makefile: Ditto.
* subsys/win32k/makefile: Ditto.
* tools/helper.mk (TARGET_BUILDENV_TEST): Remove.
(TARGET_TYPE): New value test.
* regtests/shared/regtests.c (_Result, _Buffer): Add.
* regtests/shared/regtests.h (_Result, _Buffer): Declare extern.
(TestRoutine): Make void return type and remove Buffer parameter.
(FAIL*): Remove.
2004-10-18 Casper S. Hornstrup <chorns@users.sourceforge.net> 2004-10-18 Casper S. Hornstrup <chorns@users.sourceforge.net>
* lib/kernel32/makefile (TARGET_BUILDENV_TEST): Set to yes. * lib/kernel32/makefile (TARGET_BUILDENV_TEST): Set to yes.

View file

@ -2,8 +2,6 @@ PATH_TO_TOP = ../..
TARGET_REGTESTS = yes TARGET_REGTESTS = yes
TARGET_BUILDENV_TEST = yes
TARGET_TYPE = dynlink TARGET_TYPE = dynlink
TARGET_NAME = gdiplus TARGET_NAME = gdiplus

View file

@ -1,6 +1,6 @@
PATH_TO_TOP = ../../.. PATH_TO_TOP = ../../..
TARGET_TYPE = library TARGET_TYPE = test
TARGET_NAME = regtests TARGET_NAME = regtests
@ -17,6 +17,8 @@ TARGET_CFLAGS = \
-D_WIN32_WINNT=0x0501 \ -D_WIN32_WINNT=0x0501 \
-I$(REGTESTS_PATH_INC) -I$(REGTESTS_PATH_INC)
TARGET_LIBS = ../gdiplus.a
-include Makefile.tests -include Makefile.tests
TARGET_OBJECTS = \ TARGET_OBJECTS = \
@ -29,10 +31,3 @@ TARGET_OBJECTS = \
include $(PATH_TO_TOP)/rules.mak include $(PATH_TO_TOP)/rules.mak
include $(TOOLS_PATH)/helper.mk include $(TOOLS_PATH)/helper.mk
LIBS = ../gdiplus.a
run: all
@$(CC) -o _runtest.exe _rtstub.o regtests.a $(SDK_PATH_LIB)/rtshared.a $(LIBS) -lntdll
@_runtest.exe
@$(RM) _runtest.exe

View file

@ -1,11 +1,9 @@
# $Id: makefile,v 1.88 2004/10/18 19:11:07 chorns Exp $ # $Id: makefile,v 1.89 2004/10/20 20:51:21 chorns Exp $
PATH_TO_TOP = ../.. PATH_TO_TOP = ../..
TARGET_REGTESTS = yes TARGET_REGTESTS = yes
TARGET_BUILDENV_TEST = yes
TARGET_TYPE = dynlink TARGET_TYPE = dynlink
TARGET_NAME = kernel32 TARGET_NAME = kernel32

View file

@ -1,8 +1,8 @@
# $Id: Makefile,v 1.2 2004/10/18 19:11:07 chorns Exp $ # $Id: Makefile,v 1.3 2004/10/20 20:51:21 chorns Exp $
PATH_TO_TOP = ../../.. PATH_TO_TOP = ../../..
TARGET_TYPE = library TARGET_TYPE = test
TARGET_NAME = regtests TARGET_NAME = regtests
@ -10,6 +10,8 @@ TARGET_LIBPATH = .
TARGET_CFLAGS = -I$(REGTESTS_PATH_INC) TARGET_CFLAGS = -I$(REGTESTS_PATH_INC)
TARGET_LIBS = ../kernel32.a
-include Makefile.tests -include Makefile.tests
TARGET_OBJECTS = \ TARGET_OBJECTS = \
@ -22,10 +24,3 @@ TARGET_OBJECTS = \
include $(PATH_TO_TOP)/rules.mak include $(PATH_TO_TOP)/rules.mak
include $(TOOLS_PATH)/helper.mk 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

View file

@ -115,7 +115,7 @@ static void TestFile()
_AssertEqualValue(NO_ERROR, GetLastError()); _AssertEqualValue(NO_ERROR, GetLastError());
_AssertEqualValue(TestHandle, FileHandle); _AssertEqualValue(TestHandle, FileHandle);
} }
_ResetAllHooks(); _UnsetAllHooks();
} }
static void RunTest() static void RunTest()

View file

@ -18,7 +18,10 @@
#define NDEBUG #define NDEBUG
#include <debug.h> #include <debug.h>
LIST_ENTRY AllTests; int _Result;
char *_Buffer;
static LIST_ENTRY AllTests;
int int
DriverTest() DriverTest()
@ -48,12 +51,14 @@ PerformTest(TestOutputRoutine OutputRoutine, PROS_TEST Test, LPSTR TestName)
char OutputBuffer[5000]; char OutputBuffer[5000];
char Buffer[5000]; char Buffer[5000];
char Name[200]; char Name[200];
int Result;
memset(Name, 0, sizeof(Name));
memset(Buffer, 0, sizeof(Buffer)); memset(Buffer, 0, sizeof(Buffer));
memset(Name, 0, sizeof(Name));
if (!((Test->Routine)(TESTCMD_TESTNAME, Name) == 0)) _Result = TS_OK;
_Buffer = Name;
(Test->Routine)(TESTCMD_TESTNAME);
if (_Result != TS_OK)
{ {
if (TestName != NULL) if (TestName != NULL)
{ {
@ -73,7 +78,9 @@ PerformTest(TestOutputRoutine OutputRoutine, PROS_TEST Test, LPSTR TestName)
#ifdef SEH #ifdef SEH
__try { __try {
#endif #endif
Result = (Test->Routine)(TESTCMD_RUN, Buffer); _Result = TS_OK;
_Buffer = Buffer;
(Test->Routine)(TESTCMD_RUN);
#ifdef SEH #ifdef SEH
} __except(EXCEPTION_EXECUTE_HANDLER) { } __except(EXCEPTION_EXECUTE_HANDLER) {
Result = TS_FAILED; Result = TS_FAILED;
@ -81,7 +88,7 @@ PerformTest(TestOutputRoutine OutputRoutine, PROS_TEST Test, LPSTR TestName)
} }
#endif #endif
if (Result != TS_OK) if (_Result != TS_OK)
{ {
sprintf(OutputBuffer, "ROSREGTEST: |%s| Status: Failed (%s)\n", Name, Buffer); sprintf(OutputBuffer, "ROSREGTEST: |%s| Status: Failed (%s)\n", Name, Buffer);
} }

View file

@ -19,44 +19,30 @@
#define TS_OK 0 #define TS_OK 0
#define TS_FAILED 1 #define TS_FAILED 1
static int _Result; extern int _Result;
static char *_Buffer; extern char *_Buffer;
/* Macros to simplify tests */ /* Macros to simplify tests */
#define DISPATCHER(FunctionName, TestName) \ #define DISPATCHER(FunctionName, TestName) \
int \ void \
FunctionName(int Command, \ FunctionName(int Command) \
char *Buffer) \
{ \ { \
switch (Command) \ switch (Command) \
{ \ { \
case TESTCMD_RUN: \ case TESTCMD_RUN: \
_Result = TS_OK; \ RunTest(); \
_Buffer = Buffer; \ break; \
RunTest(); \ case TESTCMD_TESTNAME: \
return _Result; \ strcpy(_Buffer, TestName); \
case TESTCMD_TESTNAME: \ break; \
strcpy(Buffer, TestName); \ default: \
return TS_OK; \ _Result = TS_FAILED; \
default: \ break; \
break; \
} \ } \
return TS_FAILED; \
} }
#define FAIL(ErrorMessage) \ static inline void
sprintf(Buffer, "%s\n", ErrorMessage); \ AppendAssertion(char *message)
return TS_FAILED;
#define FAIL_IF_NULL(GivenValue, ErrorMessage) if (GivenValue == NULL) { FAIL(ErrorMessage); }
#define FAIL_IF_TRUE(GivenValue, ErrorMessage) if (GivenValue == TRUE) { FAIL(ErrorMessage); }
#define FAIL_IF_FALSE(GivenValue, ErrorMessage) if (GivenValue == FALSE) { FAIL(ErrorMessage); }
#define FAIL_IF_EQUAL(GivenValue, FailValue, ErrorMessage) if (GivenValue == FailValue) { FAIL(ErrorMessage); }
#define FAIL_IF_NOT_EQUAL(GivenValue, FailValue, ErrorMessage) if (GivenValue != FailValue) { FAIL(ErrorMessage); }
#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) if (strlen(_Buffer) != 0)
strcat(_Buffer, "\n"); strcat(_Buffer, "\n");
@ -101,9 +87,8 @@ static inline void AppendAssertion(char *message)
/* /*
* Test routine prototype * Test routine prototype
* Command - The command to process * Command - The command to process
* Buffer - Pointer to buffer in which to return context information
*/ */
typedef int (*TestRoutine)(int Command, char *Buffer); typedef void (*TestRoutine)(int Command);
/* /*
* Test output routine prototype * Test output routine prototype
@ -254,7 +239,7 @@ _UnsetHooks(PHOOK hookTable)
} }
static inline VOID static inline VOID
_ResetAllHooks() _UnsetAllHooks()
{ {
PAPI_DESCRIPTION api; PAPI_DESCRIPTION api;
ULONG index; ULONG index;

View file

@ -1,4 +1,4 @@
# $Id: makefile,v 1.103 2004/10/18 19:11:09 chorns Exp $ # $Id: makefile,v 1.104 2004/10/20 20:51:21 chorns Exp $
PATH_TO_TOP = ../.. PATH_TO_TOP = ../..
@ -16,8 +16,6 @@ TARGET_DDKLIBS = freetype.a
TARGET_REGTESTS = yes TARGET_REGTESTS = yes
TARGET_BUILDENV_TEST = yes
FREETYPE_DIR = $(PATH_TO_TOP)/lib/freetype FREETYPE_DIR = $(PATH_TO_TOP)/lib/freetype
include $(PATH_TO_TOP)/config include $(PATH_TO_TOP)/config

View file

@ -1,6 +1,6 @@
PATH_TO_TOP = ../../.. PATH_TO_TOP = ../../..
TARGET_TYPE = library TARGET_TYPE = test
TARGET_NAME = regtests TARGET_NAME = regtests
@ -10,6 +10,8 @@ TARGET_CFLAGS = -I$(REGTESTS_PATH_INC) \
-D__USE_W32API \ -D__USE_W32API \
-D_WIN32K_ -D_WIN32K_
TARGET_LIBS = ../win32k.a
-include Makefile.tests -include Makefile.tests
TARGET_OBJECTS = \ TARGET_OBJECTS = \
@ -22,10 +24,3 @@ TARGET_OBJECTS = \
include $(PATH_TO_TOP)/rules.mak include $(PATH_TO_TOP)/rules.mak
include $(TOOLS_PATH)/helper.mk 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

View file

@ -1,4 +1,4 @@
# $Id: helper.mk,v 1.88 2004/10/20 20:31:35 gvg Exp $ # $Id: helper.mk,v 1.89 2004/10/20 20:51:21 chorns Exp $
# #
# Helper makefile for ReactOS modules # Helper makefile for ReactOS modules
# Variables this makefile accepts: # Variables this makefile accepts:
@ -19,6 +19,7 @@
# kmdll = Kernel mode DLL # kmdll = Kernel mode DLL
# winedll = DLL imported from wine # winedll = DLL imported from wine
# kernel = ReactOS kernel # kernel = ReactOS kernel
# test = ReactOS test
# $TARGET_APPTYPE = Application type (windows,native,console). # $TARGET_APPTYPE = Application type (windows,native,console).
# Required only for TARGET_TYPEs program and proglib # Required only for TARGET_TYPEs program and proglib
# $TARGET_NAME = Base name of output file and .rc, .def, and .edf files # $TARGET_NAME = Base name of output file and .rc, .def, and .edf files
@ -50,7 +51,6 @@
# $TARGET_BOOTSTRAP = Whether this file is needed to bootstrap the installation (no,yes) (optional) # $TARGET_BOOTSTRAP = Whether this file is needed to bootstrap the installation (no,yes) (optional)
# $TARGET_BOOTSTRAP_NAME = Name on the installation medium (optional) # $TARGET_BOOTSTRAP_NAME = Name on the installation medium (optional)
# $TARGET_REGTESTS = This module has regression tests (no,yes) (optional) # $TARGET_REGTESTS = This module has regression tests (no,yes) (optional)
# $TARGET_BUILDENV_TEST = Build this test to be run in the build environment (no,yes) (optional)
# $SUBDIRS = Subdirs in which to run make (optional) # $SUBDIRS = Subdirs in which to run make (optional)
include $(PATH_TO_TOP)/config include $(PATH_TO_TOP)/config
@ -353,6 +353,26 @@ ifeq ($(TARGET_TYPE),kernel)
MK_RES_BASE := $(TARGET_NAME) MK_RES_BASE := $(TARGET_NAME)
endif endif
ifeq ($(TARGET_TYPE),test)
TARGET_NORC := yes
MK_MODE := static
MK_EXETYPE :=
MK_DEFEXT := .a
MK_DEFENTRY :=
MK_DDKLIBS :=
MK_SDKLIBS :=
MK_CFLAGS := -I.
MK_CPPFLAGS := -I.
MK_IMPLIB := no
MK_IMPLIBONLY := no
MK_IMPLIBDEFPATH :=
MK_IMPLIB_EXT :=
MK_INSTALLDIR := # none
MK_BOOTCDDIR := system32
MK_DISTDIR := # none
MK_RES_BASE :=
endif
# can be overidden with $(CXX) for linkage of c++ executables # can be overidden with $(CXX) for linkage of c++ executables
LD_CC = $(CC) LD_CC = $(CC)
@ -653,18 +673,8 @@ else
endif endif
ifeq ($(TARGET_REGTESTS),yes) 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 REGTEST_TARGETS := tests/_hooks.c tests/_regtests.c tests/_stubs.S tests/Makefile.tests tests/_rtstub.c
MK_REGTESTS_CLEAN := clean_regtests 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)
endif
MK_REGTESTS_CLEAN := clean_regtests
MK_OBJECTS += tests/_rtstub.o tests/regtests.a
TARGET_CFLAGS += -I$(REGTESTS_PATH_INC)
endif
else else
REGTEST_TARGETS := REGTEST_TARGETS :=
MK_REGTESTS_CLEAN := MK_REGTESTS_CLEAN :=
@ -1008,29 +1018,12 @@ endif
REGTEST_TESTS = $(wildcard tests/tests/*.c) REGTEST_TESTS = $(wildcard tests/tests/*.c)
$(REGTEST_TARGETS): $(REGTEST_TESTS) $(REGTEST_TARGETS): $(REGTEST_TESTS)
ifeq ($(TARGET_BUILDENV_TEST),yes)
$(REGTESTS) ./tests/tests ./tests/_regtests.c ./tests/Makefile.tests -e ./tests/_rtstub.c $(REGTESTS) ./tests/tests ./tests/_regtests.c ./tests/Makefile.tests -e ./tests/_rtstub.c
$(REGTESTS) -s ./tests/stubs.tst ./tests/_stubs.S ./tests/_hooks.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
$(MAKE) -C tests TARGET_REGTESTS=no all
else
ifeq ($(MK_MODE),kernel)
$(REGTESTS) ./tests/tests ./tests/_regtests.c ./tests/Makefile.tests -k ./tests/_rtstub.c
$(MAKE) -C tests TARGET_REGTESTS=no all
endif
endif
endif
clean_regtests: clean_regtests:
ifeq ($(TARGET_BUILDENV_TEST),yes)
- $(MAKE) -C tests TARGET_REGTESTS=no clean - $(MAKE) -C tests TARGET_REGTESTS=no clean
- $(RM) ./tests/_rtstub.c ./tests/_hooks.c ./tests/_regtests.c ./tests/_stubs.S ./tests/Makefile.tests - $(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 .PHONY: all depends implib clean install dist bootcd depends gen_regtests clean_regtests
@ -1062,16 +1055,18 @@ $(SUBDIRS:%=%_bootcd): %_bootcd:
endif endif
ifeq ($(TARGET_REGTESTS),yes) ifeq ($(TARGET_REGTESTS),yes)
ifeq ($(TARGET_BUILDENV_TEST),yes)
test: all test: all
$(MAKE) -C tests run $(MAKE) -C tests run
else else
test: test:
- -
endif endif
else
test: ifeq ($(TARGET_TYPE),test)
- run: all
@$(CC) -o _runtest.exe _rtstub.o regtests.a $(SDK_PATH_LIB)/rtshared.a $(TARGET_LIBS) -lntdll
@_runtest.exe
@$(RM) _runtest.exe
endif endif