[asterisk-dev] [Code Review] Unit Test Framework
David Vossel
dvossel at digium.com
Wed Dec 16 15:19:53 CST 2009
> On 2009-12-15 18:56:41, Russell Bryant wrote:
> > /trunk/include/asterisk/test.h, lines 30-31
> > <https://reviewboard.asterisk.org/r/447/diff/1/?file=7560#file7560line30>
> >
> > It would be awesome if you could doxygenify this comment block.
struct foo {
int i;
long l;
};
.
.
.
struct foo pancakes[3] = { { 1, }, { 2, }, { 3, } }; /* the ',' after each } gets treated as an argument to the macro for some reason. */
> On 2009-12-15 18:56:41, Russell Bryant wrote:
> > /trunk/include/asterisk/test.h, lines 54-60
> > <https://reviewboard.asterisk.org/r/447/diff/1/?file=7560#file7560line54>
> >
> > What is an example that you hit that broke it?
see the comment above this, I wrote it in the wrong block.
> On 2009-12-15 18:56:41, Russell Bryant wrote:
> > /trunk/include/asterisk/test.h, lines 140-173
> > <https://reviewboard.asterisk.org/r/447/diff/1/?file=7560#file7560line140>
> >
> > Do we expect these to be used anywhere else other than the CLI functions? If not, there is no reason to make them public API calls.
> >
> > We can always make them public API calls later if needed.
This was written with the assumption that the CLI may not be the only interface using this api in the future. I have no plans at the moment to use them anywhere else though. Does it hurt anything to keep them exposed?
> On 2009-12-15 18:56:41, Russell Bryant wrote:
> > /trunk/main/test.c, lines 714-724
> > <https://reviewboard.asterisk.org/r/447/diff/1/?file=7562#file7562line714>
> >
> > Since ast_test_init() is outside of your ifdef block, Asterisk will fail to link if you disabled TEST_FRAMEWORK.
not at the moment. ast_test_init() is wrapped in a #ifdef TEST_FRAMEWORK block in asterisk.c.
> On 2009-12-15 18:56:41, Russell Bryant wrote:
> > /trunk/tests/test_heap.c, lines 77-79
> > <https://reviewboard.asterisk.org/r/447/diff/1/?file=7563#file7563line77>
> >
> > Do you think it would be useful to pass the CLI fd down to test functions to give them the ability to provide status output as tests execute?
I like this idea, but if this is done we are limiting the test framework to use the CLI. Is this something we want to do?
- David
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/447/#review1301
-----------------------------------------------------------
On 2009-12-15 18:15:17, David Vossel wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/447/
> -----------------------------------------------------------
>
> (Updated 2009-12-15 18:15:17)
>
>
> Review request for Asterisk Developers and Russell Bryant.
>
>
> Summary
> -------
>
> 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.
>
>
> Diffs
> -----
>
> /trunk/build_tools/cflags-devmode.xml 235225
> /trunk/include/asterisk/test.h PRE-CREATION
> /trunk/main/asterisk.c 235225
> /trunk/main/test.c PRE-CREATION
> /trunk/tests/test_heap.c 235225
>
> Diff: https://reviewboard.asterisk.org/r/447/diff
>
>
> Testing
> -------
>
> test_heap.c has been modified to take advantage of the Test Framework. I have executed and generated reports for these tests.
>
>
> Thanks,
>
> David
>
>
More information about the asterisk-dev
mailing list