[asterisk-commits] russell: branch russell/test-api-1.4 r272764 - in /team/russell/test-api-1.4:...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Jun 28 12:13:35 CDT 2010


Author: russell
Date: Mon Jun 28 12:13:32 2010
New Revision: 272764

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=272764
Log:
Add test_skel

Added:
    team/russell/test-api-1.4/tests/
    team/russell/test-api-1.4/tests/Makefile   (with props)
    team/russell/test-api-1.4/tests/test_skel.c   (with props)
Modified:
    team/russell/test-api-1.4/Makefile

Modified: team/russell/test-api-1.4/Makefile
URL: http://svnview.digium.com/svn/asterisk/team/russell/test-api-1.4/Makefile?view=diff&rev=272764&r1=272763&r2=272764
==============================================================================
--- team/russell/test-api-1.4/Makefile (original)
+++ team/russell/test-api-1.4/Makefile Mon Jun 28 12:13:32 2010
@@ -265,7 +265,7 @@
 
 _ASTCFLAGS+=$(BUSYDETECT)$(OPTIONS)
 
-MOD_SUBDIRS:=res channels pbx apps codecs formats cdr funcs main
+MOD_SUBDIRS:=res channels pbx apps codecs formats cdr funcs tests main
 OTHER_SUBDIRS:=utils agi
 SUBDIRS:=$(OTHER_SUBDIRS) $(MOD_SUBDIRS)
 SUBDIRS_INSTALL:=$(SUBDIRS:%=%-install)
@@ -293,6 +293,7 @@
   SOLINK=-shared -fpic -L/usr/local/ssl/lib -lrt
 endif
 
+SILENTMAKE:=$(MAKE) --quiet --no-print-directory
 ifneq ($(PRINT_DIR)$(NOISY_BUILD),)
 SUBMAKE:=$(MAKE)
 else
@@ -334,13 +335,13 @@
 endif
 
 $(MOD_SUBDIRS_EMBED_LDSCRIPT):
-	+ at echo "EMBED_LDSCRIPTS+="`$(SUBMAKE) -C $(@:-embed-ldscript=) SUBDIR=$(@:-embed-ldscript=) __embed_ldscript` >> makeopts.embed_rules
+	+ at echo "EMBED_LDSCRIPTS+="`$(SILENTMAKE) -C $(@:-embed-ldscript=) SUBDIR=$(@:-embed-ldscript=) __embed_ldscript` >> makeopts.embed_rules
 
 $(MOD_SUBDIRS_EMBED_LDFLAGS):
-	+ at echo "EMBED_LDFLAGS+="`$(SUBMAKE) -C $(@:-embed-ldflags=) SUBDIR=$(@:-embed-ldflags=) __embed_ldflags` >> makeopts.embed_rules
+	+ at echo "EMBED_LDFLAGS+="`$(SILENTMAKE) -C $(@:-embed-ldflags=) SUBDIR=$(@:-embed-ldflags=) __embed_ldflags` >> makeopts.embed_rules
 
 $(MOD_SUBDIRS_EMBED_LIBS):
-	+ at echo "EMBED_LIBS+="`$(SUBMAKE) -C $(@:-embed-libs=) SUBDIR=$(@:-embed-libs=) __embed_libs` >> makeopts.embed_rules
+	+ at echo "EMBED_LIBS+="`$(SILENTMAKE) -C $(@:-embed-libs=) SUBDIR=$(@:-embed-libs=) __embed_libs` >> makeopts.embed_rules
 
 $(MOD_SUBDIRS_MENUSELECT_TREE):
 	+@$(SUBMAKE) -C $(@:-menuselect-tree=) SUBDIR=$(@:-menuselect-tree=) moduleinfo
@@ -810,8 +811,8 @@
 	@echo "<?xml version=\"1.0\"?>" > $@
 	@echo >> $@
 	@echo "<menu name=\"Asterisk Module and Build Option Selection\">" >> $@
-	+ at for dir in $(sort $(filter-out main,$(MOD_SUBDIRS))); do $(SUBMAKE) -C $${dir} SUBDIR=$${dir} moduleinfo >> $@; done
-	+ at for dir in $(sort $(filter-out main,$(MOD_SUBDIRS))); do $(SUBMAKE) -C $${dir} SUBDIR=$${dir} makeopts >> $@; done
+	+ at for dir in $(sort $(filter-out main,$(MOD_SUBDIRS))); do $(SILENTMAKE) -C $${dir} SUBDIR=$${dir} moduleinfo >> $@; done
+	+ at for dir in $(sort $(filter-out main,$(MOD_SUBDIRS))); do $(SILENTMAKE) -C $${dir} SUBDIR=$${dir} makeopts >> $@; done
 	@cat build_tools/cflags.xml >> $@
 	@if [ "${AST_DEVMODE}" = "yes" ]; then \
 		cat build_tools/cflags-devmode.xml >> $@; \

