[asterisk-commits] kpfleming: trunk r96272 - in /trunk: ./ tests/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jan 3 14:04:31 CST 2008


Author: kpfleming
Date: Thu Jan  3 14:04:30 2008
New Revision: 96272

URL: http://svn.digium.com/view/asterisk?view=rev&rev=96272
Log:
add some simple infrastructure for modules to be used for testing parts of Asterisk

Added:
    trunk/tests/   (with props)
    trunk/tests/Makefile
      - copied, changed from r96269, trunk/funcs/Makefile
    trunk/tests/test_skel.c
      - copied, changed from r96269, trunk/apps/app_skel.c
Modified:
    trunk/Makefile

Modified: trunk/Makefile
URL: http://svn.digium.com/view/asterisk/trunk/Makefile?view=diff&rev=96272&r1=96271&r2=96272
==============================================================================
--- trunk/Makefile (original)
+++ trunk/Makefile Thu Jan  3 14:04:30 2008
@@ -279,7 +279,7 @@
 #	#ifdef BUSYDETECT in main/dsp.c
 ASTCFLAGS+=$(MALLOC_DEBUG)$(BUSYDETECT)$(OPTIONS)
 
-MOD_SUBDIRS:=channels pbx apps codecs formats cdr funcs main res $(LOCAL_MOD_SUBDIRS)
+MOD_SUBDIRS:=channels pbx apps codecs formats cdr funcs tests main res $(LOCAL_MOD_SUBDIRS)
 OTHER_SUBDIRS:=utils agi
 SUBDIRS:=$(OTHER_SUBDIRS) $(MOD_SUBDIRS)
 SUBDIRS_INSTALL:=$(SUBDIRS:%=%-install)

Propchange: trunk/tests/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Jan  3 14:04:30 2008
@@ -1,0 +1,10 @@
+*.a
+*.d
+*.eo
+*.eoo
+*.i
+*.makeopts
+*.moduleinfo
+*.s
+*.so
+modules.link

Copied: trunk/tests/Makefile (from r96269, trunk/funcs/Makefile)
URL: http://svn.digium.com/view/asterisk/trunk/tests/Makefile?view=diff&rev=96272&p1=trunk/funcs/Makefile&r1=96269&p2=trunk/tests/Makefile&r2=96272
==============================================================================
--- trunk/funcs/Makefile (original)
+++ trunk/tests/Makefile Thu Jan  3 14:04:30 2008
@@ -1,9 +1,9 @@
 #
 # Asterisk -- A telephony toolkit for Linux.
 # 
-# Makefile for dialplan functions
+# Makefile for test modules
 #
-# Copyright (C) 2005-2006, Digium, Inc.
+# Copyright (C) 2008, Digium, Inc.
 #
 # This program is free software, distributed under the terms of
 # the GNU General Public License
@@ -11,9 +11,9 @@
 
 -include $(ASTTOPDIR)/menuselect.makeopts $(ASTTOPDIR)/menuselect.makedeps
 
-MODULE_PREFIX=func
-MENUSELECT_CATEGORY=FUNCS
-MENUSELECT_DESCRIPTION=Dialplan Functions
+MODULE_PREFIX=test
+MENUSELECT_CATEGORY=TEST
+MENUSELECT_DESCRIPTION=Test Modules
 
 all: _all
 

Copied: trunk/tests/test_skel.c (from r96269, trunk/apps/app_skel.c)
URL: http://svn.digium.com/view/asterisk/trunk/tests/test_skel.c?view=diff&rev=96272&p1=trunk/apps/app_skel.c&r1=96269&p2=trunk/tests/test_skel.c&r2=96272
==============================================================================
--- trunk/apps/app_skel.c (original)
+++ trunk/tests/test_skel.c Thu Jan  3 14:04:30 2008
@@ -18,12 +18,12 @@
 
 /*! \file
  *
- * \brief Skeleton application
+ * \brief Skeleton Test
  *
  * \author\verbatim <Your Name Here> <<Your Email Here>> \endverbatim
  * 
- * This is a skeleton for development of an Asterisk application 
- * \ingroup applications
+ * This is a skeleton for development of an Asterisk test module
+ * \ingroup tests
  */
 
 /*** MODULEINFO
@@ -41,85 +41,14 @@
 #include "asterisk/lock.h"
 #include "asterisk/app.h"
 
-static char *app = "Skel";
-static char *synopsis = 
-"Skeleton application.";
-static char *descrip = "This application is a template to build other applications from.\n"
- " It shows you the basic structure to create your own Asterisk applications.\n";
-
-enum {
-	OPTION_A = (1 << 0),
-	OPTION_B = (1 << 1),
-	OPTION_C = (1 << 2),
-} option_flags;
-
-enum {
-	OPTION_ARG_B = 0,
-	OPTION_ARG_C = 1,
-	/* This *must* be the last value in this enum! */
-	OPTION_ARG_ARRAY_SIZE = 2,
-} option_args;
-
-AST_APP_OPTIONS(app_opts,{
-	AST_APP_OPTION('a', OPTION_A),
-	AST_APP_OPTION_ARG('b', OPTION_B, OPTION_ARG_B),
-	AST_APP_OPTION_ARG('c', OPTION_C, OPTION_ARG_C),
-});
-
-
-static int app_exec(struct ast_channel *chan, void *data)
-{
-	int res = 0;
-	struct ast_flags flags;
-	char *parse, *opts[OPTION_ARG_ARRAY_SIZE];
-	AST_DECLARE_APP_ARGS(args,
-		AST_APP_ARG(dummy);
-		AST_APP_ARG(options);
-	);
-
-	if (ast_strlen_zero(data)) {
-		ast_log(LOG_WARNING, "%s requires an argument (dummy[,options])\n", app);
-		return -1;
-	}
-
-	/* Do our thing here */
-
-	/* We need to make a copy of the input string if we are going to modify it! */
-	parse = ast_strdupa(data);
-
-	AST_STANDARD_APP_ARGS(args, parse);
-
-	if (args.argc == 2)
-		ast_app_parse_options(app_opts, &flags, opts, args.options);
-
-	if (!ast_strlen_zero(args.dummy)) 
-		ast_log(LOG_NOTICE, "Dummy value is : %s\n", args.dummy);
-
-	if (ast_test_flag(&flags, OPTION_A))
-		ast_log(LOG_NOTICE, "Option A is set\n");
-
-	if (ast_test_flag(&flags, OPTION_B))
-		ast_log(LOG_NOTICE, "Option B is set with : %s\n", opts[OPTION_ARG_B] ? opts[OPTION_ARG_B] : "<unspecified>");
-
-	if (ast_test_flag(&flags, OPTION_C))
-		ast_log(LOG_NOTICE, "Option C is set with : %s\n", opts[OPTION_ARG_C] ? opts[OPTION_ARG_C] : "<unspecified>");
-
-	return res;
-}
-
 static int unload_module(void)
 {
-	int res;
-	res = ast_unregister_application(app);
-	return res;	
+	return 0;
 }
 
 static int load_module(void)
 {
-	if (ast_register_application(app, app_exec, synopsis, descrip))
-		return AST_MODULE_LOAD_DECLINE;
-
 	return AST_MODULE_LOAD_SUCCESS;
 }
 
-AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Skeleton (sample) Application");
+AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Skeleton (sample) Test");




More information about the asterisk-commits mailing list