diff options
author | William A. Rowe Jr <wrowe@apache.org> | 2002-12-29 19:37:24 +0000 |
---|---|---|
committer | William A. Rowe Jr <wrowe@apache.org> | 2002-12-29 19:37:24 +0000 |
commit | e5cb61aff883171a7ce2fb767f8bc81d1283b51b (patch) | |
tree | 7c83512fd68ed0b73b898ce89e04e731fedf0db9 /test/testdso.c | |
parent | bee2f2125a9b0d77530cb0cd043c74d5fb14e6e6 (diff) | |
download | apr-e5cb61aff883171a7ce2fb767f8bc81d1283b51b.tar.gz |
Reclassify LIB and LIB2 as MOD and LIB (corresponding to loadable modules
and libraries, respectively.) Re-introduce a single CuNotImpl for those
cases where LIB is undefined.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@64224 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'test/testdso.c')
-rw-r--r-- | test/testdso.c | 75 |
1 files changed, 41 insertions, 34 deletions
diff --git a/test/testdso.c b/test/testdso.c index 2ed53f3e0..2d04507c2 100644 --- a/test/testdso.c +++ b/test/testdso.c @@ -65,22 +65,22 @@ #endif #ifdef NETWARE -# define LIB_NAME "mod_test.nlm" +# define MOD_NAME "mod_test.nlm" #elif defined(BEOS) || defined(WIN32) -# define LIB_NAME "mod_test.so" +# define MOD_NAME "mod_test.so" #elif defined(DARWIN) -# define LIB_NAME ".libs/mod_test.so" -# define LIB_NAME2 ".libs/libmod_test.dylib" +# define MOD_NAME ".libs/mod_test.so" +# define LIB_NAME ".libs/libmod_test.dylib" #elif defined(__hpux__) -# define LIB_NAME ".libs/mod_test.sl" -# define LIB_NAME2 ".libs/libmod_test.sl" +# define MOD_NAME ".libs/mod_test.sl" +# define LIB_NAME ".libs/libmod_test.sl" #else /* Every other Unix */ -# define LIB_NAME ".libs/mod_test.so" -# define LIB_NAME2 ".libs/libmod_test.so" +# define MOD_NAME ".libs/mod_test.so" +# define LIB_NAME ".libs/libmod_test.so" #endif -static char *filename; -static char *filename2; +static char *modname; +static char *libname; static void test_load_module(CuTest *tc) { @@ -88,7 +88,7 @@ static void test_load_module(CuTest *tc) apr_status_t status; char errstr[256]; - status = apr_dso_load(&h, filename, p); + status = apr_dso_load(&h, modname, p); CuAssert(tc, apr_dso_error(h, errstr, 256), APR_SUCCESS == status); CuAssertPtrNotNull(tc, h); @@ -104,7 +104,7 @@ static void test_dso_sym(CuTest *tc) char teststr[256]; char errstr[256]; - status = apr_dso_load(&h, filename, p); + status = apr_dso_load(&h, modname, p); CuAssert(tc, apr_dso_error(h, errstr, 256), APR_SUCCESS == status); CuAssertPtrNotNull(tc, h); @@ -127,7 +127,7 @@ static void test_dso_sym_return_value(CuTest *tc) int (*function)(int); char errstr[256]; - status = apr_dso_load(&h, filename, p); + status = apr_dso_load(&h, modname, p); CuAssert(tc, apr_dso_error(h, errstr, 256), APR_SUCCESS == status); CuAssertPtrNotNull(tc, h); @@ -149,7 +149,7 @@ static void test_unload_module(CuTest *tc) char errstr[256]; apr_dso_handle_sym_t func1 = NULL; - status = apr_dso_load(&h, filename, p); + status = apr_dso_load(&h, modname, p); CuAssert(tc, apr_dso_error(h, errstr, 256), APR_SUCCESS == status); CuAssertPtrNotNull(tc, h); @@ -161,20 +161,20 @@ static void test_unload_module(CuTest *tc) } -static void test_load_non_module(CuTest *tc) +static void test_load_library(CuTest *tc) { apr_dso_handle_t *h = NULL; apr_status_t status; char errstr[256]; - status = apr_dso_load(&h, filename2, p); + status = apr_dso_load(&h, libname, p); CuAssert(tc, apr_dso_error(h, errstr, 256), APR_SUCCESS == status); CuAssertPtrNotNull(tc, h); apr_dso_unload(h); } -static void test_dso_sym_non_module(CuTest *tc) +static void test_dso_sym_library(CuTest *tc) { apr_dso_handle_t *h = NULL; apr_dso_handle_sym_t func1 = NULL; @@ -183,7 +183,7 @@ static void test_dso_sym_non_module(CuTest *tc) char teststr[256]; char errstr[256]; - status = apr_dso_load(&h, filename2, p); + status = apr_dso_load(&h, libname, p); CuAssert(tc, apr_dso_error(h, errstr, 256), APR_SUCCESS == status); CuAssertPtrNotNull(tc, h); @@ -198,7 +198,7 @@ static void test_dso_sym_non_module(CuTest *tc) apr_dso_unload(h); } -static void test_dso_sym_return_value_non_mod(CuTest *tc) +static void test_dso_sym_return_value_library(CuTest *tc) { apr_dso_handle_t *h = NULL; apr_dso_handle_sym_t func1 = NULL; @@ -206,7 +206,7 @@ static void test_dso_sym_return_value_non_mod(CuTest *tc) int (*function)(int); char errstr[256]; - status = apr_dso_load(&h, filename2, p); + status = apr_dso_load(&h, libname, p); CuAssert(tc, apr_dso_error(h, errstr, 256), APR_SUCCESS == status); CuAssertPtrNotNull(tc, h); @@ -221,14 +221,14 @@ static void test_dso_sym_return_value_non_mod(CuTest *tc) apr_dso_unload(h); } -static void test_unload_non_module(CuTest *tc) +static void test_unload_library(CuTest *tc) { apr_dso_handle_t *h = NULL; apr_status_t status; char errstr[256]; apr_dso_handle_sym_t func1 = NULL; - status = apr_dso_load(&h, filename2, p); + status = apr_dso_load(&h, libname, p); CuAssert(tc, apr_dso_error(h, errstr, 256), APR_SUCCESS == status); CuAssertPtrNotNull(tc, h); @@ -250,28 +250,35 @@ static void test_load_notthere(CuTest *tc) CuAssertPtrNotNull(tc, h); } +static void library_not_impl(CuTest *tc) +{ + CuNotImpl(tc, "Loadable libraries and modules are equivilant on this platform"); +} + CuSuite *testdso(void) { CuSuite *suite = CuSuiteNew("DSO"); - filename = apr_pcalloc(p, 256); - getcwd(filename, 256); - filename = apr_pstrcat(p, filename, "/", LIB_NAME, NULL); + modname = apr_pcalloc(p, 256); + getcwd(modname, 256); + modname = apr_pstrcat(p, modname, "/", MOD_NAME, NULL); SUITE_ADD_TEST(suite, test_load_module); SUITE_ADD_TEST(suite, test_dso_sym); SUITE_ADD_TEST(suite, test_dso_sym_return_value); SUITE_ADD_TEST(suite, test_unload_module); -#ifdef LIB_NAME2 - filename2 = apr_pcalloc(p, 256); - getcwd(filename2, 256); - filename2 = apr_pstrcat(p, filename2, "/", LIB_NAME2, NULL); - - SUITE_ADD_TEST(suite, test_load_non_module); - SUITE_ADD_TEST(suite, test_dso_sym_non_module); - SUITE_ADD_TEST(suite, test_dso_sym_return_value_non_mod); - SUITE_ADD_TEST(suite, test_unload_non_module); +#ifndef LIB_NAME + SUITE_ADD_TEST(suite, library_not_impl); +#else + libname = apr_pcalloc(p, 256); + getcwd(libname, 256); + libname = apr_pstrcat(p, libname, "/", LIB_NAME, NULL); + + SUITE_ADD_TEST(suite, test_load_library); + SUITE_ADD_TEST(suite, test_dso_sym_library); + SUITE_ADD_TEST(suite, test_dso_sym_return_value_library); + SUITE_ADD_TEST(suite, test_unload_library); #endif SUITE_ADD_TEST(suite, test_load_notthere); |