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