/[ascend]/trunk/base/generic/utilities/test/test_ascSignal.c
ViewVC logotype

Diff of /trunk/base/generic/utilities/test/test_ascSignal.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1142 by johnpye, Sun Dec 31 03:45:13 2006 UTC revision 1143 by johnpye, Mon Jan 15 06:58:12 2007 UTC
# Line 22  Line 22 
22   */   */
23    
24  #include <stdio.h>  #include <stdio.h>
25    #include <utilities/config.h>
26  #include <utilities/ascConfig.h>  #include <utilities/ascConfig.h>
27  #ifdef __WIN32__  #ifdef __WIN32__
28  #include <io.h>  #include <io.h>
29  #endif  #endif
30  #include <utilities/ascMalloc.h>  #include <utilities/ascMalloc.h>
31    #ifdef ASC_SIGNAL_TRAPS
32  #include <utilities/ascSignal.h>  #include <utilities/ascSignal.h>
33    #endif
34  #include <utilities/ascPanic.h>  #include <utilities/ascPanic.h>
35  #include "CUnit/CUnit.h"  #include "CUnit/CUnit.h"
36  #include "test_ascSignal.h"  #include "test_ascSignal.h"
37  #include "printutil.h"  #include "printutil.h"
38    
39  #include <signal.h>  #ifdef ASC_SIGNAL_TRAPS
   
40  static JMP_BUF my_jmp_buf1;  static JMP_BUF my_jmp_buf1;
41    # define MEMUSED(N) CU_TEST(ascmeminuse()==N)
 #define MEMUSED(N) CU_TEST(ascmeminuse()==N)  
   
42  static int f_handler1_called;  static int f_handler1_called;
43  static int f_handler1_sigval;  static int f_handler1_sigval;
44    
45  /*  /*
46   *  Signal handler for unit tests.   *  Signal handler for unit tests.
47   *  Resets the signal handlers and sets f_handler1_called to   *  Resets the signal handlers and sets f_handler1_called to
# Line 122  static void store_current_signals(void){ Line 123  static void store_current_signals(void){
123    old_seg_handler = SIGNAL(SIGSEGV, my_handler1);    old_seg_handler = SIGNAL(SIGSEGV, my_handler1);
124  }  }
125    
126  #define CHECK_SIGNALS_MATCH_STACKS(FPEFN,INTFN,SEGFN) \  # define CHECK_SIGNALS_MATCH_STACKS(FPEFN,INTFN,SEGFN) \
127      {   SigHandlerFn *oldfpe, *oldint, *oldseg; \      {   SigHandlerFn *oldfpe, *oldint, *oldseg; \
128          oldfpe = signal(SIGFPE,SIG_IGN);\          oldfpe = signal(SIGFPE,SIG_IGN);\
129          CU_TEST(oldfpe == FPEFN);\          CU_TEST(oldfpe == FPEFN);\
# Line 749  static void test_ascsignal_nestingsegv(v Line 750  static void test_ascsignal_nestingsegv(v
750    MEMUSED(0);    MEMUSED(0);
751  }  }
752    
753    #endif /* ASC_SIGNAL_TRAPS */
754    
755  /*===========================================================================*/  /*===========================================================================*/
756  /* Registration information */  /* Registration information */
757    
758  #define T(N) {#N,test_ascsignal_##N}  #define T(N) {#N,test_ascsignal_##N}
759  static CU_TestInfo ascSignal_test_list[] = {  static CU_TestInfo ascSignal_test_list[] = {
760    #ifdef ASC_SIGNAL_TRAPS
761      T(basic)      T(basic)
762      , T(pushpopint)      , T(pushpopint)
763      , T(pushpop)      , T(pushpop)
# Line 761  static CU_TestInfo ascSignal_test_list[] Line 765  static CU_TestInfo ascSignal_test_list[]
765      , T(nestingfpe)      , T(nestingfpe)
766      , T(nestingint)      , T(nestingint)
767      , T(nestingsegv)      , T(nestingsegv)
768      , CU_TEST_INFO_NULL      ,
769    #endif
770        CU_TEST_INFO_NULL
771  };  };
772  #undef T  #undef T
773    

Legend:
Removed from v.1142  
changed lines
  Added in v.1143

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22