aboutsummaryrefslogtreecommitdiffstats
path: root/tests
AgeCommit message (Collapse)AuthorFilesLines
2010-03-02base64 unit testdvossel1-0/+54
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@250235 f38db490-d61c-443f-a65b-d21fe96a405b
2010-02-24Add ASTERISK_FILE_VERSION macro.russell1-2/+6
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@248533 f38db490-d61c-443f-a65b-d21fe96a405b
2010-02-23Unit test for ast_str API.mmichelson1-0/+261
Review: https://reviewboard.asterisk.org/r/517 git-svn-id: http://svn.digium.com/svn/asterisk/trunk@248489 f38db490-d61c-443f-a65b-d21fe96a405b
2010-02-22Tweak copyright and author lines.russell1-2/+2
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@248225 f38db490-d61c-443f-a65b-d21fe96a405b
2010-02-17Add support for GROUP_MATCH_COUNT regex matching on categoryjpeeler1-0/+159
Current support for regex matching was previously only available on the group. Also, error reporting for regex failures has been added. In addition to this feature enhancement a unit test has been written to check the regular expression logic to ensure the count operation is working as expected. (closes issue #16642) Reported by: kobaz Patches: groupmatch2.patch uploaded by kobaz (license 834) Review: https://reviewboard.asterisk.org/r/503/ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@247295 f38db490-d61c-443f-a65b-d21fe96a405b
2010-02-17modified device2extension_test's categorydvossel1-1/+1
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@247282 f38db490-d61c-443f-a65b-d21fe96a405b
2010-02-17unit test for combined device state mapping and device to exten state mappingdvossel1-0/+288
Review: https://reviewboard.asterisk.org/r/516/ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@247262 f38db490-d61c-443f-a65b-d21fe96a405b
2010-02-16Add unit test for dialplan pattern matching.mmichelson1-0/+330
This test works by reading input from arrays to build a sample dialplan. From there, patterns are attempted to be matched against said dialplan, with the expected match given. We then search in our example dialplan to see if we find a match and if what we find matches what we expected it to match. (closes issue #16809) Reported by: lmadsen Tested by: mmichelson Review: https://reviewboard.asterisk.org/r/504/ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@246942 f38db490-d61c-443f-a65b-d21fe96a405b
2010-02-11fixes some test description formatting inconsistencies so log file looks nicedvossel2-4/+2
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@246338 f38db490-d61c-443f-a65b-d21fe96a405b
2010-02-11astobj2 unit test and bug fixdvossel1-0/+379
A bug was discovered during the creation of the astobj2 unit test. When OBJ_MULTIPLE | OBJ_UNLINK is used, the objects being returned had a ref count issue. This patch resolves that. Review: https://reviewboard.asterisk.org/r/496/ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@246299 f38db490-d61c-443f-a65b-d21fe96a405b
2010-02-10Add a test module for the event API, test_event.c.russell1-0/+194
This module includes a single test so far that creates events using two different methods and does some verification on the result to make sure the correct data can be retrieved from the event that was created. One bug was found in the event API while developing this test, which makes me happy. :-) Review: https://reviewboard.asterisk.org/r/495/ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@246260 f38db490-d61c-443f-a65b-d21fe96a405b
2010-02-09Various updates to the unit test API.russell8-305/+200
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: http://svn.digium.com/svn/asterisk/trunk@245864 f38db490-d61c-443f-a65b-d21fe96a405b
2010-02-08UNREGISTER instead of REGISTER in unload_module().russell1-1/+1
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@245623 f38db490-d61c-443f-a65b-d21fe96a405b
2010-02-08Add a SHA1 test module.russell1-0/+100
Review: https://reviewboard.asterisk.org/r/492/ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@245345 f38db490-d61c-443f-a65b-d21fe96a405b
2010-02-08Remove unnecessary include, ast_md5_hash() comes from utils.h.russell1-1/+0
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@245344 f38db490-d61c-443f-a65b-d21fe96a405b
2010-02-07Add an MD5 test module.russell1-0/+98
Review: https://reviewboard.asterisk.org/r/491/ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@245307 f38db490-d61c-443f-a65b-d21fe96a405b
2010-02-07Fix a couple of spelling errors, and add format module dependencies.russell1-2/+13
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@245306 f38db490-d61c-443f-a65b-d21fe96a405b
2010-02-05Merge tests that verify the same thing. (Oops.)tilghman1-0/+4
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@245046 f38db490-d61c-443f-a65b-d21fe96a405b
2010-01-26RFC compliant uri and display-name encode/decodedvossel1-0/+114
1. URI Encoding This patch changes ast_uri_encode()'s behavior when doreserved is enabled. Previously when doreserved was enabled only a small set of reserved characters were encoded. This set was comprised primarily of the reserved characters defined in RFC3261 section 25.1, but contained other characters as well. Rather than only escaping the reserved set, doreserved now escapes all characters not within the unreserved set as defined by RFC 3261 and RFC 2396. Also, the 'doreserved' variable has been renamed to 'do_special_char' in attempts to avoid confusion. When doreserve is not enabled, the previous logic of only encoding the characters <= 0X1F and > 0X7f remains, except for the '%' character, which must always be encoded as it signifies a HEX escaped character during the decode process. 2. URI Decoding: Break up URI before decode. In chan_sip.c ast_uri_decode is called on the entire URI instead of it's individual parts after it is parsed. This is not good as ast_uri_decode can introduce special characters back into the URI which can mess up parsing. This patch resolves this by not decoding a URI until parsing is completely done. There are many instances where we check to see if pedantic checking is enabled before we decode a URI. In these cases a new macro, SIP_PEDANTIC_DECODE, is used on the individual parsed segments of the URI rather than constantly putting if (pedantic) { decode() } checks everywhere in the code. In the areas where ast_uri_decode is not dependent upon pedantic checking this macro is not used, but decoding is still moved to each individual part of the URI. The only behavior that should change from this patch is the time at which decoding occurs. Since I had to look over every place URI parsing occurs to create this patch, I found several places where we use duplicate code for parsing. To consolidate the code, those areas have updated to use the parse_uri() function where possible. 3. SIP display-name decoding according to RFC3261 section 25. To properly decode the display-name portion of a FROM header, chan_sip's get_calleridname() function required a complete re-write. More information about this change can be found in the comments at the beginning of this function. 4. Unit Tests. Unit tests for ast_uri_encode, ast_uri_decode, and get_calleridname() have been written. This involved the addition of the test_utils.c file for testing the utils api. (closes issue #16299) Reported by: wdoekes Patches: astsvn-16299-get_calleridname.diff uploaded by wdoekes (license 717) get_calleridname_rewrite.diff uploaded by dvossel (license 671) Tested by: wdoekes, dvossel, Nick_Lewis Review: https://reviewboard.asterisk.org/r/469/ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@243200 f38db490-d61c-443f-a65b-d21fe96a405b
2010-01-26Log the variable name being tested.russell1-1/+1
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@243158 f38db490-d61c-443f-a65b-d21fe96a405b
2010-01-26Update test_substitution to show failures in the test log.russell1-2/+15
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@243157 f38db490-d61c-443f-a65b-d21fe96a405b
2010-01-26Fixing last errors in the conversion, though it appears that the AES_* ↵tilghman1-4/+4
functions are still broken. git-svn-id: http://svn.digium.com/svn/asterisk/trunk@243077 f38db490-d61c-443f-a65b-d21fe96a405b
2010-01-26Using a dummy channel causes CDR() testing to fail.tilghman1-2/+2
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@243076 f38db490-d61c-443f-a65b-d21fe96a405b
2010-01-26Wish I had gotten to the review before this got submitted, because there's ↵tilghman1-20/+15
failures we need to address. git-svn-id: http://svn.digium.com/svn/asterisk/trunk@243075 f38db490-d61c-443f-a65b-d21fe96a405b
2010-01-25Make unit test modules depend on TEST_FRAMEWORK instead of off by default.russell5-5/+5
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@242965 f38db490-d61c-443f-a65b-d21fe96a405b
2010-01-25Convert test_substitution module to the unit test API.russell1-84/+138
Review: https://reviewboard.asterisk.org/r/474/ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@242954 f38db490-d61c-443f-a65b-d21fe96a405b
2010-01-22The irony of not compile-testing a test program before committing is killing me.tilghman1-0/+1
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@242317 f38db490-d61c-443f-a65b-d21fe96a405b
2010-01-22Convert scheduler API entry order test to the test API.russell1-37/+39
Review: https://reviewboard.asterisk.org/r/470/ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@242185 f38db490-d61c-443f-a65b-d21fe96a405b
2010-01-22Add test API usage example to test_skel.c.russell1-8/+35
Review: https://reviewboard.asterisk.org/r/471/ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@242184 f38db490-d61c-443f-a65b-d21fe96a405b
2010-01-08Added a test for ast_format_reduce_str().mnicholson1-0/+117
(related to issue #16560) git-svn-id: http://svn.digium.com/svn/asterisk/trunk@238716 f38db490-d61c-443f-a65b-d21fe96a405b
2009-12-22Unit Test Framework APIdvossel1-70/+52
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: http://svn.digium.com/svn/asterisk/trunk@236027 f38db490-d61c-443f-a65b-d21fe96a405b
2009-11-06ami_testhooks.c automatically registers hookdbrooks1-9/+63
ami_testhooks.c was registering for AMI events upon module load. Moved the registration to its own CLI command. Added CLI command for unregistering the hook. Changed some of the wording, removed unnecessary arguments/parameters. Reported by: rmudgett git-svn-id: http://svn.digium.com/svn/asterisk/trunk@228661 f38db490-d61c-443f-a65b-d21fe96a405b
2009-11-03AMI hook interfacedbrooks1-0/+104
This patch, originally submitted by jozza, enables custom modules to send actions to AMI and receive messages from AMI via a hook interface. Included is a simple test module to illustrate the interface. (closes issue #14635) Reported by: jozza Review: https://reviewboard.asterisk.org/r/412/ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@227448 f38db490-d61c-443f-a65b-d21fe96a405b
2009-07-11Add an API for reporting security events, and a security event logging module.russell2-0/+672
This commit introduces the security events API. This API is to be used by Asterisk components to report events that have security implications. A simple example is when a connection is made but fails authentication. These events can be used by external tools manipulate firewall rules or something similar after detecting unusual activity based on security events. Inside of Asterisk, the events go through the ast_event API. This means that they have a binary encoding, and it is easy to write code to subscribe to these events and do something with them. One module is provided that is a subscriber to these events - res_security_log. This module turns security events into a parseable text format and sends them to the "security" logger level. Using logger.conf, these log entries may be sent to a file, or to syslog. One service, AMI, has been fully updated for reporting security events. AMI was chosen as it was a fairly straight forward service to convert. The next target will be chan_sip. That will be more complicated and will be done as its own project as the next phase of security events work. For more information on the security events framework, see the documentation generated from doc/tex/. "make asterisk.pdf" Review: https://reviewboard.asterisk.org/r/273/ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@206021 f38db490-d61c-443f-a65b-d21fe96a405b
2009-06-26Merge the new Channel Event Logging (CEL) subsystem.russell1-2/+2
CEL is the new system for logging channel events. This was inspired after facing many problems trying to represent what is possible to happen to a call in Asterisk using CDR records. For more information on CEL, see the built in HTML or PDF documentation generated from the files in doc/tex/. Many thanks to Steve Murphy (murf) and Brian Degenhardt (bmd) for their hard work developing this code. Also, thanks to Matt Nicholson (mnicholson) and Sean Bright (seanbright) for their assistance in the final push to get this code ready for Asterisk trunk. Review: https://reviewboard.asterisk.org/r/239/ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@203638 f38db490-d61c-443f-a65b-d21fe96a405b
2009-05-15Add ability for modules to dynamically register logger levelskpfleming1-0/+209
This patch adds the ability for modules to dynamically create logger levels for their own use; these are named levels just like the built-in levels, and can be directed to any destination that the logger can send any level to, by including their names in logger.conf. Review: https://reviewboard.asterisk.org/r/244/ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@194610 f38db490-d61c-443f-a65b-d21fe96a405b
2009-05-04Minor changes in test moduleskpfleming2-1/+2
Correct command description in test_sched.c and include asterisk/cli.h in test_skel.c, since it's highly unlikely that a test module will *not* want to provide CLI commands to execute the tests git-svn-id: http://svn.digium.com/svn/asterisk/trunk@191997 f38db490-d61c-443f-a65b-d21fe96a405b
2009-04-29Merge str_substitution branch.tilghman1-0/+241
This branch adds additional methods to dialplan functions, whereby the result buffers are now dynamic buffers, which can be expanded to the size of any result. No longer are variable substitutions limited to 4095 bytes of data. In addition, the common case of needing buffers much smaller than that will enable substitution to only take up the amount of memory actually needed. The existing variable substitution routines are still available, but users of those API calls should transition to using the dynamic-buffer APIs. Reviewboard: http://reviewboard.digium.com/r/174/ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@191140 f38db490-d61c-443f-a65b-d21fe96a405b
2009-04-10Disable test modules by default.russell2-0/+8
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@187675 f38db490-d61c-443f-a65b-d21fe96a405b
2009-02-23Fix a regression in scheduler entry ordering, and add a regression test for it.russell1-2/+117
(closes issue #14522) Reported by: pj Tested by: russell git-svn-id: http://svn.digium.com/svn/asterisk/trunk@178022 f38db490-d61c-443f-a65b-d21fe96a405b
2009-02-17Use constants from inttypes.h to clear up 32-bit compilation errorsmmichelson1-2/+4
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@176706 f38db490-d61c-443f-a65b-d21fe96a405b
2009-02-17Significantly improve scheduler performance under high load.russell1-0/+130
This patch changes the scheduler to use a max-heap to store pending scheduler entries instead of a fully sorted doubly linked list. When the number of entries in the scheduler gets large, this will perform much better. For much more detailed information on this change, see the review request. Review: http://reviewboard.digium.com/r/160/ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@176639 f38db490-d61c-443f-a65b-d21fe96a405b
2009-02-17Add a test module for the heap implementation.russell1-0/+219
Review: http://reviewboard.digium.com/r/160/ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@176635 f38db490-d61c-443f-a65b-d21fe96a405b
2008-04-16Introducing doubly linked lists to trunk from branch team/murf/bug11210.murf1-0/+363
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@114172 f38db490-d61c-443f-a65b-d21fe96a405b
2008-01-03add some simple infrastructure for modules to be used for testing parts of ↵kpfleming2-0/+74
Asterisk git-svn-id: http://svn.digium.com/svn/asterisk/trunk@96272 f38db490-d61c-443f-a65b-d21fe96a405b