From 6de474e3de135ad265a77e945f7cd8ee638bddf4 Mon Sep 17 00:00:00 2001 From: Kevin Koch Date: Thu, 12 Jul 2007 14:45:47 +0000 Subject: [PATCH] Added dummy Description arguments where needed. Compiles on Windows now TargetVersion: 1.7 Component: krb5-libs Ticket: 5594 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@19693 dc483132-0cff-0310-8789-dd5450dbe970 --- src/ccapi/test/test_ccapi_context.c | 210 +++++++++++++++------------- 1 file changed, 109 insertions(+), 101 deletions(-) diff --git a/src/ccapi/test/test_ccapi_context.c b/src/ccapi/test/test_ccapi_context.c index b9365a619..0e1309d82 100644 --- a/src/ccapi/test/test_ccapi_context.c +++ b/src/ccapi/test/test_ccapi_context.c @@ -5,11 +5,11 @@ #include "test_ccapi_util.h" int check_cc_initialize() { - BEGIN_TEST("cc_initialize"); - cc_int32 err = 0; cc_context_t context = NULL; + BEGIN_TEST("cc_initialize"); + // try every api_version err = check_once_cc_initialize(&context, ccapi_version_2, NULL, NULL, 11, NULL); // err == CC_NOT_SUPP, not reflected in documentation rev 8 err = check_once_cc_initialize(&context, ccapi_version_3, NULL, NULL, ccNoError, NULL); // !err @@ -30,14 +30,15 @@ cc_int32 check_once_cc_initialize(cc_context_t *out_context, cc_int32 in_version cc_int32 err = 0; cc_context_t context; - BEGIN_CHECK_ONCE(description); - cc_int32 possible_return_values[4] = { ccNoError, ccErrNoMem, ccErrBadAPIVersion, ccErrBadParam, }; + + BEGIN_CHECK_ONCE(description); + #define possible_ret_val_count sizeof(possible_return_values)/sizeof(possible_return_values[0]) err = cc_initialize(out_context, in_version, out_supported_version, out_vendor); @@ -146,6 +147,9 @@ cc_int32 check_once_cc_context_get_version(cc_context_t *out_context, cc_int32 i } int check_cc_context_release() { + cc_int32 err = 0; + cc_context_t context = NULL; + BEGIN_TEST("cc_context_release"); #ifndef cc_context_release @@ -153,9 +157,6 @@ int check_cc_context_release() { failure_count++; #else - cc_int32 err = 0; - cc_context_t context = NULL; - // try with valid context err = check_once_cc_context_release(&context, ccNoError, NULL); @@ -173,17 +174,17 @@ int check_cc_context_release() { cc_int32 check_once_cc_context_release(cc_context_t *out_context, cc_int32 expected_err, const char *description) { cc_int32 err = 0; - - BEGIN_CHECK_ONCE(description); - - #ifdef cc_context_release - cc_context_t context = NULL; - + cc_int32 possible_return_values[2] = { ccNoError, ccErrInvalidContext, }; + + BEGIN_CHECK_ONCE(description); + + #ifdef cc_context_release + #define possible_ret_val_count sizeof(possible_return_values)/sizeof(possible_return_values[0]) if (out_context) { @@ -213,6 +214,14 @@ cc_int32 check_once_cc_context_release(cc_context_t *out_context, cc_int32 expec } int check_cc_context_get_change_time() { + cc_int32 err = 0; + cc_context_t context = NULL; + cc_time_t last_change_time = 0; + cc_ccache_t ccache = NULL; + cc_credentials_union creds_union; + cc_credentials_iterator_t creds_iterator = NULL; + cc_credentials_t credentials = NULL; + BEGIN_TEST("cc_context_get_change_time"); #ifndef cc_context_get_change_time @@ -232,14 +241,6 @@ int check_cc_context_get_change_time() { * clean up memory */ - cc_int32 err = 0; - cc_context_t context = NULL; - cc_time_t last_change_time = 0; - cc_ccache_t ccache = NULL; - cc_credentials_union creds_union; - cc_credentials_iterator_t creds_iterator = NULL; - cc_credentials_t credentials = NULL; - err = cc_initialize(&context, ccapi_version_3, NULL, NULL); if (!err) { @@ -318,20 +319,20 @@ int check_cc_context_get_change_time() { cc_int32 check_once_cc_context_get_change_time(cc_context_t context, cc_time_t *time, cc_int32 expected_err, const char *description) { cc_int32 err = 0; - - BEGIN_CHECK_ONCE(description); - - #ifdef cc_context_get_change_time - + cc_time_t last_change_time; + cc_time_t current_change_time = 0; + cc_int32 possible_return_values[3] = { ccNoError, ccErrInvalidContext, ccErrBadParam, }; - #define possible_ret_val_count sizeof(possible_return_values)/sizeof(possible_return_values[0]) + + BEGIN_CHECK_ONCE(description); - cc_time_t last_change_time; - cc_time_t current_change_time = 0; + #ifdef cc_context_get_change_time + + #define possible_ret_val_count sizeof(possible_return_values)/sizeof(possible_return_values[0]) if (time != NULL) { // if we were passed NULL, then we're looking to pass a bad param err = cc_context_get_change_time(context, ¤t_change_time); @@ -355,6 +356,11 @@ cc_int32 check_once_cc_context_get_change_time(cc_context_t context, cc_time_t * } int check_cc_context_get_default_ccache_name() { + cc_int32 err = 0; + cc_context_t context = NULL; + cc_ccache_t ccache = NULL; + cc_string_t name = NULL; + BEGIN_TEST("cc_context_get_default_ccache_name"); #ifndef cc_context_get_default_ccache_name @@ -362,11 +368,6 @@ int check_cc_context_get_default_ccache_name() { failure_count++; #else - cc_int32 err = 0; - cc_context_t context = NULL; - cc_ccache_t ccache = NULL; - cc_string_t name = NULL; - err = cc_initialize(&context, ccapi_version_3, NULL, NULL); if (!err) { // try bad parameters first @@ -397,16 +398,17 @@ int check_cc_context_get_default_ccache_name() { cc_int32 check_once_cc_context_get_default_ccache_name(cc_context_t context, cc_string_t *name, cc_int32 expected_err, const char *description) { cc_int32 err = 0; - BEGIN_CHECK_ONCE(description); - - #ifdef cc_context_get_default_ccache_name - cc_int32 possible_return_values[4] = { ccNoError, ccErrInvalidContext, ccErrBadParam, ccErrNoMem, }; + + BEGIN_CHECK_ONCE(description); + + #ifdef cc_context_get_default_ccache_name + #define possible_ret_val_count sizeof(possible_return_values)/sizeof(possible_return_values[0]) if (name != NULL) { // if we were passed NULL, then we're looking to pass a bad param @@ -430,6 +432,11 @@ cc_int32 check_once_cc_context_get_default_ccache_name(cc_context_t context, cc_ } int check_cc_context_open_ccache() { + cc_int32 err = 0; + cc_context_t context = NULL; + cc_ccache_t ccache = NULL; + cc_string_t name = NULL; + BEGIN_TEST("cc_context_open_ccache"); #ifndef cc_context_open_ccache @@ -437,11 +444,6 @@ int check_cc_context_open_ccache() { failure_count++; #else - cc_int32 err = 0; - cc_context_t context = NULL; - cc_ccache_t ccache = NULL; - cc_string_t name = NULL; - err = cc_initialize(&context, ccapi_version_3, NULL, NULL); if (!err) { // make sure we have a default ccache @@ -488,10 +490,6 @@ cc_int32 check_once_cc_context_open_ccache(cc_context_t context, const char *nam cc_int32 err = 0; cc_string_t stored_name = NULL; - BEGIN_CHECK_ONCE(description); - - #ifdef cc_context_open_ccache - cc_int32 possible_return_values[6] = { ccNoError, ccErrBadName, @@ -500,6 +498,11 @@ cc_int32 check_once_cc_context_open_ccache(cc_context_t context, const char *nam ccErrCCacheNotFound, ccErrBadParam, }; + + BEGIN_CHECK_ONCE(description); + + #ifdef cc_context_open_ccache + #define possible_ret_val_count sizeof(possible_return_values)/sizeof(possible_return_values[0]) if (ccache != NULL) { // if we were passed NULL, then we're looking to pass a bad param @@ -537,6 +540,10 @@ cc_int32 check_once_cc_context_open_ccache(cc_context_t context, const char *nam } int check_cc_context_open_default_ccache() { + cc_int32 err = 0; + cc_context_t context = NULL; + cc_ccache_t ccache = NULL; + BEGIN_TEST("cc_context_open_default_ccache"); #ifndef cc_context_open_default_ccache @@ -544,10 +551,6 @@ int check_cc_context_open_default_ccache() { failure_count++; #else - cc_int32 err = 0; - cc_context_t context = NULL; - cc_ccache_t ccache = NULL; - err = cc_initialize(&context, ccapi_version_3, NULL, NULL); if (!err) { // make sure we have a default ccache @@ -580,10 +583,6 @@ cc_int32 check_once_cc_context_open_default_ccache(cc_context_t context, cc_ccac cc_string_t given_name = NULL; cc_string_t default_name = NULL; - BEGIN_CHECK_ONCE(description); - - #ifdef cc_context_open_default_ccache - cc_int32 possible_return_values[5] = { ccNoError, ccErrInvalidContext, @@ -591,6 +590,11 @@ cc_int32 check_once_cc_context_open_default_ccache(cc_context_t context, cc_ccac ccErrCCacheNotFound, ccErrBadParam, }; + + BEGIN_CHECK_ONCE(description); + + #ifdef cc_context_open_default_ccache + #define possible_ret_val_count sizeof(possible_return_values)/sizeof(possible_return_values[0]) if (ccache != NULL) { // if we were passed NULL, then we're looking to pass a bad param @@ -628,6 +632,11 @@ cc_int32 check_once_cc_context_open_default_ccache(cc_context_t context, cc_ccac } int check_cc_context_create_ccache() { + cc_int32 err = 0; + cc_context_t context = NULL; + cc_ccache_t ccache = NULL; + cc_string_t name = NULL; + BEGIN_TEST("cc_context_create_ccache"); #ifndef cc_context_create_ccache @@ -635,11 +644,6 @@ int check_cc_context_create_ccache() { failure_count++; #else - cc_int32 err = 0; - cc_context_t context = NULL; - cc_ccache_t ccache = NULL; - cc_string_t name = NULL; - err = cc_initialize(&context, ccapi_version_3, NULL, NULL); if (!err) { // try making a ccache with a non-unique name (the existing default's name) @@ -682,10 +686,6 @@ cc_int32 check_once_cc_context_create_ccache(cc_context_t context, const char *n cc_string_t stored_principal = NULL; cc_uint32 stored_creds_vers = 0; - BEGIN_CHECK_ONCE(description); - - #ifdef cc_context_create_ccache - cc_int32 possible_return_values[6] = { ccNoError, ccErrBadName, @@ -694,6 +694,10 @@ cc_int32 check_once_cc_context_create_ccache(cc_context_t context, const char *n ccErrNoMem, ccErrBadCredentialsVersion, }; + BEGIN_CHECK_ONCE(description); + + #ifdef cc_context_create_ccache + #define possible_ret_val_count sizeof(possible_return_values)/sizeof(possible_return_values[0]) err = cc_context_create_ccache(context, name, cred_vers, principal, ccache); @@ -733,6 +737,11 @@ cc_int32 check_once_cc_context_create_ccache(cc_context_t context, const char *n } int check_cc_context_create_default_ccache() { + cc_int32 err = 0; + cc_context_t context = NULL; + cc_ccache_t ccache = NULL; + cc_string_t name = NULL; + BEGIN_TEST("cc_context_create_default_ccache"); #ifndef cc_context_create_default_ccache @@ -740,11 +749,6 @@ int check_cc_context_create_default_ccache() { failure_count++; #else - cc_int32 err = 0; - cc_context_t context = NULL; - cc_ccache_t ccache = NULL; - cc_string_t name = NULL; - err = cc_initialize(&context, ccapi_version_3, NULL, NULL); if (!err) { // try making the default when there are no existing ccaches @@ -779,10 +783,6 @@ cc_int32 check_once_cc_context_create_default_ccache(cc_context_t context, cc_ui cc_string_t stored_principal = NULL; cc_uint32 stored_creds_vers = 0; - BEGIN_CHECK_ONCE(description); - - #ifdef cc_context_create_default_ccache - cc_int32 possible_return_values[6] = { ccNoError, ccErrBadName, // how can this be possible when the name isn't a parameter? @@ -791,6 +791,11 @@ cc_int32 check_once_cc_context_create_default_ccache(cc_context_t context, cc_ui ccErrNoMem, ccErrBadCredentialsVersion, }; + + BEGIN_CHECK_ONCE(description); + + #ifdef cc_context_create_default_ccache + #define possible_ret_val_count sizeof(possible_return_values)/sizeof(possible_return_values[0]) err = cc_context_create_default_ccache(context, cred_vers, principal, ccache); @@ -823,6 +828,11 @@ cc_int32 check_once_cc_context_create_default_ccache(cc_context_t context, cc_ui } int check_cc_context_create_new_ccache() { + cc_int32 err = 0; + cc_context_t context = NULL; + cc_ccache_t ccache = NULL; + cc_string_t name = NULL; + BEGIN_TEST("cc_context_create_new_ccache"); #ifndef cc_context_create_new_ccache @@ -830,11 +840,6 @@ int check_cc_context_create_new_ccache() { failure_count++; #else - cc_int32 err = 0; - cc_context_t context = NULL; - cc_ccache_t ccache = NULL; - cc_string_t name = NULL; - err = cc_initialize(&context, ccapi_version_3, NULL, NULL); if (!err) { // try making when there are no existing ccaches (should have name of default) @@ -872,10 +877,6 @@ cc_int32 check_once_cc_context_create_new_ccache(cc_context_t context, cc_int32 cc_string_t stored_principal = NULL; cc_uint32 stored_creds_vers = 0; - BEGIN_CHECK_ONCE(description); - - #ifdef cc_context_create_new_ccache - cc_int32 possible_return_values[6] = { ccNoError, ccErrBadName, // how can this be possible when the name isn't a parameter? @@ -884,6 +885,11 @@ cc_int32 check_once_cc_context_create_new_ccache(cc_context_t context, cc_int32 ccErrNoMem, ccErrBadCredentialsVersion, }; + + BEGIN_CHECK_ONCE(description); + + #ifdef cc_context_create_new_ccache + #define possible_ret_val_count sizeof(possible_return_values)/sizeof(possible_return_values[0]) err = cc_context_create_new_ccache(context, cred_vers, principal, ccache); @@ -933,6 +939,12 @@ cc_int32 check_once_cc_context_create_new_ccache(cc_context_t context, cc_int32 } int check_cc_context_new_ccache_iterator() { + cc_int32 err = 0; + cc_context_t context = NULL; + cc_ccache_t ccache = NULL; + cc_string_t name = NULL; + cc_ccache_iterator_t iterator = NULL; + BEGIN_TEST("cc_context_new_ccache_iterator"); #ifndef cc_context_new_ccache_iterator @@ -940,12 +952,6 @@ int check_cc_context_new_ccache_iterator() { failure_count++; #else - cc_int32 err = 0; - cc_context_t context = NULL; - cc_ccache_t ccache = NULL; - cc_string_t name = NULL; - cc_ccache_iterator_t iterator = NULL; - err = cc_initialize(&context, ccapi_version_3, NULL, NULL); if (!err) { err = destroy_all_ccaches(context); @@ -977,16 +983,17 @@ int check_cc_context_new_ccache_iterator() { cc_int32 check_once_cc_context_new_ccache_iterator(cc_context_t context, cc_ccache_iterator_t *iterator, cc_int32 expected_err, const char *description) { cc_int32 err = ccNoError; - BEGIN_CHECK_ONCE(description); - - #ifdef cc_context_create_new_ccache - cc_int32 possible_return_values[4] = { ccNoError, ccErrBadParam, ccErrNoMem, ccErrInvalidContext, }; + + BEGIN_CHECK_ONCE(description); + + #ifdef cc_context_create_new_ccache + #define possible_ret_val_count sizeof(possible_return_values)/sizeof(possible_return_values[0]) err = cc_context_new_ccache_iterator(context, iterator); @@ -1005,6 +1012,11 @@ cc_int32 check_once_cc_context_new_ccache_iterator(cc_context_t context, cc_ccac // --------------------------------------------------------------------------- int check_cc_context_compare(){ + cc_int32 err = 0; + cc_context_t context_a = NULL; + cc_context_t context_b = NULL; + cc_uint32 equal = 0; + BEGIN_TEST("cc_context_compare"); #ifndef cc_context_compare @@ -1012,11 +1024,6 @@ int check_cc_context_compare(){ failure_count++; #else - cc_int32 err = 0; - cc_context_t context_a = NULL; - cc_context_t context_b = NULL; - cc_uint32 equal = 0; - err = cc_initialize(&context_a, ccapi_version_3, NULL, NULL); if (!err) { err = cc_initialize(&context_b, ccapi_version_3, NULL, NULL); @@ -1038,16 +1045,17 @@ int check_cc_context_compare(){ cc_int32 check_once_cc_context_compare(cc_context_t context, cc_context_t compare_to, cc_uint32 *equal, cc_int32 expected_err, const char *description) { cc_int32 err = ccNoError; - BEGIN_CHECK_ONCE(description); - - #ifdef cc_context_compare - cc_int32 possible_return_values[4] = { ccNoError, ccErrInvalidContext, ccErrBadParam, ccErrServerUnavailable, }; + + BEGIN_CHECK_ONCE(description); + + #ifdef cc_context_compare + #define possible_ret_val_count sizeof(possible_return_values)/sizeof(possible_return_values[0]) err = cc_context_compare(context, compare_to, equal); -- 2.26.2