1 thilo.boehm 1.1.2.2 //%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.2.2 // 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>
38
39 /*
40 This function is executing a number of assertaion task.
41 In differnet to the standard assert() function,
42 this function does not abort the server!
43 thilo.boehm 1.1.2.2
44 1) Print a statement to stderr
45 2) Create a stack trace
46 3) Create a system dump
47
48 */
49
50 void __pegasus_assert_zOS(const char* file, int line, const char* cond);
51
52 /*
53 Define PEGASUS_ASSERT assertion statement. This statement tests the
54 condition defined by the parameters and if not True executes an number
55 of tasks.
56 */
57
58 # define PEGASUS_ASSERT(COND) \
59 do \
60 { \
61 if (!(COND)) \
62 { \
63 __pegasus_assert_zOS( __FILE__, __LINE__, #COND ); \
64 thilo.boehm 1.1.2.2 } \
65 } while (0);
66
67 /*
68 Define PEGASUS_DEBUG_ASSERT assertion statement.
69 It only generates code if PEGASUS_DEBUG is defined
70 This statement tests the condition defined by the parameters and
71 if not True executes an number of tasks and abort the server !
72 */
73
74 #ifdef PEGASUS_DEBUG
75 # define PEGASUS_DEBUG_ASSERT(COND) \
76 do \
77 { \
78 if (!(COND)) \
79 { \
80 fprintf(stderr, \
81 "\nPEGASUS_DEBUG_ASSERT: Assertation \'%s\' failed " \
82 "in file %s ,line %d\n",#COND,__FILE__,__LINE__); \
83 ctrace("PEGASUS_DEBUG_ASSERT: Assertation \'" \
84 #COND"\' failed."); \
85 thilo.boehm 1.1.2.2 kill(getpid(),SIGDUMP); \
86 abort(); \
87 } \
88 } while (0);
89 #else
90 # define PEGASUS_DEBUG_ASSERT(COND)
91 #endif
92
93 #define PEGASUS_TEST_ASSERT(COND) \
94 do \
95 { \
96 if (!(COND)) \
97 { \
98 fprintf(stderr, \
99 "\nPEGASUS_TEST_ASSERT: Assertation \'%s\' failed " \
100 "in file %s ,line %d\n",#COND,__FILE__,__LINE__); \
101 ctrace("PEGASUS_TEST_ASSERT: Assertation \'" \
102 #COND"\' failed."); \
103 kill(getpid(),SIGDUMP); \
104 abort(); \
105 } \
106 thilo.boehm 1.1.2.2 } while (0);
107 #endif /* Pegasus_Assert_ZOS_h */
|