[asterisk-commits] tilghman: branch tilghman/kill_stubs r276390 - in /team/tilghman/kill_stubs: ...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Jul 14 11:38:55 CDT 2010
Author: tilghman
Date: Wed Jul 14 11:38:45 2010
New Revision: 276390
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=276390
Log:
Add test for AGI in same module as tests for crypto and adsi
Modified:
team/tilghman/kill_stubs/res/res_adsi.c
team/tilghman/kill_stubs/res/res_crypto.c
team/tilghman/kill_stubs/tests/test_utils.c
Modified: team/tilghman/kill_stubs/res/res_adsi.c
URL: http://svnview.digium.com/svn/asterisk/team/tilghman/kill_stubs/res/res_adsi.c?view=diff&rev=276390&r1=276389&r2=276390
==============================================================================
--- team/tilghman/kill_stubs/res/res_adsi.c (original)
+++ team/tilghman/kill_stubs/res/res_adsi.c Wed Jul 14 11:38:45 2010
@@ -37,8 +37,6 @@
#include <time.h>
#include <math.h>
-#define AST_API_MODULE
-#include "asterisk/adsi.h"
#include "asterisk/ulaw.h"
#include "asterisk/alaw.h"
#include "asterisk/callerid.h"
@@ -47,6 +45,9 @@
#include "asterisk/module.h"
#include "asterisk/config.h"
#include "asterisk/file.h"
+
+#define AST_API_MODULE
+#include "asterisk/adsi.h"
#define DEFAULT_ADSI_MAX_RETRIES 3
Modified: team/tilghman/kill_stubs/res/res_crypto.c
URL: http://svnview.digium.com/svn/asterisk/team/tilghman/kill_stubs/res/res_crypto.c?view=diff&rev=276390&r1=276389&r2=276390
==============================================================================
--- team/tilghman/kill_stubs/res/res_crypto.c (original)
+++ team/tilghman/kill_stubs/res/res_crypto.c Wed Jul 14 11:38:45 2010
@@ -45,7 +45,6 @@
#include "asterisk/io.h"
#include "asterisk/lock.h"
#include "asterisk/utils.h"
-#include "asterisk/compiler.h"
#define AST_API_MODULE
#include "asterisk/crypto.h"
Modified: team/tilghman/kill_stubs/tests/test_utils.c
URL: http://svnview.digium.com/svn/asterisk/team/tilghman/kill_stubs/tests/test_utils.c?view=diff&rev=276390&r1=276389&r2=276390
==============================================================================
--- team/tilghman/kill_stubs/tests/test_utils.c (original)
+++ team/tilghman/kill_stubs/tests/test_utils.c Wed Jul 14 11:38:45 2010
@@ -37,6 +37,7 @@
#include "asterisk/test.h"
#include "asterisk/crypto.h"
#include "asterisk/adsi.h"
+#include "asterisk/agi.h"
#include "asterisk/channel.h"
#include "asterisk/module.h"
@@ -272,6 +273,47 @@
return ast_adsi_available(&c) ? AST_TEST_PASS : AST_TEST_FAIL;
}
+static int handle_noop(struct ast_channel *chan, AGI *agi, int arg, const char * const argv[])
+{
+ ast_agi_send(agi->fd, chan, "200 result=0\n");
+ return RESULT_SUCCESS;
+}
+
+AST_TEST_DEFINE(agi_loaded_test)
+{
+ int res = AST_TEST_PASS;
+ struct agi_command noop_command =
+ { { "testnoop", NULL }, handle_noop, NULL, NULL, 0 };
+
+ switch (cmd) {
+ case TEST_INIT:
+ info->name = "agi_loaded_test";
+ info->category = "res/agi/";
+ info->summary = "AGI loaded into memory";
+ info->description = "Verifies whether the agi functions overrode the stubs";
+ return AST_TEST_NOT_RUN;
+ case TEST_EXECUTE:
+ break;
+ }
+
+ if (ast_agi_register(ast_module_info->self, &noop_command) == 0) {
+ return AST_TEST_FAIL;
+ }
+
+#ifndef HAVE_NULLSAFE_PRINTF
+ /* Test for condition without actually crashing Asterisk */
+ if (noop_command.usage == NULL) {
+ res = AST_TEST_FAIL;
+ }
+ if (noop_command.syntax == NULL) {
+ res = AST_TEST_FAIL;
+ }
+#endif
+
+ ast_agi_unregister(ast_module_info->self, &noop_command);
+ return res;
+}
+
static int unload_module(void)
{
AST_TEST_UNREGISTER(uri_encode_decode_test);
@@ -280,6 +322,7 @@
AST_TEST_UNREGISTER(base64_test);
AST_TEST_UNREGISTER(crypto_loaded_test);
AST_TEST_UNREGISTER(adsi_loaded_test);
+ AST_TEST_UNREGISTER(agi_loaded_test);
return 0;
}
@@ -291,6 +334,7 @@
AST_TEST_REGISTER(base64_test);
AST_TEST_REGISTER(crypto_loaded_test);
AST_TEST_REGISTER(adsi_loaded_test);
+ AST_TEST_REGISTER(agi_loaded_test);
return AST_MODULE_LOAD_SUCCESS;
}
More information about the asterisk-commits
mailing list