]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Add test instrumentation
authorKinsey Moore <kmoore@digium.com>
Mon, 13 Aug 2012 20:42:55 +0000 (20:42 +0000)
committerKinsey Moore <kmoore@digium.com>
Mon, 13 Aug 2012 20:42:55 +0000 (20:42 +0000)
This adds test instrumentation for loading and unloading of modules
and for certain actions in MeetMe to be used in the testsuite or any
other consumer of AMI events.  These will only be generated when
Asterisk is built with TEST_FRAMEWORK enabled.

(issue PQ-1131)
(issue PQ-1133)
........

Merged revisions 371201 from http://svn.asterisk.org/svn/asterisk/branches/1.8

git-svn-id: https://origsvn.digium.com/svn/asterisk/certified/branches/1.8.15@371229 65c4cc65-6c06-0410-ace0-fbb531ad65f3

apps/app_meetme.c
main/loader.c

index 51fcd8091657a3d299a3330173bd96b7a86e3b63..94193a647d55e4d47269d724aa617f332760ef2b 100644 (file)
@@ -2753,6 +2753,7 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, struc
                        ast_channel_setoption(chan, AST_OPTION_TONE_VERIFY, &x, sizeof(char), 0);
                }
        } else {
+               int lastusers = conf->users;
                if (user->dahdichannel && ast_test_flag64(confflags, CONFFLAG_STARMENU)) {
                        /*  Set CONFMUTE mode on DAHDI channel to mute DTMF tones when the menu is enabled */
                        x = 1;
@@ -3032,7 +3033,15 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, struc
                                }
                                break;
                        }
-       
+
+                       /* Throw a TestEvent if a user exit did not cause this user to leave the conference */
+                       if (conf->users != lastusers) {
+                               if (conf->users < lastusers) {
+                                       ast_test_suite_event_notify("NOEXIT", "Message: CONFFLAG_MARKEDEXIT\r\nLastUsers: %d\r\nUsers: %d", lastusers, conf->users);
+                               }
+                               lastusers = conf->users;
+                       }
+
                        /* Check if my modes have changed */
 
                        /* If I should be muted but am still talker, mute me */
index d643a7bd9d34e78327883bf7f2db9c53298e7955..3607af04a64b4f71295b416818c5fcf4e021a4d8 100644 (file)
@@ -54,6 +54,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 #include "asterisk/udptl.h"
 #include "asterisk/heap.h"
 #include "asterisk/app.h"
+#include "asterisk/test.h"
 
 #include <dlfcn.h>
 
@@ -567,8 +568,10 @@ int ast_unload_resource(const char *resource_name, enum ast_module_unload_mode f
                mod->info->restore_globals();
 
 #ifdef LOADABLE_MODULES
-       if (!error)
+       if (!error) {
                unload_dynamic_module(mod);
+               ast_test_suite_event_notify("MODULE_UNLOAD", "Message: %s", resource_name);
+       }
 #endif
 
        if (!error)
@@ -893,6 +896,7 @@ int ast_load_resource(const char *resource_name)
        int res;
        AST_LIST_LOCK(&module_list);
        res = load_resource(resource_name, 0, NULL, 0);
+       ast_test_suite_event_notify("MODULE_LOAD", "Message: %s", resource_name);
        AST_LIST_UNLOCK(&module_list);
 
        return res;