2004-10-20 Casper S. Hornstrup <chorns@users.sourceforge.net>
authorCasper Hornstrup <chorns@users.sourceforge.net>
Wed, 20 Oct 2004 20:51:21 +0000 (20:51 +0000)
committerCasper Hornstrup <chorns@users.sourceforge.net>
Wed, 20 Oct 2004 20:51:21 +0000 (20:51 +0000)
* 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
reactos/lib/gdiplus/makefile
reactos/lib/gdiplus/tests/Makefile
reactos/lib/kernel32/makefile
reactos/lib/kernel32/tests/Makefile
reactos/lib/kernel32/tests/tests/CreateFile.c
reactos/regtests/shared/regtests.c
reactos/regtests/shared/regtests.h
reactos/subsys/win32k/makefile
reactos/subsys/win32k/tests/makefile
reactos/tools/helper.mk

index 1f518eb..2354f35 100644 (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>
 
        * lib/kernel32/makefile (TARGET_BUILDENV_TEST): Set to yes.
index bee8134..f2d6d7a 100644 (file)
@@ -2,8 +2,6 @@ PATH_TO_TOP = ../..
 
 TARGET_REGTESTS = yes
 
-TARGET_BUILDENV_TEST = yes
-
 TARGET_TYPE = dynlink
 
 TARGET_NAME = gdiplus
index 7a7b178..f9e8c05 100644 (file)
@@ -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
index efadc88..f399eb2 100644 (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 = ../..
 
 TARGET_REGTESTS = yes
 
-TARGET_BUILDENV_TEST = yes
-
 TARGET_TYPE = dynlink
 
 TARGET_NAME = kernel32
index ca891c0..ac8687e 100644 (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 = ../../..
 
-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
index 092916c..e9ed3c7 100644 (file)
@@ -115,7 +115,7 @@ static void TestFile()
       _AssertEqualValue(NO_ERROR, GetLastError());
       _AssertEqualValue(TestHandle, FileHandle);
     }
-  _ResetAllHooks();
+  _UnsetAllHooks();
 }
 
 static void RunTest()
index 7031ebb..933ddd2 100755 (executable)
 #define NDEBUG
 #include <debug.h>
 
-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);
     }
index 33dcd3e..a93b575 100755 (executable)
 #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;
index dcf5f96..299ba70 100644 (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 = ../..
 
@@ -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
index 08d8134..cacf2f9 100644 (file)
@@ -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
index 8fe047c..41763a2 100644 (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
 # 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