Commit Graph

25 Commits

Author SHA1 Message Date
Richard Mudgett b27160406c test_substituition: Fix failed test reporting to actually report failure.
You cannot put the "Testing <blah> pass/fail" on a single line before
actually performing the test.  Now any additional failure information is
logged before the test pass/fail announcement.

* Added an additional CDR(answer,u) test.
........

Merged revisions 398018 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 398019 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 398023 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@398024 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-30 17:03:09 +00:00
Matthew Jordan da1f4f0c3d Fix the test_substitution test
In r391947, the CDR function was modified such that it will return a
value for the start,answer, and end times if asked. That time will just
be 0 if it hasn't happened yet.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@392190 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-06-18 22:37:09 +00:00
Terry Wilson a9d607a357 Opaquify ast_channel structs and lists
Review: https://reviewboard.asterisk.org/r/1773/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@357542 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-29 16:52:47 +00:00
Terry Wilson 6dcfd18308 Fix some tests that didn't get opaquification changes
Review: https://reviewboard.asterisk.org/r/1766/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@356397 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-23 01:53:17 +00:00
Terry Wilson 34c55e8e7c Opaquify char * and char[] in ast_channel
Review: https://reviewboard.asterisk.org/r/1733/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@354968 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-02-13 17:27:06 +00:00
Paul Belanger 606ca8ee8c Merged revisions 332177 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/10

................
  r332177 | pabelanger | 2011-08-16 16:11:49 -0400 (Tue, 16 Aug 2011) | 11 lines
  
  Merged revisions 332176 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.8
  
  ........
    r332176 | pabelanger | 2011-08-16 16:10:13 -0400 (Tue, 16 Aug 2011) | 4 lines
    
    Flag test modules as 'core'
    
    Review: https://reviewboard.asterisk.org/r/1369/
  ........
................


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@332178 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-08-16 20:15:23 +00:00
Leif Madsen a525edea59 Merged revisions 328247 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.10

................
  r328247 | lmadsen | 2011-07-14 16:25:31 -0400 (Thu, 14 Jul 2011) | 14 lines
  
  Merged revisions 328209 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.8
  
  ........
    r328209 | lmadsen | 2011-07-14 16:13:06 -0400 (Thu, 14 Jul 2011) | 6 lines
    
    Introduce <support_level> tags in MODULEINFO.
    This change introduces MODULEINFO into many modules in Asterisk in order to show
    the community support level for those modules. This is used by changes committed
    to menuselect by Russell Bryant recently (r917 in menuselect). More information about
    the support level types and what they mean is available on the wiki at
    https://wiki.asterisk.org/wiki/display/AST/Asterisk+Module+Support+States
  ........
................


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@328259 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-07-14 20:28:54 +00:00
Tilghman Lesher 6ec3c929ab Merged revisions 327793 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
  r327793 | tilghman | 2011-07-12 10:35:46 -0500 (Tue, 12 Jul 2011) | 14 lines
  
  Use 'printf' (POSIX issue 4) instead of 'echo -n', for portability.
  
  The problem with using 'echo -n' is that it is not portable.  While BSD systems
  required that the '-n' option be removed and interpreted, System V required
  that all strings should be echoed with no interpretation of options.  This
  fundamental difference of behavior means that it is never possible to use the
  '-n' flag to echo in tests which are meant to be portable.
  
  In this case, on Mac OS X 10.6, the /bin/sh shell builtin 'echo' uses the
  System V semantics of the command, and thus the SHELL test failed on that
  platform.
  
  http://pubs.opengroup.org/onlinepubs/009695399/utilities/echo.html#tag_04_41_16
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@327794 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-07-12 15:38:47 +00:00
Matthew Nicholson 0852fddf33 use printf instead of echo -n in substitution test
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@327684 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-07-11 20:06:28 +00:00
Matthew Nicholson 7eda60dca1 Merged revisions 327512 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
  r327512 | mnicholson | 2011-07-11 08:53:59 -0500 (Mon, 11 Jul 2011) | 2 lines
  
  reset our buffer each iteration when doing variable substitution
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@327513 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-07-11 13:55:28 +00:00
Matthew Nicholson 2ac180275d Merged revisions 327106 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
  r327106 | mnicholson | 2011-07-08 14:52:51 -0500 (Fri, 08 Jul 2011) | 11 lines
  
  Reset our ast_str before passing it on to dialplan function backends.
  
  It is possible for a dialplan backend to not modify the given buffer or ast_str
  and still return success. This causes any previous value stored in the buffer
  to be used as if the new function call provided it. Some functions also append
  to the given buffer assuming it is empty.
  
  The test_substitution unit test has also been modified to detect this problem.
  
  (closes issue ASTERISK-17878)
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@327107 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-07-08 19:54:23 +00:00
Richard Mudgett ec37ffbdaf ast_callerid restructuring
The purpose of this patch is to eliminate struct ast_callerid since it has
turned into a miscellaneous collection of various party information.