Added: team/russell/test-api-1.4/tests/Makefile
URL: http://svnview.digium.com/svn/asterisk/team/russell/test-api-1.4/tests/Makefile?view=auto&rev=272764
==============================================================================
--- team/russell/test-api-1.4/tests/Makefile (added)
+++ team/russell/test-api-1.4/tests/Makefile Mon Jun 28 12:13:32 2010
@@ -1,0 +1,32 @@
+#
+# Asterisk -- A telephony toolkit for Linux.
+# 
+# Makefile for test modules
+#
+# Copyright (C) 1999-2010, Digium, Inc.
+#
+# This program is free software, distributed under the terms of
+# the GNU General Public License
+#
+
+-include ../menuselect.makeopts ../menuselect.makedeps ../makeopts
+
+MENUSELECT_CATEGORY=TESTS
+MENUSELECT_DESCRIPTION=Test Modules
+
+ALL_C_MODS:=$(patsubst %.c,%,$(wildcard test_*.c))
+ALL_CC_MODS:=$(patsubst %.cc,%,$(wildcard test_*.cc))
+
+C_MODS:=$(filter-out $(MENUSELECT_TESTS),$(ALL_C_MODS))
+CC_MODS:=$(filter-out $(MENUSELECT_TESTS),$(ALL_CC_MODS))
+
+LOADABLE_MODS:=$(C_MODS) $(CC_MODS)
+
+ifneq ($(findstring tests,$(MENUSELECT_EMBED)),)
+  EMBEDDED_MODS:=$(LOADABLE_MODS)
+  LOADABLE_MODS:=
+endif
+
+all: _all
+
+include $(ASTTOPDIR)/Makefile.moddir_rules

Propchange: team/russell/test-api-1.4/tests/Makefile
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: team/russell/test-api-1.4/tests/Makefile
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: team/russell/test-api-1.4/tests/Makefile
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: team/russell/test-api-1.4/tests/test_skel.c
URL: http://svnview.digium.com/svn/asterisk/team/russell/test-api-1.4/tests/test_skel.c?view=auto&rev=272764
==============================================================================
--- team/russell/test-api-1.4/tests/test_skel.c (added)
+++ team/russell/test-api-1.4/tests/test_skel.c Mon Jun 28 12:13:32 2010
@@ -1,0 +1,82 @@
+/*
+ * Asterisk -- An open source telephony toolkit.
+ *
+ * Copyright (C) <Year>, <Your Name Here>
+ *
+ * <Your Name Here> <<Your Email Here>>
+ *
+ * See http://www.asterisk.org for more information about
+ * the Asterisk project. Please do not directly contact
+ * any of the maintainers of this project for assistance;
+ * the project provides a web site, mailing lists and IRC
+ * channels for your use.
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE file
+ * at the top of the source tree.
+ */
+
+/*! 
+ * \file
+ * \brief Skeleton Test
+ *
+ * \author\verbatim <Your Name Here> <<Your Email Here>> \endverbatim
+ * 
+ * This is a skeleton for development of an Asterisk test module
+ * \ingroup tests
+ */
+
+/*** MODULEINFO
+	<depend>TEST_FRAMEWORK</depend>
+ ***/
+
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
+
+#include "asterisk/utils.h"
+#include "asterisk/module.h"
+#include "asterisk/test.h"
+
+AST_TEST_DEFINE(sample_test)
+{
+	void *ptr;
+
+	switch (cmd) {
+	case TEST_INIT:
+		info->name = "sample_test";
+		info->category = "main/sample/";
+		info->summary = "sample unit test";
+		info->description =
+			"This demonstrates what is required to implement "
+			"a unit test.";
+		return AST_TEST_NOT_RUN;
+	case TEST_EXECUTE:
+		break;
+	}
+
+	ast_test_status_update(test, "Executing sample test...\n");
+
+	if (!(ptr = ast_malloc(8))) {
+		ast_test_status_update(test, "ast_malloc() failed\n");
+		return AST_TEST_FAIL;
+	}
+
+	ast_free(ptr);
+
+	return AST_TEST_PASS;
+}
+
+static int unload_module(void)
+{
+	AST_TEST_UNREGISTER(sample_test);
+	return 0;
+}
+
+static int load_module(void)
+{
+	AST_TEST_REGISTER(sample_test);
+	return AST_MODULE_LOAD_SUCCESS;
+}
+
+AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Skeleton (sample) Test");

Propchange: team/russell/test-api-1.4/tests/test_skel.c
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: team/russell/test-api-1.4/tests/test_skel.c
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: team/russell/test-api-1.4/tests/test_skel.c
------------------------------------------------------------------------------
    svn:mime-type = text/plain




More information about the asterisk-commits mailing list