diff options
| author | Alexandra Ellwood <lxs@mit.edu> | 2008-03-12 16:50:21 +0000 |
|---|---|---|
| committer | Alexandra Ellwood <lxs@mit.edu> | 2008-03-12 16:50:21 +0000 |
| commit | 9b58ededdc28757a3a203e645094a2cd854434cf (patch) | |
| tree | fc92e9bf3fbd2ff26887abd80bfa3015298417b0 /src/ccapi/test/simple_lock_test.c | |
| parent | b03001c9aad53a6ecdc8ebef0493882bad0a826c (diff) | |
| download | krb5-9b58ededdc28757a3a203e645094a2cd854434cf.tar.gz krb5-9b58ededdc28757a3a203e645094a2cd854434cf.tar.xz krb5-9b58ededdc28757a3a203e645094a2cd854434cf.zip | |
Added tests for iterators and NC info. Added test programs for
each test. Cleaned up portability issues introduced by Windows
testing.
ticket: 5909
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20270 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/ccapi/test/simple_lock_test.c')
| -rw-r--r-- | src/ccapi/test/simple_lock_test.c | 39 |
1 files changed, 23 insertions, 16 deletions
diff --git a/src/ccapi/test/simple_lock_test.c b/src/ccapi/test/simple_lock_test.c index 26bd74ed9..418d56ad0 100644 --- a/src/ccapi/test/simple_lock_test.c +++ b/src/ccapi/test/simple_lock_test.c @@ -7,36 +7,41 @@ #include <stdio.h> #include <stdarg.h> -#include "cci_debugging.h" +#include "test_ccapi_log.h" + +#if defined(macintosh) || (defined(__MACH__) && defined(__APPLE__)) +#include <TargetConditionals.h> +#endif #ifdef TARGET_OS_MAC #include <stdlib.h> +#include <pthread.h> #include <Kerberos/CredentialsCache.h> #else #include "CredentialsCache.h" #endif -void * other_thread (void) { +void *other_thread (void) { cc_int32 err; cc_context_t context = NULL; err = cc_initialize(&context, ccapi_version_7, NULL, NULL); - cci_debug_printf("thread: attempting lock. may hang. err == %d", err); + log_error("thread: attempting lock. may hang. err == %d", err); if (!err) { // hangs with cc_lock_read which should succeed immediately, but does not hang with write, upgrade, and downgrade, which fail immediately err = cc_context_lock(context, cc_lock_read, cc_lock_noblock); - } + } if (context) { cc_context_unlock(context); cc_context_release(context); context = NULL; - } - cci_debug_printf("thread: return. err == %d", err); } + log_error("thread: return. err == %d", err); +} int main (int argc, char *argv[]) { @@ -51,14 +56,14 @@ int main (int argc, char *argv[]) { err = cc_initialize(&context, ccapi_version_7, NULL, NULL); if (!err) { err = cc_context_lock(context, cc_lock_read, cc_lock_noblock); - } + } - cci_debug_printf("main: initialized and read locked context. err == %d", err); + log_error("main: initialized and read locked context. err == %d", err); #ifdef TARGET_OS_MAC status = pthread_create (&thread_id, NULL, (void *) other_thread, NULL); if (status != 0) { - cci_debug_printf("Create error!"); + log_error("pthread_create() returned %d", status); exit(-1); } @@ -67,18 +72,20 @@ int main (int argc, char *argv[]) { #endif - cci_debug_printf("main: unlocking and releasing context. err == %d", err); + log_error("main: unlocking and releasing context. err == %d", err); if (context) { - cci_debug_printf("main: calling cc_context_unlock"); + log_error("main: calling cc_context_unlock"); cc_context_unlock(context); - cci_debug_printf("main: calling cc_context_release"); + log_error("main: calling cc_context_release"); cc_context_release(context); context = NULL; - } + } - cci_debug_printf("main: return. err == %d", err); + log_error("main: return. err == %d", err); - UNREFERENCED_PARAMETER(status); // no whining! +#if defined(_WIN32) + UNREFERENCED_PARAMETER(status); // no whining! +#endif return 0; - }
\ No newline at end of file +} |
