summaryrefslogtreecommitdiff
path: root/include/asterisk/test.h
AgeCommit message (Collapse)Author
2017-05-24unittests: Add a unit test that causes a SEGV and...George Joseph
...that can only be run by explicitly calling it with 'test execute category /DO_NOT_RUN/ name RAISE_SEGV' This allows us to more easily test CI and debugging tools that should do certain things when asterisk coredumps. To allow this a new member was added to the ast_test_info structure named 'explicit_only'. If set by a test, the test will be skipped during a 'test execute all' or 'test execute category ...'. Change-Id: Ia3a11856aae4887df9a02b6b081cc777b36eb6ed
2015-06-24test.c: Add unit test registration checks for summary and description.Richard Mudgett
Added checks when a unit test is registered to see that the summary and description strings do not end with a new-line '\n' for consistency. The check generates a warning message and will cause the /main/test/registrations unit test to fail. * Updated struct ast_test_info member doxygen comments. Change-Id: I295909b6bc013ed9b6882e85c05287082497534d
2015-05-06vector: Additional enhancements and fixesGeorge Joseph
After using the new vector stuff for real I found... A bug in AST_VECTOR_INSERT_AT that could cause a seg fault. The callbacks needed to be closer to ao2_callback in behavior WRT to CMP_MATCH and CMP_STOP behavior and the ability to return a vector of matched entries. A pre-existing issue with APPEND and REPLACE was also fixed. I also added a new macro to test.h that acts like ast_test_validate but also accepts a return code variable and a cleanup label. As well as printing the error, it sets the rc variable to AST_TEST_FAIL and does a goto to the specified label on error. I had a local version of this in test_vector so I just moved it. ASTERISK-25045 Change-Id: I05e5e47fd02f61964be13b7e8942bab5d61b29cc
2014-12-05sorcery: Add additional observer capabilities.George Joseph
Add new global, instance and wizard observers. instance_created wizard_registered wizard_unregistered instance_destroying instance_loading instance_loaded wizard_mapped object_type_registered object_type_loading object_type_loaded wizard_loading wizard_loaded Tested-by: George Joseph Review: https://reviewboard.asterisk.org/r/4215/ ........ Merged revisions 428999 from http://svn.asterisk.org/svn/asterisk/branches/12 ........ Merged revisions 429000 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@429001 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-12-17Several components: fixing Typos in comments and code, "avaliable" instead ↵Rusty Newton
of "available" (issue ASTERISK-23021) (closes issue ASTERISK-23021) Reported by: Jeremy Lainé Tested by: Rusty Newton Patches: available.patch uploaded by Jeremy Lainé (license 6561) ........ Merged revisions 404046 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@404047 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-06-17Update Asterisk's CDRs for the new bridging frameworkMatthew Jordan
This patch is the initial push to update Asterisk's CDR engine for the new bridging framework. This patch guts the existing CDR engine and builds the new on top of messages coming across Stasis. As changes in channel state and bridge state are detected, CDRs are built and dispatched accordingly. This fundamentally changes CDRs in a few ways. (1) CDRs are now *very* reflective of the actual state of channels and bridges. This means CDRs track well with what an actual channel is doing - which is useful in transfer scenarios (which were previously difficult to pin down). It does, however, mean that CDRs cannot be 'fooled'. Previous behavior in Asterisk allowed for CDR applications, channels, and other properties to be spoofed in parts of the code - this no longer works. (2) CDRs have defined behavior in multi-party scenarios. This behavior will not be what everyone wants, but it is a defined behavior and as such, it is predictable. (3) The CDR manipulation functions and applications have been overhauled. Major changes have been made to ResetCDR and ForkCDR in particular. Many of the options for these two applications no longer made any sense with the new framework and the (slightly) more immutable nature of CDRs. There are a plethora of other changes. For a full description of CDR behavior, see the CDR specification on the Asterisk wiki. (closes issue ASTERISK-21196) Review: https://reviewboard.asterisk.org/r/2486/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@391947 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-03-30Convert TestEvent AMI events over to Stasis CoreMatthew Jordan
This patch migrates the TestEvent AMI events to first be dispatched over the Stasis-Core message bus. This helps to preserve the ordering of the events with other events in the AMI system, such as the various channel related events. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@384389 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-01-14Fixed doc comment for ast_test_validateDavid M. Lee
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@379070 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-01-11Add JSON API for Asterisk.David M. Lee
This provides a JSON API by pulling in and wrapping the Jansson JSON library[1]. The Asterisk API basically mirrors the Jansson functionality, with a few minor tweaks. * Some names have been asteriskified to protect the innocent. * Jansson provides both reference-stealing and reference-borrowing versions of several API's. The Asterisk API is exclusively reference-stealing for operations that put elements into arrays and objects. * No support for doubles, since we usually don't need that. * Coming along for the ride is the ast_test_validate macro, which made the unit tests much easier to write. [1]: http://www.digip.org/jansson/ (issue ASTERISK-20887) (closes issue ASTERISK-20888) Review: https://reviewboard.asterisk.org/r/2264/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@378915 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-01-09Tweaked __ast_test_suite_assert_notify() and __ast_test_suite_event_notify() ↵Richard Mudgett
to be void functions. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@378823 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-01-09* Whitespace changes.Richard Mudgett
* Made ast_test_init() match its prototype. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@378790 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-11-21Add red-black tree container type to astobj2.Richard Mudgett
* Add red-black tree container type. * Add CLI command "astobj2 container dump <name>" * Added ao2_container_dump() so the container could be dumped by other modules for debugging purposes. * Changed ao2_container_stats() so it can be used by other modules like ao2_container_check() for debugging purposes. * Updated the unit tests to check red-black tree containers. (closes issue ASTERISK-19970) Reported by: rmudgett Tested by: rmudgett Review: https://reviewboard.asterisk.org/r/2110/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@376575 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-08-22Merged revisions 332817 via svnmerge from Matthew Jordan
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
2010-07-09Merged revisions 275021 via svnmerge from Russell Bryant
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r275021 | russell | 2010-07-09 10:33:08 -0500 (Fri, 09 Jul 2010) | 4 lines Document that a leading and trailing slash is expected for test categories. Also, emit a warning if a test is registered without one of these. ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@275022 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-02-09Various updates to the unit test API.Russell Bryant
1) It occurred to me that the difference in usage between the error ast_str and the ast_test_update_status() usage has turned out to be a bit ambiguous in practice. In a lot of cases, the same message was being sent to both. In other cases, it was only sent to one or the other. My opinion now is that in every case, I think it makes sense to do both; we should output it to the CLI as well as save it off for logging purposes. This change results in most of the changes in this diff, since it required changes to all existing unit tests. It also allowed for some simplifications of unit test API implementation code. 2) Update ast_test_status_update() to include the file, function, and line number for the code providing the update. 3) There are some formatting tweaks here and there. Hopefully they aren't too distracting for code review purposes. Reviewboard's diff viewer seems to do a pretty good job of pointing out when something is a whitespace change. 4) I moved the md5_test and sha1_test into the test_utils module. It seemed like a better approach since these tests are so tiny. 5) I changed the number of nodes used in heap_test_2 from 1 million to 100 thousand. The only reason for this was to reduce the time it took for this test to run. 6) Remove an unused function prototype that was at the bottom of utils.h. 7) Simplify test_insert() using the LIST_INSERT_SORTALPHA() macro. The one minor difference in behavior is that it no longer checks for a test registered with the same name. 8) Expand the code in test_alloc() to provide specific error messages for each failure case, to clearly inform developers if they forget to set the name, summary, description, etc. 9) Tweak the output of the "test show registered" CLI command. I swapped the name and category to have the category first. It seemed more natural since that is the sort key. 10) Don't output the status ast_str in the "test show results" CLI command. This is going to tend to be pretty verbose, so just leave that for the detailed test logs (test generate results). Review: https://reviewboard.asterisk.org/r/493/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@245864 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-06fixes test.c compile issue when TEST_FRAMEWORK is not enabledDavid Vossel
The ast_test_status_update() function is defined in test.h. When TEST_FRAMEWORK is not enabled a macro is defined as a no-op place holder for this function. The macro did not contain the correct number of arguments. This caused a compile error. Much thanks to wdoekes for reporting the issue and supplying the patch! git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@238091 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-12-23Allow test_heap.c to compile when AST_DEVMODE is true, but TEST_FRAMEWORK is ↵Tilghman Lesher
false git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@236185 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-12-22Unit Test Framework APIDavid Vossel
The Unit Test Framework is a new API that manages registration and execution of unit tests in Asterisk with the purpose of verifying the operation of C functions. The Framework consists of a single test manager accompanied by a list of registered test functions defined within the code. A test is defined, registered, and unregistered from the framework using a set of macros which allow the test code to only be compiled within asterisk when the TEST_FRAMEWORK flag is enabled in menuselect. This allows the test code to exist in the same file as the C functions it intends to verify. Registered tests may be viewed and executed via a set of new CLI commands. CLI commands are also present for generating and exporting test results into xml and txt formats. For more information and use cases please refer to the documentation provided at the beginning of the test.h file. Review: https://reviewboard.asterisk.org/r/447/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@236027 65c4cc65-6c06-0410-ace0-fbb531ad65f3