]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Add module reload instrumentation for TEST_FRAMEWORK
authorKinsey Moore <kmoore@digium.com>
Thu, 16 Aug 2012 22:42:53 +0000 (22:42 +0000)
committerKinsey Moore <kmoore@digium.com>
Thu, 16 Aug 2012 22:42:53 +0000 (22:42 +0000)
This adds AMI events for module reloads when Asterisk is built with
TEST_FRAMEWORK enabled and corrects generation of the module load AMI
event.

(issue PQ-1126)
........

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

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

main/loader.c

index 4d1da976deed1825e99fdf409733ec38f6085a38..e69a82cfc2543bdc1511849c6225f59c5d00264f 100644 (file)
@@ -745,6 +745,8 @@ int ast_module_reload(const char *name)
                }
 
                if (!info->reload) {    /* cannot be reloaded */
+                       /* Nothing to reload, so reload is successful */
+                       ast_test_suite_event_notify("MODULE_RELOAD", "Message: %s", cur->resource);
                        if (res < 1)    /* store result if possible */
                                res = 1;        /* 1 = no reload() method */
                        continue;
@@ -752,7 +754,9 @@ int ast_module_reload(const char *name)
 
                res = 2;
                ast_verb(3, "Reloading module '%s' (%s)\n", cur->resource, info->description);
-               info->reload();
+               if (!info->reload()) {
+                       ast_test_suite_event_notify("MODULE_RELOAD", "Message: %s", cur->resource);
+               }
        }
        AST_LIST_UNLOCK(&module_list);
 
@@ -902,7 +906,9 @@ 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);
+       if (!res) {
+               ast_test_suite_event_notify("MODULE_LOAD", "Message: %s", resource_name);
+       }
        AST_LIST_UNLOCK(&module_list);
 
        return res;