aboutsummaryrefslogtreecommitdiffstats
path: root/main/test.c
AgeCommit message (Collapse)AuthorFilesLines
2010-07-09Kill some startup warnings and errors and make some messages more helpful in ↵tilghman1-1/+1
tracking down the source. git-svn-id: http://svn.digium.com/svn/asterisk/trunk@275105 f38db490-d61c-443f-a65b-d21fe96a405b
2010-07-09Merged revisions 275021 via svnmerge from russell1-0/+5
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: http://svn.digium.com/svn/asterisk/trunk@275022 f38db490-d61c-443f-a65b-d21fe96a405b
2010-03-23Put test output for a failure in a CDATA section in the XML results.russell1-1/+1
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@254159 f38db490-d61c-443f-a65b-d21fe96a405b
2010-03-20Resolve more compiler warnings on FreeBSD.russell1-1/+1
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@253540 f38db490-d61c-443f-a65b-d21fe96a405b
2010-03-17main/test.c reports erroneous CLI message.lmadsen1-1/+1
(closes issue #17051) Reported by: Nick_Lewis git-svn-id: http://svn.digium.com/svn/asterisk/trunk@253205 f38db490-d61c-443f-a65b-d21fe96a405b
2010-03-03Changes 0ms to <1ms in cli END results during 'test execute'dvossel1-2/+3
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@250478 f38db490-d61c-443f-a65b-d21fe96a405b
2010-03-03fixes assumption that test failed if it did not pass when generating resultsdvossel1-1/+1
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@250237 f38db490-d61c-443f-a65b-d21fe96a405b
2010-02-26adds Time field to "test show results" cli commanddvossel1-4/+7
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@249186 f38db490-d61c-443f-a65b-d21fe96a405b
2010-02-17Fix a couple of bugs in test tab completion.mmichelson1-1/+3
1. Add missing unlock of lists. 2. Swap order of arguments to test_cat_cmp in complete_test_name. git-svn-id: http://svn.digium.com/svn/asterisk/trunk@247381 f38db490-d61c-443f-a65b-d21fe96a405b
2010-02-17Tab completion for test categories and names for "test show registered" and ↵mmichelson1-1/+47
"test execute" CLI commands. git-svn-id: http://svn.digium.com/svn/asterisk/trunk@247380 f38db490-d61c-443f-a65b-d21fe96a405b
2010-02-09Various updates to the unit test API.russell1-85/+86
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-07Remove an extra space.russell1-1/+1
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@245268 f38db490-d61c-443f-a65b-d21fe96a405b
2010-02-04fix truncated format string in 'test show registered'dvossel1-2/+2
When using the 'test show registered' cli command the 'Test Results' category was truncating the last few characters making it look like 'Test Resul'. I also expanded other parts of the format to better represent how long function names and categories will likely be. git-svn-id: http://svn.digium.com/svn/asterisk/trunk@244688 f38db490-d61c-443f-a65b-d21fe96a405b
2010-01-26modify 'test show registered' cli output formatdvossel1-2/+2
In order to improve readability, the output from 'test show registered' has been modified to truncate fields to fit within the format output if they are over a certain length. git-svn-id: http://svn.digium.com/svn/asterisk/trunk@243242 f38db490-d61c-443f-a65b-d21fe96a405b
2010-01-26RFC compliant uri and display-name encode/decodedvossel1-3/+0
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-22Update the doxygenification of some comments.russell1-13/+13
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@242186 f38db490-d61c-443f-a65b-d21fe96a405b
2010-01-21Point to a useful reference on the XML output format.russell1-0/+3
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@241856 f38db490-d61c-443f-a65b-d21fe96a405b
2010-01-21Modify test results XML format to match the JUnit format.russell1-22/+16
When this code was developed, we came up with our own XML format for the test output. I have since started looking at integration with other tools, namely continuous integration frameworks, and this format seems to be supported across a number of applications. With these changes in place, I was able to get Atlassian Bamboo to interpret the test results. git-svn-id: http://svn.digium.com/svn/asterisk/trunk@241855 f38db490-d61c-443f-a65b-d21fe96a405b
2010-01-11Fix spelling of 'category.'seanbright1-4/+4
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@239111 f38db490-d61c-443f-a65b-d21fe96a405b
2009-12-22Unit Test Framework APIdvossel1-0/+845
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