[asterisk-commits] branch oej/moduletest - r7593 in /team/oej/moduletest: ./ channels/

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Thu Dec 22 08:28:44 CST 2005


Author: oej
Date: Thu Dec 22 08:28:41 2005
New Revision: 7593

URL: http://svn.digium.com/view/asterisk?rev=7593&view=rev
Log:
Found an embarrassing bug, now fixed. This works.


Modified:
    team/oej/moduletest/channels/chan_sip.c
    team/oej/moduletest/loader.c

Modified: team/oej/moduletest/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/oej/moduletest/channels/chan_sip.c?rev=7593&r1=7592&r2=7593&view=diff
==============================================================================
--- team/oej/moduletest/channels/chan_sip.c (original)
+++ team/oej/moduletest/channels/chan_sip.c Thu Dec 22 08:28:41 2005
@@ -13239,6 +13239,7 @@
 int codetest(int fd)
 {
 	ast_cli(fd, "Testing chan_sip functions.... \n");	
+	ast_log(LOG_VERBOSE, "Testing chan_sip functions ... \n");
 	return RESULT_SUCCESS;
 }
 #endif

Modified: team/oej/moduletest/loader.c
URL: http://svn.digium.com/view/asterisk/team/oej/moduletest/loader.c?rev=7593&r1=7592&r2=7593&view=diff
==============================================================================
--- team/oej/moduletest/loader.c (original)
+++ team/oej/moduletest/loader.c Thu Dec 22 08:28:41 2005
@@ -221,9 +221,9 @@
 			if (codetest != NULL) {
 				ast_cli(fd, "Found module %s. Calling test functions. \n\n", name);
 				codetest(fd);	
-				break;
 			} else
 				ast_cli(fd, "Module %s has no test functions. \n\n", name);
+			break;
 		}
 		m = m->next;
 	}
@@ -308,6 +308,8 @@
 	int res;
 	struct module *m;
 	int flags=RTLD_NOW;
+	char *error;
+
 #ifdef RTLD_GLOBAL
 	char *val;
 #endif
@@ -401,13 +403,20 @@
 	if (m->reload == NULL)
 		m->reload = dlsym(m->lib, "_reload");
 
-#ifdef ENABLE_CODE_TESTING
+#ifdef ENABLE_CODE_TEST
+	error = dlerror();	/* clear out previous errors */
+
 	/* Check if there is a code testing function in this module */
 	m->codetest = dlsym(m->lib, "codetest");
 	if (m->codetest == NULL)
 		m->codetest = dlsym(m->lib, "_codetest");
+	if ( (error = dlerror() ) != NULL) {
+		ast_log(LOG_ERROR, "DLerror: %s checking for codetest in module %s\n", error, m->resource);
+		m->codetest = NULL;	/* reset to make sure */
+	}
 	if (m->codetest != NULL)
 		ast_log(LOG_DEBUG, "Module %s has got code testing capabilities\n", m->resource);
+	
 #endif
 
 	if (!m->key || !(key = (unsigned char *) m->key())) {



More information about the asterisk-commits mailing list