[Asterisk-Dev] Module testing framework

Olle E Johansson oej at edvina.net
Thu Dec 22 07:34:26 MST 2005


Where: http://svn.digium.com/svn/asterisk/team/oej/moduletest/


This is a framework for implementing embedded test functions within the 
source code of Asterisk. It's enabled by a compile time option in 
Makefile. If enabled, a CLI command called "testmodule" starts tests, if 
given a module name.

I have missed this while working with parsers in chan_sip and some other 
modules. There are some complex routines out there and we need to start 
building test code to make sure that one change to simplify code or add 
a new feature does not break what is expected to work.

Please look at this and give some feedback.

Rough description:

- In Makefile, I've enabled code testing
- In loader.c, I've added a check for a function named "codetest" in a 
module
- I've added a field to show modules to show if a module has testing 
functionality
- I've added a template function to chan_sip.c just to see if it works

Nothing will be changed if the option is not enabled in the makefile. 
All of this code will *only* be compiled and enabled if the user wants 
it to be. And none of these tests have to make any sense to normal 
users, it's a developer's tool.

One thing that could be great would be to develop an embedded test suite 
for the realtime architecture, in order to test new drivers.

Please take a look!

/Olle



More information about the asterisk-dev mailing list