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 05:44:02 GMT
wrowe       2002/12/28 21:44:02

  Modified:    test     testdso.c
  Log:
    First; once any apr object is closed, the results are undefined.
  
    Second; if a platform does not use distinct 'libraries' and 'modules',
    the four _non_module tests (should have been named _library tests)
    don't apply; this includes Netware, Win32, BeOS and OS2.
  
  Revision  Changes    Path
  1.31      +12 -32    apr/test/testdso.c
  
  Index: testdso.c
  ===================================================================
  RCS file: /home/cvs/apr/test/testdso.c,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- testdso.c	19 Dec 2002 16:15:29 -0000	1.30
  +++ testdso.c	29 Dec 2002 05:44:01 -0000	1.31
  @@ -66,7 +66,7 @@
   
   #ifdef NETWARE
   # define LIB_NAME "mod_test.nlm"
  -#elif defined(BEOS)
  +#elif defined(BEOS) || defined(WIN32)
   # define LIB_NAME "mod_test.so"
   #elif defined(DARWIN)
   # define LIB_NAME ".libs/mod_test.so" 
  @@ -155,17 +155,11 @@
   
       status = apr_dso_unload(h);
       CuAssert(tc, apr_dso_error(h, errstr, 256), APR_SUCCESS == status);
  -
  -    status = apr_dso_sym(&func1, h, "print_hello");
  -    CuAssertIntEquals(tc, APR_EINIT, status);
   }
   
   
   static void test_load_non_module(CuTest *tc)
   {
  -#ifndef LIB_NAME2
  -    CuNotImpl(tc, "Can't load non-module library");
  -#else
       apr_dso_handle_t *h = NULL;
       apr_status_t status;
       char errstr[256];
  @@ -175,14 +169,10 @@
       CuAssertPtrNotNull(tc, h);
   
       apr_dso_unload(h);
  -#endif
   }
   
   static void test_dso_sym_non_module(CuTest *tc)
   {
  -#ifndef LIB_NAME2
  -    CuNotImpl(tc, "Can't load non-module library");
  -#else
       apr_dso_handle_t *h = NULL;
       apr_dso_handle_sym_t func1 = NULL;
       apr_status_t status;
  @@ -203,14 +193,10 @@
       CuAssertStrEquals(tc, "Hello - I'm a DSO!\n", teststr);
   
       apr_dso_unload(h);
  -#endif
   }
   
   static void test_dso_sym_return_value_non_mod(CuTest *tc)
   {
  -#ifndef LIB_NAME2
  -    CuNotImpl(tc, "Can't load non-module library");
  -#else
       apr_dso_handle_t *h = NULL;
       apr_dso_handle_sym_t func1 = NULL;
       apr_status_t status;
  @@ -230,14 +216,10 @@
       CuAssertIntEquals(tc, 5, status);
   
       apr_dso_unload(h);
  -#endif
   }
   
   static void test_unload_non_module(CuTest *tc)
   {
  -#ifndef LIB_NAME2
  -    CuNotImpl(tc, "Can't load non-module library");
  -#else
       apr_dso_handle_t *h = NULL;
       apr_status_t status;
       char errstr[256];
  @@ -249,22 +231,20 @@
   
       status = apr_dso_unload(h);
       CuAssert(tc, apr_dso_error(h, errstr, 256), APR_SUCCESS == status);
  -
  -    status = apr_dso_sym(&func1, h, "print_hello");
  -    CuAssertIntEquals(tc, APR_EINIT, status);
  -#endif
   }
   
   static void test_load_notthere(CuTest *tc)
   {
       apr_dso_handle_t *h = NULL;
  +    char errstr[256];
       apr_status_t status;
   
       status = apr_dso_load(&h, "No_File.so", p);
  -    CuAssertIntEquals(tc, APR_EDSOOPEN, status);
  +    /* Original test was status == APR_EDSOOPEN, but that's not valid
  +     * with DSO_USE_SHL (HP/UX etc), OS2 or Win32.  Accept simple failure.
  +     */
  +    CuAssert(tc, apr_dso_error(h, errstr, 256), status);
       CuAssertPtrNotNull(tc, h);
  -
  -    apr_dso_unload(h);
   }    
   
   CuSuite *testdso(void)
  @@ -275,21 +255,21 @@
       getcwd(filename, 256);
       filename = apr_pstrcat(p, filename, "/", LIB_NAME, NULL);
   
  -#ifdef LIB_NAME2
  -    filename2 = apr_pcalloc(p, 256);
  -    getcwd(filename2, 256);
  -    filename2 = apr_pstrcat(p, filename2, "/", LIB_NAME2, NULL);
  -#endif
  -
       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);
  +#endif
   
       SUITE_ADD_TEST(suite, test_load_notthere);
   
  
  
  

Mime
View raw message