mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-15 17:27:02 +00:00
Merged revisions 332817 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8 ........ r332817 | mjordan | 2011-08-22 13:15:51 -0500 (Mon, 22 Aug 2011) | 4 lines Review: https://reviewboard.asterisk.org/r/1364/ This update adds a new AMI event, TestEvent, which is enabled when the TEST_FRAMEWORK compiler flag is defined. It also adds initial usage of this event to app_voicemail. The TestEvent AMI event is used extensively by the voicemail tests in the Asterisk Test Suite. ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@332844 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -84,6 +84,7 @@
|
||||
#define EVENT_FLAG_HOOKRESPONSE (1 << 14) /* Hook Response */
|
||||
#define EVENT_FLAG_CC (1 << 15) /* Call Completion events */
|
||||
#define EVENT_FLAG_AOC (1 << 16) /* Advice Of Charge events */
|
||||
#define EVENT_FLAG_TEST (1 << 17) /* Test event used to signal the Asterisk Test Suite */
|
||||
/*@} */
|
||||
|
||||
/*! \brief Export manager structures */
|
||||
|
@@ -130,6 +130,62 @@
|
||||
|
||||
#endif
|
||||
|
||||
/*! Macros used for the Asterisk Test Suite AMI events */
|
||||
#ifdef TEST_FRAMEWORK
|
||||
|
||||
/*!
|
||||
* \brief Notifies the test suite of a change in application state
|
||||
*
|
||||
* \details
|
||||
* Raises a TestEvent manager event with a subtype of StateChange. Additional parameters
|
||||
* The fmt parameter allows additional parameters to be added to the manager event using
|
||||
* printf style statement formatting.
|
||||
*
|
||||
* \param state The state the application has changed to
|
||||
* \param fmt The message with format parameters to add to the manager event
|
||||
*
|
||||
* \returns 0 on success
|
||||
* \returns any other value on failure
|
||||
*/
|
||||
int __ast_test_suite_event_notify(const char *file, const char *func, int line,
|
||||
const char *state, const char *fmt, ...)
|
||||
__attribute__((format(printf, 5, 6)));
|
||||
|
||||
/*!
|
||||
* \brief Notifies the test suite of a failed assert on an expression
|
||||
*
|
||||
* \details
|
||||
* If the expression provided evaluates to true, no action is taken. If the expression
|
||||
* evaluates to a false, a TestEvent manager event is raised with a subtype of Assert, notifying
|
||||
* the test suite that the expression failed to evaluate to true.
|
||||
*
|
||||
* \param exp The expression to evaluate
|
||||
*
|
||||
* \returns 0 on success
|
||||
* \returns any other value on failure
|
||||
*/
|
||||
int __ast_test_suite_assert_notify(const char *file, const char *func, int line,
|
||||
const char *exp);
|
||||
|
||||
/*!
|
||||
* \ref __ast_test_suite_event_notify()
|
||||
*/
|
||||
#define ast_test_suite_event_notify(s, f, ...) \
|
||||
__ast_test_suite_event_notify(__FILE__, __PRETTY_FUNCTION__, __LINE__, (s), (f), ## __VA_ARGS__)
|
||||
|
||||
/*!
|
||||
* \ref __ast_test_suite_assert_notify()
|
||||
*/
|
||||
#define ast_test_suite_assert(exp) \
|
||||
( (exp) ? (void)0 : __ast_test_suite_assert_notify(__FILE__, __PRETTY_FUNCTION__, __LINE__, #exp))
|
||||
|
||||
#else
|
||||
|
||||
#define ast_test_suite_event_notify(s, f, ...) (void)0;
|
||||
#define ast_test_suite_assert(exp) (void)0;
|
||||
|
||||
#endif
|
||||
|
||||
enum ast_test_result_state {
|
||||
AST_TEST_NOT_RUN,
|
||||
AST_TEST_PASS,
|
||||
|
Reference in New Issue
Block a user