rbb 2002/12/29 14:28:11
Modified: test testdso.c
dso/aix dso.c
dso/beos dso.c
dso/netware dso.c
dso/os2 dso.c
dso/unix dso.c
Log:
standardize on a couple of easy to test for error codes for DSO errors.
This doesn't work fully on Windows yet, that is the next commit.
Revision Changes Path
1.34 +8 -6 apr/test/testdso.c
Index: testdso.c
===================================================================
RCS file: /home/cvs/apr/test/testdso.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- testdso.c 29 Dec 2002 19:37:24 -0000 1.33
+++ testdso.c 29 Dec 2002 22:28:10 -0000 1.34
@@ -157,7 +157,7 @@
CuAssert(tc, apr_dso_error(h, errstr, 256), APR_SUCCESS == status);
status = apr_dso_sym(&func1, h, "print_hello");
- CuAssertIntEquals(tc, APR_EINIT, status);
+ CuAssertIntEquals(tc, 1, APR_STATUS_IS_ESYMNOTFOUND(status));
}
@@ -234,26 +234,28 @@
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, 1, APR_STATUS_IS_ESYMNOTFOUND(status));
}
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);
- /* 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);
+
+ CuAssertIntEquals(tc, 1, APR_STATUS_IS_EDSOOPEN(status));
CuAssertPtrNotNull(tc, h);
}
+#ifndef LIB_NAME
static void library_not_impl(CuTest *tc)
{
CuNotImpl(tc, "Loadable libraries and modules are equivilant on this
platform");
}
+#endif
CuSuite *testdso(void)
{
1.18 +1 -1 apr/dso/aix/dso.c
Index: dso.c
===================================================================
RCS file: /home/cvs/apr/dso/aix/dso.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- dso.c 13 Mar 2002 20:39:09 -0000 1.17
+++ dso.c 29 Dec 2002 22:28:10 -0000 1.18
@@ -197,7 +197,7 @@
if (retval == NULL) {
handle->errormsg = dlerror();
- return APR_EINIT;
+ return APR_ESYMNOTFOUND;
}
*ressym = retval;
1.22 +3 -3 apr/dso/beos/dso.c
Index: dso.c
===================================================================
RCS file: /home/cvs/apr/dso/beos/dso.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- dso.c 13 Mar 2002 20:39:09 -0000 1.21
+++ dso.c 29 Dec 2002 22:28:11 -0000 1.22
@@ -74,7 +74,7 @@
image_id newid;
if((newid = load_add_on(path)) < B_NO_ERROR)
- return APR_EINIT;
+ return APR_EDSOOPEN;
*res_handle = apr_pcalloc(pool, sizeof(*res_handle));
(*res_handle)->handle = newid;
@@ -96,13 +96,13 @@
int err;
if (symname == NULL)
- return APR_EINIT;
+ return APR_ESYMNOTFOUND;
err = get_image_symbol(handle->handle, symname, B_SYMBOL_TYPE_ANY,
ressym);
if(err != B_OK)
- return APR_EINIT;
+ return APR_ESYMNOTFOUND;
return APR_SUCCESS;
}
1.4 +1 -1 apr/dso/netware/dso.c
Index: dso.c
===================================================================
RCS file: /home/cvs/apr/dso/netware/dso.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- dso.c 2 Apr 2002 00:28:23 -0000 1.3
+++ dso.c 29 Dec 2002 22:28:11 -0000 1.4
@@ -141,7 +141,7 @@
if (retval == NULL) {
handle->errormsg = dlerror();
- return APR_EINIT;
+ return APR_ESYMNOTFOUND;
}
symbol = apr_pcalloc(handle->pool, sizeof(sym_list));
1.27 +1 -1 apr/dso/os2/dso.c
Index: dso.c
===================================================================
RCS file: /home/cvs/apr/dso/os2/dso.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- dso.c 13 Oct 2002 03:34:32 -0000 1.26
+++ dso.c 29 Dec 2002 22:28:11 -0000 1.27
@@ -116,7 +116,7 @@
int rc;
if (symname == NULL || ressym == NULL)
- return APR_EINIT;
+ return APR_ESYMNOTFOUND;
if ((rc = DosQueryProcAddr(handle->handle, 0, symname, &func)) != 0) {
handle->load_error = APR_FROM_OS_ERROR(rc);
1.58 +5 -5 apr/dso/unix/dso.c
Index: dso.c
===================================================================
RCS file: /home/cvs/apr/dso/unix/dso.c,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -r1.57 -r1.58
--- dso.c 11 Dec 2002 19:37:08 -0000 1.57
+++ dso.c 29 Dec 2002 22:28:11 -0000 1.58
@@ -182,7 +182,7 @@
if(os_handle == NULL) {
#if defined(DSO_USE_SHL)
(*res_handle)->errormsg = strerror(errno);
- return errno;
+ return APR_EDSOOPEN;
#elif defined(DSO_USE_DYLD)
(*res_handle)->errormsg = (err_msg) ? err_msg : "link failed";
return APR_EDSOOPEN;
@@ -219,7 +219,7 @@
if (status == -1 && errno == 0) /* try TYPE_DATA instead */
status = shl_findsym((shl_t *)&handle->handle, symname, TYPE_DATA,
&symaddr);
if (status == -1)
- return errno;
+ return APR_ESYMNOTFOUND;
*ressym = symaddr;
return APR_SUCCESS;
@@ -241,12 +241,12 @@
free(symname2);
if (symbol == NULL) {
handle->errormsg = "undefined symbol";
- return APR_EINIT;
+ return APR_ESYMNOTFOUND;
}
retval = NSAddressOfSymbol(symbol);
if (retval == NULL) {
handle->errormsg = "cannot resolve symbol";
- return APR_EINIT;
+ return APR_ESYMNOTFOUND;
}
*ressym = retval;
return APR_SUCCESS;
@@ -266,7 +266,7 @@
if (retval == NULL) {
handle->errormsg = dlerror();
- return APR_EINIT;
+ return APR_ESYMNOTFOUND;
}
*ressym = retval;