From e1a7bb0d2f419cfce0d946258d2755de0cf94ea4 Mon Sep 17 00:00:00 2001 From: Casper Hornstrup Date: Wed, 20 Oct 2004 20:51:21 +0000 Subject: [PATCH] 2004-10-20 Casper S. Hornstrup * 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 --- reactos/ChangeLog | 13 ++++ reactos/lib/gdiplus/makefile | 2 - reactos/lib/gdiplus/tests/Makefile | 11 +--- reactos/lib/kernel32/makefile | 4 +- reactos/lib/kernel32/tests/Makefile | 13 ++-- reactos/lib/kernel32/tests/tests/CreateFile.c | 2 +- reactos/regtests/shared/regtests.c | 19 ++++-- reactos/regtests/shared/regtests.h | 49 ++++++--------- reactos/subsys/win32k/makefile | 4 +- reactos/subsys/win32k/tests/makefile | 11 +--- reactos/tools/helper.mk | 61 +++++++++---------- 11 files changed, 84 insertions(+), 105 deletions(-) diff --git a/reactos/ChangeLog b/reactos/ChangeLog index 1f518eba0f2..2354f355258 100644 --- a/reactos/ChangeLog +++ b/reactos/ChangeLog @@ -1,3 +1,16 @@ +2004-10-20 Casper S. Hornstrup + + * 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 * lib/kernel32/makefile (TARGET_BUILDENV_TEST): Set to yes. diff --git a/reactos/lib/gdiplus/makefile b/reactos/lib/gdiplus/makefile index bee813402d0..f2d6d7a7394 100644 --- a/reactos/lib/gdiplus/makefile +++ b/reactos/lib/gdiplus/makefile @@ -2,8 +2,6 @@ PATH_TO_TOP = ../.. TARGET_REGTESTS = yes -TARGET_BUILDENV_TEST = yes - TARGET_TYPE = dynlink TARGET_NAME = gdiplus diff --git a/reactos/lib/gdiplus/tests/Makefile b/reactos/lib/gdiplus/tests/Makefile index 7a7b1786ed1..f9e8c051f3a 100644 --- a/reactos/lib/gdiplus/tests/Makefile +++ b/reactos/lib/gdiplus/tests/Makefile @@ -1,6 +1,6 @@ PATH_TO_TOP = ../../.. -TARGET_TYPE = library +TARGET_TYPE = test TARGET_NAME = regtests @@ -17,6 +17,8 @@ TARGET_CFLAGS = \ -D_WIN32_WINNT=0x0501 \ -I$(REGTESTS_PATH_INC) +TARGET_LIBS = ../gdiplus.a + -include Makefile.tests TARGET_OBJECTS = \ @@ -29,10 +31,3 @@ TARGET_OBJECTS = \ include $(PATH_TO_TOP)/rules.mak 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 diff --git a/reactos/lib/kernel32/makefile b/reactos/lib/kernel32/makefile index efadc88de57..f399eb2b12b 100644 --- a/reactos/lib/kernel32/makefile +++ b/reactos/lib/kernel32/makefile @@ -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 = ../.. 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 ca891c0cbcb..ac8687e38b7 100644 --- a/reactos/lib/kernel32/tests/Makefile +++ b/reactos/lib/kernel32/tests/Makefile @@ -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 = ../../.. -TARGET_TYPE = library +TARGET_TYPE = test TARGET_NAME = regtests @@ -10,6 +10,8 @@ TARGET_LIBPATH = . TARGET_CFLAGS = -I$(REGTESTS_PATH_INC) +TARGET_LIBS = ../kernel32.a + -include Makefile.tests TARGET_OBJECTS = \ @@ -22,10 +24,3 @@ TARGET_OBJECTS = \ 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/tests/CreateFile.c b/reactos/lib/kernel32/tests/tests/CreateFile.c index 092916c6aef..e9ed3c769e7 100644 --- a/reactos/lib/kernel32/tests/tests/CreateFile.c +++ b/reactos/lib/kernel32/tests/tests/CreateFile.c @@ -115,7 +115,7 @@ static void TestFile() _AssertEqualValue(NO_ERROR, GetLastError()); _AssertEqualValue(TestHandle, FileHandle); } - _ResetAllHooks(); + _UnsetAllHooks(); } static void RunTest() diff --git a/reactos/regtests/shared/regtests.c b/reactos/regtests/shared/regtests.c index 7031ebbd58a..933ddd2f92d 100755 --- a/reactos/regtests/shared/regtests.c +++ b/reactos/regtests/shared/regtests.c @@ -18,7 +18,10 @@ #define NDEBUG #include -LIST_ENTRY AllTests; +int _Result; +char *_Buffer; + +static LIST_ENTRY AllTests; int DriverTest() @@ -48,12 +51,14 @@ PerformTest(TestOutputRoutine OutputRoutine, PROS_TEST Test, LPSTR TestName) char OutputBuffer[5000]; char Buffer[5000]; char Name[200]; - int Result; - memset(Name, 0, sizeof(Name)); 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) { @@ -73,7 +78,9 @@ PerformTest(TestOutputRoutine OutputRoutine, PROS_TEST Test, LPSTR TestName) #ifdef SEH __try { #endif - Result = (Test->Routine)(TESTCMD_RUN, Buffer); + _Result = TS_OK; + _Buffer = Buffer; + (Test->Routine)(TESTCMD_RUN); #ifdef SEH } __except(EXCEPTION_EXECUTE_HANDLER) { Result = TS_FAILED; @@ -81,7 +88,7 @@ PerformTest(TestOutputRoutine OutputRoutine, PROS_TEST Test, LPSTR TestName) } #endif - if (Result != TS_OK) + if (_Result != TS_OK) { sprintf(OutputBuffer, "ROSREGTEST: |%s| Status: Failed (%s)\n", Name, Buffer); } diff --git a/reactos/regtests/shared/regtests.h b/reactos/regtests/shared/regtests.h index 33dcd3e79c9..a93b5757886 100755 --- a/reactos/regtests/shared/regtests.h +++ b/reactos/regtests/shared/regtests.h @@ -19,44 +19,30 @@ #define TS_OK 0 #define TS_FAILED 1 -static int _Result; -static char *_Buffer; +extern int _Result; +extern char *_Buffer; /* Macros to simplify tests */ #define DISPATCHER(FunctionName, TestName) \ -int \ -FunctionName(int Command, \ - char *Buffer) \ +void \ +FunctionName(int Command) \ { \ switch (Command) \ { \ - case TESTCMD_RUN: \ - _Result = TS_OK; \ - _Buffer = Buffer; \ - RunTest(); \ - return _Result; \ - case TESTCMD_TESTNAME: \ - strcpy(Buffer, TestName); \ - return TS_OK; \ - default: \ - break; \ + case TESTCMD_RUN: \ + RunTest(); \ + break; \ + case TESTCMD_TESTNAME: \ + strcpy(_Buffer, TestName); \ + break; \ + default: \ + _Result = TS_FAILED; \ + break; \ } \ - return TS_FAILED; \ } -#define FAIL(ErrorMessage) \ - sprintf(Buffer, "%s\n", ErrorMessage); \ - 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) +static inline void +AppendAssertion(char *message) { if (strlen(_Buffer) != 0) strcat(_Buffer, "\n"); @@ -101,9 +87,8 @@ static inline void AppendAssertion(char *message) /* * Test routine prototype * 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 @@ -254,7 +239,7 @@ _UnsetHooks(PHOOK hookTable) } static inline VOID -_ResetAllHooks() +_UnsetAllHooks() { PAPI_DESCRIPTION api; ULONG index; diff --git a/reactos/subsys/win32k/makefile b/reactos/subsys/win32k/makefile index dcf5f964b95..299ba7095c7 100644 --- a/reactos/subsys/win32k/makefile +++ b/reactos/subsys/win32k/makefile @@ -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 = ../.. @@ -16,8 +16,6 @@ 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 08d813444ae..cacf2f92577 100644 --- a/reactos/subsys/win32k/tests/makefile +++ b/reactos/subsys/win32k/tests/makefile @@ -1,6 +1,6 @@ PATH_TO_TOP = ../../.. -TARGET_TYPE = library +TARGET_TYPE = test TARGET_NAME = regtests @@ -10,6 +10,8 @@ TARGET_CFLAGS = -I$(REGTESTS_PATH_INC) \ -D__USE_W32API \ -D_WIN32K_ +TARGET_LIBS = ../win32k.a + -include Makefile.tests TARGET_OBJECTS = \ @@ -22,10 +24,3 @@ TARGET_OBJECTS = \ 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/tools/helper.mk b/reactos/tools/helper.mk index 8fe047c47bb..41763a2c2c9 100644 --- a/reactos/tools/helper.mk +++ b/reactos/tools/helper.mk @@ -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 # Variables this makefile accepts: @@ -19,6 +19,7 @@ # kmdll = Kernel mode DLL # winedll = DLL imported from wine # kernel = ReactOS kernel +# test = ReactOS test # $TARGET_APPTYPE = Application type (windows,native,console). # Required only for TARGET_TYPEs program and proglib # $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_NAME = Name on the installation medium (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) include $(PATH_TO_TOP)/config @@ -353,6 +353,26 @@ ifeq ($(TARGET_TYPE),kernel) MK_RES_BASE := $(TARGET_NAME) 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 LD_CC = $(CC) @@ -653,18 +673,8 @@ 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) -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 := @@ -1008,29 +1018,12 @@ endif REGTEST_TESTS = $(wildcard tests/tests/*.c) $(REGTEST_TARGETS): $(REGTEST_TESTS) -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 - $(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: -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 @@ -1062,16 +1055,18 @@ $(SUBDIRS:%=%_bootcd): %_bootcd: endif ifeq ($(TARGET_REGTESTS),yes) -ifeq ($(TARGET_BUILDENV_TEST),yes) test: all $(MAKE) -C tests run else test: - 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 -- 2.17.1