[svn-commits] mjordan: testsuite/bamboo/trunk r3194 - /bamboo/trunk/bin/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Apr 19 13:40:20 CDT 2012


Author: mjordan
Date: Thu Apr 19 13:40:16 2012
New Revision: 3194

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=3194
Log:
Add bamboo scripts that break up the build-asterisk script into steps

This is done mostly so that I can make the script check out a specific
branch of the testsuite without having to hack up the build-asterisk
script any more then it is.  run-asterisk-testsuite now lets you pass
in a parameter specifying the branch/tag you want to check out.  Previously
we added the ability to check out a tag from build-asterisk, but modifying
that would invalidate some old plans, and having multiple parameters
which may or may not be needed was getting cumbersome.

Added:
    bamboo/trunk/bin/asterisk-cleanup.sh   (with props)
    bamboo/trunk/bin/build-asterisk-only.sh   (with props)
    bamboo/trunk/bin/run-asterisk-testsuite.sh   (with props)
    bamboo/trunk/bin/run-asterisk-unittests.sh   (with props)

Added: bamboo/trunk/bin/asterisk-cleanup.sh
URL: http://svnview.digium.com/svn/testsuite/bamboo/trunk/bin/asterisk-cleanup.sh?view=auto&rev=3194
==============================================================================
--- bamboo/trunk/bin/asterisk-cleanup.sh (added)
+++ bamboo/trunk/bin/asterisk-cleanup.sh Thu Apr 19 13:40:16 2012
@@ -1,0 +1,20 @@
+#!/usr/bin/env sh
+#
+# Build and test Asterisk from http://bamboo.asterisk.org/.
+#
+# Platforms tested
+#  - Linux i686/x86_64
+#  - Mac OSX 10.4
+#  - Mac OSX 10.6
+#  - FreeBSD 8.0
+#
+
+if which gmake ; then
+	MAKE=gmake
+else
+	MAKE=make
+fi
+
+echo "*** Uninstalling Asterisk ***"
+${MAKE} ${BUILDFLAGS} uninstall
+${MAKE} ${BUILDFLAGS} uninstall-all

Propchange: bamboo/trunk/bin/asterisk-cleanup.sh
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bamboo/trunk/bin/asterisk-cleanup.sh
------------------------------------------------------------------------------
    svn:executable = *

