[asterisk-dev] [Code Review] astobj2 unit test

Russell Bryant russell at digium.com
Wed Feb 10 08:41:59 CST 2010



> On 2010-02-09 18:27:29, Russell Bryant wrote:
> > /trunk/tests/test_astobj2.c, lines 248-252
> > <https://reviewboard.asterisk.org/r/496/diff/1/?file=8066#file8066line248>
> >
> >     Another interesting test you could do at this point is an ao2_callback() on the whole container to make sure the ref count on every object is 1.  ao2_ref(obj, 0) gives you the current ref count.
> 
> David Vossel wrote:
>     I could add that check, but I don't know if it is necessary (plus it's another callback to every item in the container, one of the tests is 100,000 items).  If the ref count isn't perfect at this point we'll know about it when the destructor_count is checked at the end of the function.

fair enough.


> On 2010-02-09 18:27:29, Russell Bryant wrote:
> > /trunk/tests/test_astobj2.c, line 285
> > <https://reviewboard.asterisk.org/r/496/diff/1/?file=8066#file8066line285>
> >
> >     It could be that the destructor was called too many times, as well
> 
> David Vossel wrote:
>     true, so in that case I suppose destructor_count would be negative.

Right.  I was just pointing out that the wording implies that the only failure was that it was not called enough times.


- Russell


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/496/#review1487
-----------------------------------------------------------


On 2010-02-09 14:44:54, David Vossel wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/496/
> -----------------------------------------------------------
> 
> (Updated 2010-02-09 14:44:54)
> 
> 
> Review request for Asterisk Developers.
> 
> 
> Summary
> -------
> 
> This is a unit test for main/astobj2.c.  All the status update calls will be changed to match Russell's tweak once it is committed.  That is why I do not set the error string anywhere.
> 
> 
> Diffs
> -----
> 
>   /trunk/tests/test_astobj2.c PRE-CREATION 
> 
> Diff: https://reviewboard.asterisk.org/r/496/diff
> 
> 
> Testing
> -------
> 
> ran unit test, verified it passes. 
> 
> 
> Thanks,
> 
> David
> 
>




More information about the asterisk-dev mailing list