apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@apache.org
Subject cvs commit: apr/test testdso.c
Date Sun, 29 Dec 2002 19:37:25 GMT
wrowe       2002/12/29 11:37:25

  Modified:    test     testdso.c
  Log:
    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.
  
  Revision  Changes    Path
  1.33      +41 -34    apr/test/testdso.c
  
  Index: testdso.c
  ===================================================================
  RCS file: /home/cvs/apr/test/testdso.c,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- testdso.c	29 Dec 2002 19:31:07 -0000	1.32
  +++ testdso.c	29 Dec 2002 19:37:24 -0000	1.33
  @@ -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 @@
       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 @@
       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 @@
       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 @@
       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_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 @@
       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 @@
       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 @@
       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 @@
       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 @@
       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);
  
  
  

Mime
View raw message