Propchange: bamboo/trunk/bin/asterisk-cleanup.sh
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: bamboo/trunk/bin/asterisk-cleanup.sh
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: bamboo/trunk/bin/build-asterisk-only.sh
URL: http://svnview.digium.com/svn/testsuite/bamboo/trunk/bin/build-asterisk-only.sh?view=auto&rev=3194
==============================================================================
--- bamboo/trunk/bin/build-asterisk-only.sh (added)
+++ bamboo/trunk/bin/build-asterisk-only.sh Thu Apr 19 13:40:16 2012
@@ -1,0 +1,94 @@
+#!/usr/bin/env sh
+#
+# Builds the checked out version of Asterisk
+#
+# Platforms tested
+#  - Linux i686/x86_64
+#  - Mac OSX 10.4
+#  - Mac OSX 10.6
+#  - FreeBSD 8.0
+#
+
+PLAN=$1
+PWD=`pwd`
+BUILDFLAGS="NOISY_BUILD=yes"
+
+if which gmake ; then
+	MAKE=gmake
+else
+	MAKE=make
+fi
+
+if [ "`uname`" = "FreeBSD" ] && [ "`uname -m`" = "i386" ] ; then
+	ASTCFLAGS=-march=i686
+fi
+
+export PATH="$PATH:/usr/lib/ccache:/usr/local/bin"
+echo "PATH has been set to: ${PATH}"
+
+# Run configure.  Note that if needed, this portion can
+# be expanded to provide more configure flags in the future
+COMMON_CONFIGURE_ARGS="--sysconfdir=/etc --enable-dev-mode --enable-coverage"
+./configure ${COMMON_CONFIGURE_ARGS}
+
+# Test both 'uninstall' and 'uninstall-all', since they have different logic paths
+# in the Asterisk Makefile.
+${MAKE} ${BUILDFLAGS} uninstall
+${MAKE} ${BUILDFLAGS} uninstall-all
+${MAKE} ${BUILDFLAGS} menuselect.makeopts
+
+menuselect/menuselect --enable DONT_OPTIMIZE menuselect.makeopts
+menuselect/menuselect --enable DEBUG_THREADS menuselect.makeopts
+menuselect/menuselect --enable BETTER_BACKTRACES menuselect.makeopts
+menuselect/menuselect --enable TEST_FRAMEWORK menuselect.makeopts
+menuselect/menuselect --enable-category MENUSELECT_TESTS menuselect.makeopts
+menuselect/menuselect --enable-category MENUSELECT_ADDONS menuselect.makeopts
+if test -f addons/mp3/mpg123.h ; then :; else
+	contrib/scripts/get_mp3_source.sh
+fi
+menuselect/menuselect --enable-category MENUSELECT_BRIDGES menuselect.makeopts
+menuselect/menuselect --enable-category MENUSELECT_CEL menuselect.makeopts
+menuselect/menuselect --enable-category MENUSELECT_CDR menuselect.makeopts
+menuselect/menuselect --enable-category MENUSELECT_CHANNELS menuselect.makeopts
+menuselect/menuselect --enable-category MENUSELECT_CODECS menuselect.makeopts
+menuselect/menuselect --enable-category MENUSELECT_FORMATS menuselect.makeopts
+menuselect/menuselect --enable-category MENUSELECT_FUNCS menuselect.makeopts
+menuselect/menuselect --enable-category MENUSELECT_PBX menuselect.makeopts
+menuselect/menuselect --enable-category MENUSELECT_RES menuselect.makeopts
+menuselect/menuselect --enable-category MENUSELECT_UTILS menuselect.makeopts
+
+if [ "${PLAN}" = "AST-14" ] ; then
+	# If we're building Asterisk 1.4, let make run twice, and ignore failures
+	# the first time, because of the way the build of chan_h323 works in 1.4.
+	${MAKE} ${BUILDFLAGS} ASTCFLAGS=${ASTCFLAGS} || :
+fi
+${MAKE} ${BUILDFLAGS} ASTCFLAGS=${ASTCFLAGS}
+
+if [ -f doc/core-en_US.xml ] ; then
+	echo "*** Validating XML documentation ***"
+	${MAKE} ${BUILDFLAGS} validate-docs
+fi
+
+if [ -d doc/tex ] ; then
+	${MAKE} ${BUILDFLAGS} asterisk.pdf
+fi
+
+echo "*** Installing Asterisk and Sample Configuration ***"
+WGET_EXTRA_ARGS=--quiet ${MAKE} ${BUILDFLAGS} install
+${MAKE} ${BUILDFLAGS} samples
+
+if [ $"{PLAN}" = "AST-14" ]; then
+	svn co http://svn.digium.com/svn/asterisk-addons/branches/1.4 addons
+	( cd addons ; ./configure ; ${MAKE} ${BUILDFLAGS} ; ${MAKE} ${BUILDFLAGS} install ; ${MAKE} ${BUILDFLAGS} samples )
+fi
+
+if [ $"{PLAN}" = "AST-162" ]; then
+	svn co http://svn.digium.com/svn/asterisk-addons/branches/1.6.2 addons
+	( cd addons ; ./configure ; ${MAKE} ${BUILDFLAGS} ; ${MAKE} ${BUILDFLAGS} install ; ${MAKE} ${BUILDFLAGS} samples )
+fi
+
+if ! which asterisk; then
+	echo "*** Failed to install Asterisk ***"
+	exit 1
+fi
+

Propchange: bamboo/trunk/bin/build-asterisk-only.sh
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bamboo/trunk/bin/build-asterisk-only.sh
------------------------------------------------------------------------------
    svn:executable = *

