[asterisk-commits] branch oej/moduletest - r7591 in
/team/oej/moduletest: ./ include/asterisk/
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Thu Dec 22 03:46:17 CST 2005
Author: oej
Date: Thu Dec 22 03:46:12 2005
New Revision: 7591
URL: http://svn.digium.com/view/asterisk?rev=7591&view=rev
Log:
...Strange. Show modules show that a lot of modules have implemented codetest already.
And I haven't released it :-)
Guess something is weird in loader.c
Modified:
team/oej/moduletest/cli.c
team/oej/moduletest/include/asterisk/module.h
team/oej/moduletest/loader.c
Modified: team/oej/moduletest/cli.c
URL: http://svn.digium.com/view/asterisk/team/oej/moduletest/cli.c?rev=7591&r1=7590&r2=7591&view=diff
==============================================================================
--- team/oej/moduletest/cli.c (original)
+++ team/oej/moduletest/cli.c Thu Dec 22 03:46:12 2005
@@ -248,17 +248,26 @@
return RESULT_SUCCESS;
}
+#ifdef ENABLE_CODE_TEST
+#define MODLIST_FORMAT "%-30s %-40.40s %-10d %2s\n"
+#define MODLIST_FORMAT2 "%-30s %-40.40s %-10s %2s\n"
+#else
#define MODLIST_FORMAT "%-30s %-40.40s %-10d\n"
#define MODLIST_FORMAT2 "%-30s %-40.40s %-10s\n"
+#endif
AST_MUTEX_DEFINE_STATIC(climodentrylock);
static int climodentryfd = -1;
-static int modlist_modentry(const char *module, const char *description, int usecnt, const char *like)
+static int modlist_modentry(const char *module, const char *description, int usecnt, const char *like, const char *codetest)
{
/* Comparing the like with the module */
if (strcasestr(module, like) ) {
+#ifdef ENABLE_CODE_TEST
+ ast_cli(climodentryfd, MODLIST_FORMAT, module, description, usecnt, codetest);
+#else
ast_cli(climodentryfd, MODLIST_FORMAT, module, description, usecnt);
+#endif
return 1;
}
return 0;
@@ -411,7 +420,11 @@
ast_mutex_lock(&climodentrylock);
climodentryfd = fd;
+#ifdef ENABLE_CODE_TEST
ast_cli(fd, MODLIST_FORMAT2, "Module", "Description", "Use Count");
+#else
+ ast_cli(fd, MODLIST_FORMAT2, "Module", "Description", "Use Count", "CT");
+#endif
ast_cli(fd,"%d modules loaded\n", ast_update_module_list(modlist_modentry, like));
climodentryfd = -1;
ast_mutex_unlock(&climodentrylock);
Modified: team/oej/moduletest/include/asterisk/module.h
URL: http://svn.digium.com/view/asterisk/team/oej/moduletest/include/asterisk/module.h?rev=7591&r1=7590&r2=7591&view=diff
==============================================================================
--- team/oej/moduletest/include/asterisk/module.h (original)
+++ team/oej/moduletest/include/asterisk/module.h Thu Dec 22 03:46:12 2005
@@ -186,7 +186,7 @@
*
* \return the number of modules loaded
*/
-int ast_update_module_list(int (*modentry)(const char *module, const char *description, int usecnt, const char *like),
+int ast_update_module_list(int (*modentry)(const char *module, const char *description, int usecnt, const char *like, const char *codetest),
const char *like);
/*!
Modified: team/oej/moduletest/loader.c
URL: http://svn.digium.com/view/asterisk/team/oej/moduletest/loader.c?rev=7591&r1=7590&r2=7591&view=diff
==============================================================================
--- team/oej/moduletest/loader.c (original)
+++ team/oej/moduletest/loader.c Thu Dec 22 03:46:12 2005
@@ -218,7 +218,7 @@
while(m) {
if (!strcasecmp(name, m->resource)) {
codetest = m->codetest;
- if (codetest) {
+ if (codetest != NULL) {
ast_cli(fd, "Found module %s. Calling test functions. \n\n", name);
codetest(fd);
break;
@@ -400,11 +400,14 @@
m->reload = dlsym(m->lib, "reload");
if (m->reload == NULL)
m->reload = dlsym(m->lib, "_reload");
+
#ifdef ENABLE_CODE_TESTING
/* 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 (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())) {
@@ -625,7 +628,7 @@
}
-int ast_update_module_list(int (*modentry)(const char *module, const char *description, int usecnt, const char *like),
+int ast_update_module_list(int (*modentry)(const char *module, const char *description, int usecnt, const char *like, const char *codetest),
const char *like)
{
struct module *m;
@@ -636,7 +639,11 @@
unlock = 0;
m = module_list;
while (m) {
- total_mod_loaded += modentry(m->resource, m->description(), m->usecount(), like);
+#ifdef ENABLE_CODE_TEST
+ total_mod_loaded += modentry(m->resource, m->description(), m->usecount(), like, m->codetest ? "Y" : "N");
+#else
+ total_mod_loaded += modentry(m->resource, m->description(), m->usecount(), like, (const char *) NULL);
+#endif
m = m->next;
}
if (unlock)
More information about the asterisk-commits
mailing list