diff options
author | Joe Orton <jorton@apache.org> | 2004-06-14 09:09:05 +0000 |
---|---|---|
committer | Joe Orton <jorton@apache.org> | 2004-06-14 09:09:05 +0000 |
commit | b40dc447bf01e4ffd9596f3b6365e1a28366c811 (patch) | |
tree | c8f4138010ae1da716acdb9d96b4d0e0b047fb2c /test/testprocmutex.c | |
parent | 5237c3f8b65f3cd61c3146c6eb3df317652e8c6f (diff) | |
download | apr-b40dc447bf01e4ffd9596f3b6365e1a28366c811.tar.gz |
* test/testprocmutex.c (test_exclusive): Take lock type parameter.
(proc_mutex): Pass lock type parameter.
(testprocmutex): Test all supported mutex types.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@65186 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'test/testprocmutex.c')
-rw-r--r-- | test/testprocmutex.c | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/test/testprocmutex.c b/test/testprocmutex.c index 10e0e62e4..17e9dbeda 100644 --- a/test/testprocmutex.c +++ b/test/testprocmutex.c @@ -92,13 +92,14 @@ static void await_child(abts_case *tc, apr_proc_t *proc) rv == APR_CHILD_DONE && why == APR_PROC_EXIT && code == 0); } -static void test_exclusive(abts_case *tc, const char *lockname) +static void test_exclusive(abts_case *tc, const char *lockname, + apr_lockmech_e mech) { apr_proc_t *child[CHILDREN]; apr_status_t rv; int n; - rv = apr_proc_mutex_create(&proc_lock, lockname, APR_LOCK_DEFAULT, p); + rv = apr_proc_mutex_create(&proc_lock, lockname, mech, p); APR_ASSERT_SUCCESS(tc, "create the mutex", rv); for (n = 0; n < CHILDREN; n++) @@ -117,6 +118,7 @@ static void proc_mutex(abts_case *tc, void *data) apr_status_t rv; const char *shmname = "tpm.shm"; apr_shm_t *shm; + apr_lockmech_e *mech = data; /* Use anonymous shm if available. */ rv = apr_shm_create(&shm, sizeof(int), NULL, p); @@ -128,7 +130,7 @@ static void proc_mutex(abts_case *tc, void *data) APR_ASSERT_SUCCESS(tc, "create shm segment", rv); x = apr_shm_baseaddr_get(shm); - test_exclusive(tc, NULL); + test_exclusive(tc, NULL, *mech); #else ABTS_NOT_IMPL(tc, "APR lacks fork() support"); #endif @@ -137,9 +139,30 @@ static void proc_mutex(abts_case *tc, void *data) abts_suite *testprocmutex(abts_suite *suite) { - suite = ADD_SUITE(suite) + apr_lockmech_e mech = APR_LOCK_DEFAULT; - abts_run_test(suite, proc_mutex, NULL); + suite = ADD_SUITE(suite) + abts_run_test(suite, proc_mutex, &mech); +#if APR_HAS_POSIXSEM_SERIALIZE + mech = APR_LOCK_POSIXSEM; + abts_run_test(suite, proc_mutex, &mech); +#endif +#if APR_HAS_SYSVSEM_SERIALIZE + mech = APR_LOCK_SYSVSEM; + abts_run_test(suite, proc_mutex, &mech); +#endif +#if APR_HAS_PROC_PTHREAD_SERIALIZE + mech = APR_LOCK_PROC_PTHREAD; + abts_run_test(suite, proc_mutex, &mech); +#endif +#if APR_HAS_FCNTL_SERIALIZE + mech = APR_LOCK_FCNTL; + abts_run_test(suite, proc_mutex, &mech); +#endif +#if APR_HAS_FLOCK_SERIALIZE + mech = APR_LOCK_FLOCK; + abts_run_test(suite, proc_mutex, &mech); +#endif return suite; } |