[asterisk-commits] dvossel: branch dvossel/test_api r234671 - /team/dvossel/test_api/main/test.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Dec 14 11:55:43 CST 2009
Author: dvossel
Date: Mon Dec 14 11:55:42 2009
New Revision: 234671
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=234671
Log:
generates test results in xml and txt formats to a custom defined file
Modified:
team/dvossel/test_api/main/test.c
Modified: team/dvossel/test_api/main/test.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/test_api/main/test.c?view=diff&rev=234671&r1=234670&r2=234671
==============================================================================
--- team/dvossel/test_api/main/test.c (original)
+++ team/dvossel/test_api/main/test.c Mon Dec 14 11:55:42 2009
@@ -612,13 +612,19 @@
static char *test_cli_generate_results(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
static const char * const option[] = { "xml", "txt", NULL };
+ const char *file = NULL;
int res = 0;
switch (cmd) {
case CLI_INIT:
e->command = "test generate results";
e->usage =
"Usage: test generate results\n"
- " Generates test results for tests that has been run.\n";
+ " Generates test results in either xml or txt format. An optional \n"
+ " file path may be provided to specify the location of the xml or\n"
+ " txt file\n"
+ " \nExample usage:\n"
+ " 'test generate results xml' this writes to a default file\n"
+ " 'test generate results xml /path/to/file.xml' writes to specified file\n";
return NULL;
case CLI_GENERATE:
if (a->pos == 3) {
@@ -626,22 +632,23 @@
}
return NULL;
case CLI_HANDLER:
-
/* verify input */
if (a->argc < 4 || a->argc > 5) {
return CLI_SHOWUSAGE;
} else if (!strcmp(a->argv[3], "xml")) {
- res = ast_test_generate_results(NULL, NULL, (a->argc == 5) ? a->argv[4] : DEFAULT_XML_PATH, NULL);
+ file = (a->argc == 5) ? a->argv[4] : DEFAULT_XML_PATH;
+ res = ast_test_generate_results(NULL, NULL, file, NULL);
} else if (!strcmp(a->argv[3], "txt")) {
+ file = (a->argc == 5) ? a->argv[4] : DEFAULT_TXT_PATH;
res = ast_test_generate_results(NULL, NULL, NULL, (a->argc == 5) ? a->argv[4] : DEFAULT_TXT_PATH);
} else {
return CLI_SHOWUSAGE;
}
if (!res) {
- ast_cli(a->fd, "Results Generated Successfully\n");
+ ast_cli(a->fd, "Results Generated Successfully: %s\n", S_OR(file, ""));
} else {
- ast_cli(a->fd, "Results Could Not Be Generated\n");
+ ast_cli(a->fd, "Results Could Not Be Generated: %s\n", S_OR(file, ""));
}
default:
return NULL;
More information about the asterisk-commits
mailing list