Propchange: bamboo/trunk/bin/build-asterisk-only.sh
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: bamboo/trunk/bin/build-asterisk-only.sh
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: bamboo/trunk/bin/run-asterisk-testsuite.sh
URL: http://svnview.digium.com/svn/testsuite/bamboo/trunk/bin/run-asterisk-testsuite.sh?view=auto&rev=3194
==============================================================================
--- bamboo/trunk/bin/run-asterisk-testsuite.sh (added)
+++ bamboo/trunk/bin/run-asterisk-testsuite.sh Thu Apr 19 13:40:16 2012
@@ -1,0 +1,70 @@
+#!/usr/bin/env sh
+#
+# Build and test Asterisk from http://bamboo.asterisk.org/.
+#
+# Platforms tested
+#  - Linux i686/x86_64
+#  - Mac OSX 10.4
+#  - Mac OSX 10.6
+#  - FreeBSD 8.0
+#
+
+PWD=`pwd`
+TEST_RESULTS_DIR=${PWD}/test-reports
+
+if which gmake ; then
+	MAKE=gmake
+else
+	MAKE=make
+fi
+
+if [ $# != 0 ] ; then
+	REPO=$1
+else
+	REPO=trunk
+fi
+
+if [ $# == 2 ] ; then
+	PLAN=$2
+else
+	PLAN=""
+fi
+
+mkdir ${TEST_RESULTS_DIR}
+
+
+echo "*** Removing any previous instance of the test suite ***"
+if [ -d testsuite ] ; then
+	rm -rf testsuite
+fi
+
+# Check for an existing testsuite tmp directory...
+if [ -d /tmp/asterisk-testsuite ] ; then
+	# ...and delete it.
+	rm -rf /tmp/asterisk-testsuite
+fi
+
+echo "*** Running external test suite ***"
+svn co http://svn.digium.com/svn/testsuite/asterisk/${REPO} testsuite
+
+if [ "${PLAN}" = "AST-PESSIMISTIC" ]; then
+	# Get the branch with the pessimistic test configuration
+	svn co http://svn.digium.com/svn/testsuite/asterisk/team/group/pessimistic pessimistic
+	cp pessimistic/* testsuite
+fi
+
+cd testsuite
+if [ `uname -s` = "Linux" ] ; then
+	cd asttest
+	${MAKE}
+	${MAKE} install
+	cd ..
+fi
+
+${MAKE} -C addons update
+${MAKE} -C addons install
+./runtests.py
+cp *.xml ${TEST_RESULTS_DIR}
+${MAKE} -C addons uninstall
+cd ..
+

Propchange: bamboo/trunk/bin/run-asterisk-testsuite.sh
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bamboo/trunk/bin/run-asterisk-testsuite.sh
------------------------------------------------------------------------------
    svn:executable = *

Propchange: bamboo/trunk/bin/run-asterisk-testsuite.sh
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: bamboo/trunk/bin/run-asterisk-testsuite.sh
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: bamboo/trunk/bin/run-asterisk-unittests.sh
URL: http://svnview.digium.com/svn/testsuite/bamboo/trunk/bin/run-asterisk-unittests.sh?view=auto&rev=3194
==============================================================================
--- bamboo/trunk/bin/run-asterisk-unittests.sh (added)
+++ bamboo/trunk/bin/run-asterisk-unittests.sh Thu Apr 19 13:40:16 2012
@@ -1,0 +1,94 @@
+#!/usr/bin/env sh
+#
+# Runs the Asterisk unit tests
+#
+# Platforms tested
+#  - Linux i686/x86_64
+#  - Mac OSX 10.4
+#  - Mac OSX 10.6
+#  - FreeBSD 8.0
+#
+
+PWD=`pwd`
+TEST_RESULTS_DIR=${PWD}/test-reports
+
+start_asterisk() {
+	echo "*** Starting Asterisk ***"
+
+	if [ -d /Library/LaunchDaemons ] ; then
+		# Mac OSX
+		launchctl load -w /Library/LaunchDaemons/org.asterisk.asterisk.plist
+	else
+		asterisk -gn
+	fi
+
+	sleep 1
+	asterisk -rx "core waitfullybooted"
+	sleep 3
+}
+
+stop_asterisk() {
+	echo "*** Stopping Asterisk ***"
+
+	if [ -d /Library/LaunchDaemons ] ; then
+		# Mac OSX
+		launchctl unload -w /Library/LaunchDaemons/org.asterisk.asterisk.plist || :
+	else
+		asterisk -rx "core stop now"
+	fi
+	sleep 5
+
+	(killall -9 asterisk || :) > /dev/null 2>&1
+}
+
+killall_asterisk() {
+	echo "*** Killing all running Asterisk processes ***"
+	if [ -d /Library/LaunchDaemons ] ; then
+		launchctl unload -w /Library/LaunchDaemons/org.asterisk.asterisk.plist || :
+	fi
+	(killall -9 asterisk || :) > /dev/null 2>&1
+}
+
+run_unit_tests() {
+	cat > /etc/asterisk/manager.conf << EOF
+[general]
+enabled=yes
+bindaddr=127.0.0.1
+port=5038
+
+[test]
+secret=test
+read = system,call,log,verbose,agent,user,config,dtmf,reporting,cdr,dialplan
+write = system,call,agent,user,config,command,reporting,originate
+EOF
+
+	cat > /etc/asterisk/logger.conf << EOF
+full => notice,warning,error,debug,verbose
+EOF
+	start_asterisk
+
+	echo "*** Executing Unit Tests (Results: ${TEST_RESULTS_DIR}/unit-test-results.xml) ***"
+	contrib/scripts/astcli -u test -s test "test execute all"
+	contrib/scripts/astcli -u test -s test "test generate results xml ${TEST_RESULTS_DIR}/unit-test-results.xml"
+
+	if [ -f core* ] ; then
+		echo "*** Found a core file after running unit tests ***"
+		gdb asterisk core* -x /usr/local/bin/bamboo/bt.txt
+		exit 1
+	fi
+
+	stop_asterisk
+	# Revert back to samples manager.conf
+	cp configs/manager.conf.sample /etc/asterisk/manager.conf
+	cp configs/logger.conf.sample /etc/asterisk/logger.conf
+}
+
+if ! which asterisk ; then
+	echo "Asterisk not installed"
+	exit 1
+fi
+
+mkdir ${TEST_RESULTS_DIR}
+
+killall_asterisk
+run_unit_tests

Propchange: bamboo/trunk/bin/run-asterisk-unittests.sh
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: bamboo/trunk/bin/run-asterisk-unittests.sh
------------------------------------------------------------------------------
    svn:executable = *

Propchange: bamboo/trunk/bin/run-asterisk-unittests.sh
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: bamboo/trunk/bin/run-asterisk-unittests.sh
------------------------------------------------------------------------------
    svn:mime-type = text/plain




More information about the svn-commits mailing list