1 thilo.boehm 1.1 //%2006////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
4 // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
5 // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
6 // IBM Corp.; EMC Corporation, The Open Group.
7 // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
8 // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
9 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
10 // EMC Corporation; VERITAS Software Corporation; The Open Group.
11 // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
12 // EMC Corporation; Symantec Corporation; The Open Group.
13 //
14 // Permission is hereby granted, free of charge, to any person obtaining a copy
15 // of this software and associated documentation files (the "Software"), to
16 // deal in the Software without restriction, including without limitation the
17 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
18 // sell copies of the Software, and to permit persons to whom the Software is
19 // furnished to do so, subject to the following conditions:
20 //
21 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
22 thilo.boehm 1.1 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
23 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
24 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
25 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
26 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
27 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 //
30 //==============================================================================
31 //
32 //%/////////////////////////////////////////////////////////////////////////////
33 #ifndef Pegasus_Assert_ZOS_h
34 #define Pegasus_Assert_ZOS_h
35
36 #include <ctest.h>
37 #include <signal.h>
|
40 thilo.boehm 1.1
41 /*
42 This function is executing a number of assertaion task.
43 In differnet to the standard assert() function,
44 this function does not abort the server!
45
46 1) Print a statement to stderr
47 2) Create a stack trace
48 3) Create a system dump
49
50 */
51
52 void __pegasus_assert_zOS(const char* file, int line, const char* cond);
53
54 /*
55 Define PEGASUS_ASSERT assertion statement. This statement tests the
56 condition defined by the parameters and if not True executes an number
57 of tasks.
58 */
59
60 # define PEGASUS_ASSERT(COND) \
61 thilo.boehm 1.1 do \
62 { \
63 if (!(COND)) \
64 { \
65 __pegasus_assert_zOS( __FILE__, __LINE__, #COND ); \
66 } \
67 } while (0);
68
69 /*
70 Define PEGASUS_DEBUG_ASSERT assertion statement.
71 It only generates code if PEGASUS_DEBUG is defined
72 This statement tests the condition defined by the parameters and
73 if not True executes an number of tasks and abort the server !
74 */
75
76 #ifdef PEGASUS_DEBUG
77 # define PEGASUS_DEBUG_ASSERT(COND) \
78 do \
79 { \
80 if (!(COND)) \
81 { \
82 thilo.boehm 1.1 fprintf(stderr, \
83 "\nPEGASUS_DEBUG_ASSERT: Assertation \'%s\' failed " \
84 "in file %s ,line %d\n",#COND,__FILE__,__LINE__); \
85 ctrace("PEGASUS_DEBUG_ASSERT: Assertation \'" \
86 #COND"\' failed."); \
87 kill(getpid(),SIGDUMP); \
88 abort(); \
89 } \
90 } while (0);
91 #else
92 # define PEGASUS_DEBUG_ASSERT(COND)
93 #endif
94
95 #define PEGASUS_TEST_ASSERT(COND) \
96 do \
97 { \
98 if (!(COND)) \
99 { \
100 fprintf(stderr, \
101 "\nPEGASUS_TEST_ASSERT: Assertation \'%s\' failed " \
102 "in file %s ,line %d\n",#COND,__FILE__,__LINE__); \
103 thilo.boehm 1.1 ctrace("PEGASUS_TEST_ASSERT: Assertation \'" \
104 #COND"\' failed."); \
105 kill(getpid(),SIGDUMP); \
106 abort(); \
107 } \
108 } while (0);
109 #endif /* Pegasus_Assert_ZOS_h */
|