[asterisk-commits] rmudgett: branch 12 r403780 - in /branches/12: include/asterisk/ main/ tests/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Dec 13 13:55:33 CST 2013
Author: rmudgett
Date: Fri Dec 13 13:55:31 2013
New Revision: 403780
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=403780
Log:
test_voicemail_api: Add check for a registered voicemail provider before tests.
It is much nicer diagnosing a test failure if app_voicemail is actually
loaded.
........
Merged revisions 403726 from http://svn.asterisk.org/svn/asterisk/trunk
Modified:
branches/12/include/asterisk/app.h
branches/12/main/app.c
branches/12/tests/test_voicemail_api.c
Modified: branches/12/include/asterisk/app.h
URL: http://svnview.digium.com/svn/asterisk/branches/12/include/asterisk/app.h?view=diff&rev=403780&r1=403779&r2=403780
==============================================================================
--- branches/12/include/asterisk/app.h (original)
+++ branches/12/include/asterisk/app.h Fri Dec 13 13:55:31 2013
@@ -568,6 +568,15 @@
};
/*!
+ * \brief Determine if a voicemail provider is registered.
+ * \since 13.0.0
+ *
+ * \retval 0 if no privider registered.
+ * \retval 1 if a privider is registered.
+ */
+int ast_vm_is_registered(void);
+
+/*!
* \brief Set voicemail function callbacks
*
* \param vm_table Voicemail function table to install.
Modified: branches/12/main/app.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/main/app.c?view=diff&rev=403780&r1=403779&r2=403780
==============================================================================
--- branches/12/main/app.c (original)
+++ branches/12/main/app.c Fri Dec 13 13:55:31 2013
@@ -431,6 +431,17 @@
/*! Voicemail not registered warning */
static int vm_warnings;
+
+int ast_vm_is_registered(void)
+{
+ struct ast_vm_functions *table;
+ int is_registered;
+
+ table = ao2_global_obj_ref(vm_provider);
+ is_registered = table ? 1 : 0;
+ ao2_cleanup(table);
+ return is_registered;
+}
int __ast_vm_register(const struct ast_vm_functions *vm_table, struct ast_module *module)
{
Modified: branches/12/tests/test_voicemail_api.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/tests/test_voicemail_api.c?view=diff&rev=403780&r1=403779&r2=403780
==============================================================================
--- branches/12/tests/test_voicemail_api.c (original)
+++ branches/12/tests/test_voicemail_api.c Fri Dec 13 13:55:31 2013
@@ -72,7 +72,10 @@
* envelope files on the file system
*/
#define VM_API_TEST_SETUP do { \
- if (test_vm_api_test_setup()) { \
+ if (!ast_vm_is_registered()) { \
+ ast_test_status_update(test, "No voicemail provider registered.\n"); \
+ return AST_TEST_FAIL; \
+ } else if (test_vm_api_test_setup()) { \
VM_API_TEST_CLEANUP; \
ast_test_status_update(test, "Failed to set up necessary mock objects for voicemail API test\n"); \
return AST_TEST_FAIL; \
More information about the asterisk-commits
mailing list