Eliminate struct ast_callerid and replace it with the following struct
organization:

struct ast_party_name {
	char *str;
	int char_set;
	int presentation;
	unsigned char valid;
};
struct ast_party_number {
	char *str;
	int plan;
	int presentation;
	unsigned char valid;
};
struct ast_party_subaddress {
	char *str;
	int type;
	unsigned char odd_even_indicator;
	unsigned char valid;
};
struct ast_party_id {
	struct ast_party_name name;
	struct ast_party_number number;
	struct ast_party_subaddress subaddress;
	char *tag;
};
struct ast_party_dialed {
	struct {
		char *str;
		int plan;
	} number;
	struct ast_party_subaddress subaddress;
	int transit_network_select;
};
struct ast_party_caller {
	struct ast_party_id id;
	char *ani;
	int ani2;
};

The new organization adds some new information as well.

* The party name and number now have their own presentation value that can
be manipulated independently.  ISDN supplies the presentation value for
the name and number at different times with the possibility that they
could be different.

* The party name and number now have a valid flag.  Before this change the
name or number string could be empty if the presentation were restricted.
Most channel drivers assume that the name or number is then simply not
available instead of indicating that the name or number was restricted.

* The party name now has a character set value.  SIP and Q.SIG have the
ability to indicate what character set a name string is using so it could
be presented properly.

* The dialed party now has a numbering plan value that could be useful to
have available.

The various channel drivers will need to be updated to support the new
core features as needed.  They have simply been converted to supply
current functionality at this time.


The following items of note were either corrected or enhanced:

* The CONNECTEDLINE() and REDIRECTING() dialplan functions were
consolidated into func_callerid.c to share party id handling code.

* CALLERPRES() is now deprecated because the name and number have their
own presentation values.

* Fixed app_alarmreceiver.c write_metadata().  The workstring[] could
contain garbage.  It also can only contain the caller id number so using
ast_callerid_parse() on it is silly.  There was also a typo in the
CALLERNAME if test.

* Fixed app_rpt.c using ast_callerid_parse() on the channel's caller id
number string.  ast_callerid_parse() alters the given buffer which in this
case is the channel's caller id number string.  Then using
ast_shrink_phone_number() could alter it even more.

* Fixed caller ID name and number memory leak in chan_usbradio.c.

* Fixed uninitialized char arrays cid_num[] and cid_name[] in
sig_analog.c.

* Protected access to a caller channel with lock in chan_sip.c.

* Clarified intent of code in app_meetme.c sla_ring_station() and
dial_trunk().  Also made save all caller ID data instead of just the name
and number strings.

* Simplified cdr.c set_one_cid().  It hand coded the ast_callerid_merge()
function.

* Corrected some weirdness with app_privacy.c's use of caller
presentation.

Review:	https://reviewboard.asterisk.org/r/702/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@276347 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-07-14 15:48:36 +00:00
Tilghman Lesher da8450323f Kill some startup warnings and errors and make some messages more helpful in tracking down the source.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@275105 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-07-09 17:00:22 +00:00
Russell Bryant 387f2eb733 test_substitution expects func_curl to be present to work.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@256783 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-04-12 02:19:02 +00:00
Tilghman Lesher dd3176cc91 It's amazing what writing a test will find.
(issue #16900)
 Reported by: bluecrow76


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@251677 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-03-10 20:30:34 +00:00
Russell Bryant bbed34f764 Various updates to the unit test API.
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-02-09 23:32:14 +00:00
Russell Bryant 2ce1ffc664 Log the variable name being tested.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@243158 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-26 15:46:53 +00:00
Russell Bryant 3e0463107e Update test_substitution to show failures in the test log.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@243157 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-26 15:35:40 +00:00
Tilghman Lesher 847b171f6b Fixing last errors in the conversion, though it appears that the AES_* functions are still broken.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@243077 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-26 01:56:24 +00:00
Tilghman Lesher 8d58f5bf37 Using a dummy channel causes CDR() testing to fail.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@243076 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-26 01:41:47 +00:00
Tilghman Lesher 114d259192 Wish I had gotten to the review before this got submitted, because there's failures we need to address.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@243075 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-26 01:35:19 +00:00
Russell Bryant 6ab50cb0e8 Make unit test modules depend on TEST_FRAMEWORK instead of off by default.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@242965 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-25 21:32:38 +00:00
Russell Bryant 8e50021376 Convert test_substitution module to the unit test API.
Review: https://reviewboard.asterisk.org/r/474/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@242954 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2010-01-25 21:25:23 +00:00
Russell Bryant 0264eef115 Merge the new Channel Event Logging (CEL) subsystem.
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: https://origsvn.digium.com/svn/asterisk/trunk@203638 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-06-26 15:28:53 +00:00
Tilghman Lesher a866a75900 Merge str_substitution branch.
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: https://origsvn.digium.com/svn/asterisk/trunk@191140 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-04-29 18:53:01 +00:00