Hi,

I'm working on some changes to various parts of Asterisk that currently don't 
have good test coverage.

The easiest way (for what I'm doing) to add coverage is to interface with 
external commands that are known to provide correct results and test against 
them.

I've written a mockup of a function that runs a pipeline, collects stdout and 
stderr into buffers, and returns the processes exit code.

This is useful if, for instance, you generate data and want to verify it 
computationally internally, but then compare results with an external reference 
command.

It's also useful for commands that generate temporal (or ephemeral) results 
that can't use "canned" data in their generation.

Here's some details:

typedef struct {
        char *outbuf;
        size_t outlen;
        char *errbuf;
        size_t errlen;
        int exitcode;
} ast_test_capture_cmd_t;

int ast_test_capture_cmd_run(ast_test_capture_cmd_t *results, const char *cmd);

ast_test_capture_cmd_free(ast_test_capture_cmd_t *results);

Note that commands are run with stdin set to /dev/null.

What do you all think about adding this functionality?

Thanks,

-Philip


-- 
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-dev mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-dev

Reply via email to