xref: /freebsd/crypto/krb5/src/ccapi/test/test_ccapi_globals.h (revision 7f2fe78b9dd5f51c821d771b63d2e096f6fd49e9)
1*7f2fe78bSCy Schubert #ifndef _TEST_CCAPI_GLOBALS_H_
2*7f2fe78bSCy Schubert #define _TEST_CCAPI_GLOBALS_H_
3*7f2fe78bSCy Schubert 
4*7f2fe78bSCy Schubert #include <krb5.h> // gets us TARGET_OS_MAC
5*7f2fe78bSCy Schubert 
6*7f2fe78bSCy Schubert #if defined(macintosh) || (defined(__MACH__) && defined(__APPLE__))
7*7f2fe78bSCy Schubert #include <TargetConditionals.h>
8*7f2fe78bSCy Schubert #endif
9*7f2fe78bSCy Schubert 
10*7f2fe78bSCy Schubert #ifdef TARGET_OS_MAC
11*7f2fe78bSCy Schubert #include <Kerberos/CredentialsCache.h>
12*7f2fe78bSCy Schubert #else
13*7f2fe78bSCy Schubert #include <CredentialsCache.h>
14*7f2fe78bSCy Schubert #endif
15*7f2fe78bSCy Schubert 
16*7f2fe78bSCy Schubert /* GLOBALS */
17*7f2fe78bSCy Schubert extern unsigned int total_failure_count;
18*7f2fe78bSCy Schubert extern unsigned int failure_count;
19*7f2fe78bSCy Schubert 
20*7f2fe78bSCy Schubert extern const char *current_test_name;
21*7f2fe78bSCy Schubert extern const char *current_test_activity;
22*7f2fe78bSCy Schubert 
23*7f2fe78bSCy Schubert extern const char * ccapi_error_strings[30];
24*7f2fe78bSCy Schubert 
25*7f2fe78bSCy Schubert const char *translate_ccapi_error(cc_int32 err);
26*7f2fe78bSCy Schubert 
27*7f2fe78bSCy Schubert #define T_CCAPI_INIT \
28*7f2fe78bSCy Schubert 		do { \
29*7f2fe78bSCy Schubert 			current_test_name = NULL; \
30*7f2fe78bSCy Schubert 			current_test_activity = NULL; \
31*7f2fe78bSCy Schubert 		} while( 0 )
32*7f2fe78bSCy Schubert 
33*7f2fe78bSCy Schubert #define BEGIN_TEST(name) \
34*7f2fe78bSCy Schubert 		do { \
35*7f2fe78bSCy Schubert 			current_test_name = name; \
36*7f2fe78bSCy Schubert 			failure_count = 0; \
37*7f2fe78bSCy Schubert 			test_header(current_test_name);	\
38*7f2fe78bSCy Schubert 		} while( 0 )
39*7f2fe78bSCy Schubert 
40*7f2fe78bSCy Schubert #define BEGIN_CHECK_ONCE(x) \
41*7f2fe78bSCy Schubert 		do { \
42*7f2fe78bSCy Schubert 			if (x) { \
43*7f2fe78bSCy Schubert 				current_test_activity = x; \
44*7f2fe78bSCy Schubert 			} \
45*7f2fe78bSCy Schubert 		} while( 0 )
46*7f2fe78bSCy Schubert 
47*7f2fe78bSCy Schubert #define END_CHECK_ONCE \
48*7f2fe78bSCy Schubert 		do { \
49*7f2fe78bSCy Schubert 			current_test_activity = NULL; \
50*7f2fe78bSCy Schubert 		} while( 0 )
51*7f2fe78bSCy Schubert 
52*7f2fe78bSCy Schubert #define END_TEST_AND_RETURN \
53*7f2fe78bSCy Schubert 		test_footer(current_test_name, failure_count); \
54*7f2fe78bSCy Schubert 		total_failure_count += failure_count; \
55*7f2fe78bSCy Schubert 		return failure_count;
56*7f2fe78bSCy Schubert 
57*7f2fe78bSCy Schubert #endif /* _TEST_CCAPI_GLOBALS_H_ */
58