2004-11-20 Casper S. Hornstrup <chorns@users.sourceforge.net>
authorCasper Hornstrup <chorns@users.sourceforge.net>
Sat, 20 Nov 2004 17:48:38 +0000 (17:48 +0000)
committerCasper Hornstrup <chorns@users.sourceforge.net>
Sat, 20 Nov 2004 17:48:38 +0000 (17:48 +0000)
* config (SEH): Remove.
* regtests/shared/regtests.c (_alloca): Remove; Use from malloca.h
instead.
(PerformTest): Use PSEH to catch exceptions while running tests.
* tools/config.mk (CONFIG): Don't add SEH.
* tools/helper.mk: Link tests with pseh.a.

svn path=/trunk/; revision=11714

reactos/config
reactos/regtests/shared/regtests.c
reactos/tools/config.mk
reactos/tools/helper.mk

index 037b1f3..5baab0c 100644 (file)
@@ -47,11 +47,6 @@ ACPI := 0
 #
 3GB := 1
 
-#
-# Whether to use Structured Exception Handling
-#
-SEH := 0
-
 #
 # Which version of NDIS do we support up to?
 #
index a22e1eb..7c41412 100755 (executable)
@@ -6,13 +6,14 @@
  * UPDATE HISTORY:
  *      06-07-2003  CSH  Created
  */
-#include <roscfg.h>
 #include <ctype.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
+#include <malloc.h>
 #define NTOS_MODE_USER
 #include <ntos.h>
+#include <pseh.h>
 #include "regtests.h"
 
 #define NDEBUG
@@ -23,20 +24,6 @@ char *_Buffer;
 
 static LIST_ENTRY AllTests;
 
-void *_alloca(size_t size)
-{
-  void *ret;
-
-  asm ("movl %1, %%eax\n"
-       "addl $3, %%eax\n"
-       "andl $-4, %%eax\n"
-       "subl %%eax, %%esp\n"
-       "movl %%esp, %0\n"
-       : "=m" (ret) : "m" (size) : "eax");
-
-  return ret;
-}
-
 VOID
 InitializeTests()
 {
@@ -73,18 +60,14 @@ PerformTest(TestOutputRoutine OutputRoutine, PROS_TEST Test, LPSTR TestName)
         }
     }
 
-#ifdef SEH
-  __try {
-#endif
+  _SEH_TRY {
     _Result = TS_OK;
     _Buffer = Buffer;
     (Test->Routine)(TESTCMD_RUN);
-#ifdef SEH
-  } __except(EXCEPTION_EXECUTE_HANDLER) {
+  } _SEH_HANDLE {
     _Result = TS_FAILED;
-    strcpy(Buffer, "Failed due to exception");
-  }
-#endif
+    sprintf(Buffer, "due to exception 0x%lx", _SEH_GetExceptionCode());
+  } _SEH_END;
 
   if (_Result != TS_OK)
     {
index 3e6a9b3..f95ae01 100644 (file)
@@ -25,10 +25,6 @@ ifeq ($(ACPI), 1)
 CONFIG += ACPI
 endif
 
-ifeq ($(SEH), 1)
-CONFIG += SEH
-endif
-
 $(PATH_TO_TOP)/tools/mkconfig$(EXE_POSTFIX): $(PATH_TO_TOP)/tools/mkconfig.c
        @$(HOST_CC) -g -o $(PATH_TO_TOP)/tools/mkconfig$(EXE_POSTFIX) $(PATH_TO_TOP)/tools/mkconfig.c
 
index 0ba1dfa..4828ae3 100644 (file)
@@ -1,4 +1,4 @@
-# $Id: helper.mk,v 1.94 2004/11/02 19:47:18 gvg Exp $
+# $Id: helper.mk,v 1.95 2004/11/20 17:48:38 chorns Exp $
 #
 # Helper makefile for ReactOS modules
 # Variables this makefile accepts:
@@ -1076,7 +1076,8 @@ endif
 ifeq ($(TARGET_TYPE),test)
 run: all
        @$(CC) -nostdlib -o _runtest.exe regtests.a $(TARGET_LIBS) _stubs.o \
-       $(SDK_PATH_LIB)/rtshared.a $(SDK_PATH_LIB)/regtests.a _hooks.o -lgcc -lmsvcrt -lntdll
+       $(SDK_PATH_LIB)/rtshared.a $(SDK_PATH_LIB)/regtests.a $(SDK_PATH_LIB)/pseh.a \
+       _hooks.o -lgcc -lmsvcrt -lntdll
        @$(CP) $(REGTESTS_PATH)/regtests/regtests.dll regtests.dll
        @_runtest.exe
        @$(RM) regtests.dll