summaryrefslogtreecommitdiff
path: root/tests/test_sorcery.c
diff options
context:
space:
mode:
authorMark Michelson <mmichelson@digium.com>2014-03-17 17:22:12 +0000
committerMark Michelson <mmichelson@digium.com>2014-03-17 17:22:12 +0000
commitd44aefeef476d744f2915d47c3fdc9b138cdd584 (patch)
tree59aa013e9a8c0fb7ab1607e2e98076dd88a60f1b /tests/test_sorcery.c
parent1900bae7b6cec9479ba0e89aed31d02aa71f3133 (diff)
Fix stuck channel in ARI through the introduction of synchronous bridge actions.
Playing back a file to a channel in an ARI bridge would attempt to wait until the playback concluded before returning. The method used involved signaling the waiting thread in the ARI custom playback function. The problem with this is that there were some corner cases that were not accounted for: * If a bridge channel could not be found, then we never would attempt the playback but would still attempt to wait for the playback to complete. * If the bridge playfile action failed to queue, we would still attempt to wait for the playback to complete. * If the bridge playfile action were queued but some circumstance caused the playback not to occur (the bridge dies, the channel is removed from the bridge), then we would never be notified. The solution to this is to move the waiting logic into the bridge code. A new bridge API function is added to queue a synchronous action on a bridge. The waiting thread is notified when the queued frame has been freed, either due to an error occurring or due to successful playback. As a failsafe, the waiting thread has a 10 minute timeout just in case there is a frame leak somewhere. Review: https://reviewboard.asterisk.org/r/3338 ........ Merged revisions 410673 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@410684 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'tests/test_sorcery.c')
-rw-r--r--tests/test_sorcery.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/tests/test_sorcery.c b/tests/test_sorcery.c
index ed4d604e6..aa34a11d3 100644
--- a/tests/test_sorcery.c
+++ b/tests/test_sorcery.c
@@ -306,7 +306,7 @@ static struct ast_sorcery *alloc_and_initialize_sorcery(void)
return NULL;
}
- if (ast_sorcery_apply_default(sorcery, "test", "memory", NULL) ||
+ if ((ast_sorcery_apply_default(sorcery, "test", "memory", NULL) != AST_SORCERY_APPLY_SUCCESS) ||
ast_sorcery_internal_object_register(sorcery, "test", test_sorcery_object_alloc, NULL, NULL)) {
ast_sorcery_unref(sorcery);
return NULL;
@@ -452,17 +452,17 @@ AST_TEST_DEFINE(apply_default)
return AST_TEST_FAIL;
}
- if (!ast_sorcery_apply_default(sorcery, "test", "dummy", NULL)) {
+ if (ast_sorcery_apply_default(sorcery, "test", "dummy", NULL) != AST_SORCERY_APPLY_FAIL) {
ast_test_status_update(test, "Successfully set a default wizard that doesn't exist\n");
return AST_TEST_FAIL;
}
- if (ast_sorcery_apply_default(sorcery, "test", "memory", NULL)) {
+ if (ast_sorcery_apply_default(sorcery, "test", "memory", NULL) != AST_SORCERY_APPLY_SUCCESS) {
ast_test_status_update(test, "Failed to set a known wizard as a default\n");
return AST_TEST_FAIL;
}
- if (!ast_sorcery_apply_default(sorcery, "test", "memory", NULL)) {
+ if (ast_sorcery_apply_default(sorcery, "test", "memory", NULL) != AST_SORCERY_APPLY_DEFAULT_UNNECESSARY) {
ast_test_status_update(test, "Successfully set a default wizard on a type twice\n");
return AST_TEST_FAIL;
}
@@ -493,7 +493,7 @@ AST_TEST_DEFINE(apply_config)
return AST_TEST_NOT_RUN;
}
- if (!ast_category_get(config, "test_sorcery")) {
+ if (!ast_category_get(config, "test_sorcery_section")) {
ast_test_status_update(test, "Sorcery configuration file does not have test_sorcery section\n");
ast_config_destroy(config);
return AST_TEST_NOT_RUN;
@@ -506,7 +506,7 @@ AST_TEST_DEFINE(apply_config)
return AST_TEST_FAIL;
}
- if (ast_sorcery_apply_config(sorcery, "test_sorcery")) {
+ if (ast_sorcery_apply_config(sorcery, "test_sorcery_section") != AST_SORCERY_APPLY_SUCCESS) {
ast_test_status_update(test, "Failed to apply configured object mappings\n");
return AST_TEST_FAIL;
}
@@ -535,7 +535,7 @@ AST_TEST_DEFINE(object_register)
return AST_TEST_FAIL;
}
- if (ast_sorcery_apply_default(sorcery, "test", "memory", NULL)) {
+ if (ast_sorcery_apply_default(sorcery, "test", "memory", NULL) != AST_SORCERY_APPLY_SUCCESS) {
ast_test_status_update(test, "Failed to set a known wizard as a default\n");
return AST_TEST_FAIL;
}
@@ -608,7 +608,7 @@ AST_TEST_DEFINE(object_field_register)
return AST_TEST_FAIL;
}
- if (ast_sorcery_apply_default(sorcery, "test", "memory", NULL)) {
+ if (ast_sorcery_apply_default(sorcery, "test", "memory", NULL) != AST_SORCERY_APPLY_SUCCESS) {
ast_test_status_update(test, "Failed to set a known wizard as a default\n");
return AST_TEST_FAIL;
}
@@ -657,7 +657,7 @@ AST_TEST_DEFINE(object_fields_register)
return AST_TEST_FAIL;
}
- if (ast_sorcery_apply_default(sorcery, "test", "memory", NULL)) {
+ if (ast_sorcery_apply_default(sorcery, "test", "memory", NULL) != AST_SORCERY_APPLY_SUCCESS) {
ast_test_status_update(test, "Failed to set a known wizard as a default\n");
return AST_TEST_FAIL;
}
@@ -1192,7 +1192,7 @@ AST_TEST_DEFINE(objectset_create_regex)
return AST_TEST_FAIL;
}
- if (ast_sorcery_apply_default(sorcery, "test", "memory", NULL) ||
+ if ((ast_sorcery_apply_default(sorcery, "test", "memory", NULL) != AST_SORCERY_APPLY_SUCCESS) ||
ast_sorcery_internal_object_register(sorcery, "test", test_sorcery_object_alloc, NULL, test_apply_handler)) {
ast_test_status_update(test, "Failed to register 'test' object type\n");
return AST_TEST_FAIL;
@@ -1292,7 +1292,7 @@ AST_TEST_DEFINE(objectset_apply_handler)
return AST_TEST_FAIL;
}
- if (ast_sorcery_apply_default(sorcery, "test", "memory", NULL) ||
+ if ((ast_sorcery_apply_default(sorcery, "test", "memory", NULL) != AST_SORCERY_APPLY_SUCCESS) ||
ast_sorcery_internal_object_register(sorcery, "test", test_sorcery_object_alloc, NULL, test_apply_handler)) {
ast_test_status_update(test, "Failed to register 'test' object type\n");
return AST_TEST_FAIL;
@@ -1387,7 +1387,7 @@ AST_TEST_DEFINE(objectset_transform)
return AST_TEST_FAIL;
}
- if (ast_sorcery_apply_default(sorcery, "test", "memory", NULL)) {
+ if (ast_sorcery_apply_default(sorcery, "test", "memory", NULL) != AST_SORCERY_APPLY_SUCCESS) {
ast_test_status_update(test, "Failed to set a known wizard as a default\n");
return AST_TEST_FAIL;
}
@@ -1453,7 +1453,7 @@ AST_TEST_DEFINE(objectset_apply_fields)
return AST_TEST_FAIL;
}
- if (ast_sorcery_apply_default(sorcery, "test", "memory", NULL) ||
+ if ((ast_sorcery_apply_default(sorcery, "test", "memory", NULL) != AST_SORCERY_APPLY_SUCCESS) ||
ast_sorcery_internal_object_register(sorcery, "test", test_sorcery_object_alloc, NULL, test_apply_handler)) {
ast_test_status_update(test, "Failed to register 'test' object type\n");
return AST_TEST_FAIL;
@@ -2244,7 +2244,7 @@ AST_TEST_DEFINE(caching_wizard_behavior)
goto end;
}
- if (ast_sorcery_apply_config(sorcery, "test_sorcery_cache")) {
+ if (ast_sorcery_apply_config(sorcery, "test_sorcery_cache") != AST_SORCERY_APPLY_SUCCESS) {
ast_test_status_update(test, "Failed to apply configured object mappings\n");
goto end;
}
@@ -2489,7 +2489,7 @@ AST_TEST_DEFINE(configuration_file_wizard)
return AST_TEST_FAIL;
}
- if (ast_sorcery_apply_default(sorcery, "test", "config", "test_sorcery.conf")) {
+ if (ast_sorcery_apply_default(sorcery, "test", "config", "test_sorcery.conf") != AST_SORCERY_APPLY_SUCCESS) {
ast_test_status_update(test, "Could not set a default wizard of the 'config' type, so skipping since it may not be loaded\n");
return AST_TEST_NOT_RUN;
}
@@ -2552,7 +2552,7 @@ AST_TEST_DEFINE(configuration_file_wizard_with_file_integrity)
return AST_TEST_FAIL;
}
- if (ast_sorcery_apply_default(sorcery, "test", "config", "test_sorcery.conf,integrity=file")) {
+ if (ast_sorcery_apply_default(sorcery, "test", "config", "test_sorcery.conf,integrity=file") != AST_SORCERY_APPLY_SUCCESS) {
ast_test_status_update(test, "Could not set a default wizard of the 'config' type, so skipping since it may not be loaded\n");
return AST_TEST_NOT_RUN;
}
@@ -2606,7 +2606,7 @@ AST_TEST_DEFINE(configuration_file_wizard_with_criteria)
return AST_TEST_FAIL;
}
- if (ast_sorcery_apply_default(sorcery, "test", "config", "test_sorcery.conf,criteria=type=zombies")) {
+ if (ast_sorcery_apply_default(sorcery, "test", "config", "test_sorcery.conf,criteria=type=zombies") != AST_SORCERY_APPLY_SUCCESS) {
ast_test_status_update(test, "Could not set a default wizard of the 'config' type, so skipping since it may not be loaded\n");
return AST_TEST_NOT_RUN;
}
@@ -2665,7 +2665,7 @@ AST_TEST_DEFINE(configuration_file_wizard_retrieve_field)
return AST_TEST_FAIL;
}
- if (ast_sorcery_apply_default(sorcery, "test", "config", "test_sorcery.conf")) {
+ if (ast_sorcery_apply_default(sorcery, "test", "config", "test_sorcery.conf") != AST_SORCERY_APPLY_SUCCESS) {
ast_test_status_update(test, "Could not set a default wizard of the 'config' type, so skipping since it may not be loaded\n");
return AST_TEST_NOT_RUN;
}
@@ -2728,7 +2728,7 @@ AST_TEST_DEFINE(configuration_file_wizard_retrieve_multiple)
return AST_TEST_FAIL;
}
- if (ast_sorcery_apply_default(sorcery, "test", "config", "test_sorcery.conf")) {
+ if (ast_sorcery_apply_default(sorcery, "test", "config", "test_sorcery.conf") != AST_SORCERY_APPLY_SUCCESS) {
ast_test_status_update(test, "Could not set a default wizard of the 'config' type, so skipping since it may not be loaded\n");
return AST_TEST_NOT_RUN;
}
@@ -2799,7 +2799,7 @@ AST_TEST_DEFINE(configuration_file_wizard_retrieve_multiple_all)
return AST_TEST_FAIL;
}
- if (ast_sorcery_apply_default(sorcery, "test", "config", "test_sorcery.conf")) {
+ if (ast_sorcery_apply_default(sorcery, "test", "config", "test_sorcery.conf") != AST_SORCERY_APPLY_SUCCESS) {
ast_test_status_update(test, "Could not set a default wizard of the 'config' type, so skipping since it may not be loaded\n");
return AST_TEST_NOT_RUN;
}