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

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Aug 6 12:55:49 CDT 2014


Author: mjordan
Date: Wed Aug  6 12:55:44 2014
New Revision: 5359

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=5359
Log:
run-asterisk-unittests: Fix archival of sample configs for message unit tests

The message unit tests make use of the dialplan. Unfortunately, the tests will
fail if a s at default extension exists, which the sample configs provide. This
patch updates the unit test script to archive off all extensions files prior
to running the tests.

Modified:
    bamboo/trunk/bin/run-asterisk-unittests.sh

Modified: bamboo/trunk/bin/run-asterisk-unittests.sh
URL: http://svnview.digium.com/svn/testsuite/bamboo/trunk/bin/run-asterisk-unittests.sh?view=diff&rev=5359&r1=5358&r2=5359
==============================================================================
--- bamboo/trunk/bin/run-asterisk-unittests.sh (original)
+++ bamboo/trunk/bin/run-asterisk-unittests.sh Wed Aug  6 12:55:44 2014
@@ -49,7 +49,24 @@
 	(killall -9 asterisk || :) > /dev/null 2>&1
 }
 
-run_unit_tests() {
+setup_configs() {
+	# Archive any existing files that may conflict
+	if [ -f /etc/asterisk/extensions.conf ]; then
+		mv -f /etc/asterisk/extensions.conf /etc/asterisk/extensions.conf.backup
+	fi
+	if [ -f /etc/asterisk/extensions.ael ]; then
+		mv -f /etc/asterisk/extensions.ael /etc/asterisk/extensions.ael.backup
+	fi
+	if [ -f /etc/asterisk/extensions.lua ]; then
+		mv -f /etc/asterisk/extensions.lua /etc/asterisk/extensions.lua.backup
+	fi
+	if [ -f /etc/asterisk/manager.conf ]; then
+		mv -f /etc/asterisk/manager.conf /etc/asterisk/manager.conf.backup
+	fi
+	if [ -f /etc/asterisk/logger.conf ]; then
+		mv -f /etc/asterisk/logger.conf /etc/asterisk/logger.conf.backup
+	fi
+
 	cat > /etc/asterisk/manager.conf << EOF
 [general]
 enabled=yes
@@ -72,6 +89,36 @@
 bindaddr=127.0.0.1
 port=8088
 EOF
+
+	cat > /etc/asterisk/extensions.conf << EOF
+[default]
+EOF
+
+}
+
+restore_configs() {
+
+	# Revert back to samples files
+	if [ -f /etc/asterisk/extensions.conf.backup ]; then
+		mv -f /etc/asterisk/extensions.conf.backup /etc/asterisk/extensions.conf
+	fi
+	if [ -f /etc/asterisk/extensions.ael.backup ]; then
+		mv -f /etc/asterisk/extensions.ael.backup /etc/asterisk/extensions.ael
+	fi
+	if [ -f /etc/asterisk/extensions.lua.backup ]; then
+		mv -f /etc/asterisk/extensions.lua.backup /etc/asterisk/extensions.lua
+	fi
+	if [ -f /etc/asterisk/manager.conf.backup ]; then
+		mv -f /etc/asterisk/manager.conf.backup /etc/asterisk/manager.conf
+	fi
+	if [ -f /etc/asterisk/logger.conf.backup ]; then
+		mv -f /etc/asterisk/logger.conf.backup /etc/asterisk/logger.conf
+	fi
+
+}
+
+run_unit_tests() {
+
 	start_asterisk
 
 	echo "*** Executing Unit Tests (Results: ${TEST_RESULTS_DIR}/unit-test-results.xml) ***"
@@ -85,19 +132,7 @@
 	fi
 
 	stop_asterisk
-	# Revert back to samples manager.conf
-	if [ -f configs/manager.conf.sample ]; then
-		cp configs/manager.conf.sample /etc/asterisk/manager.conf
-	fi
-	if [ -f configs/samples/manager.conf.sample ]; then
-		cp configs/samples/manager.conf.sample /etc/asterisk/manager.conf
-	fi
-	if [ -f configs/logger.conf.sample ]; then
-		cp configs/logger.conf.sample /etc/asterisk/logger.conf
-	fi
-	if [ -f configs/samples/logger.conf.sample ]; then
-		cp configs/samples/logger.conf.sample /etc/asterisk/logger.conf
-	fi
+
 }
 
 if ! which asterisk ; then
@@ -108,4 +143,6 @@
 mkdir ${TEST_RESULTS_DIR}
 
 killall_asterisk
+setup_configs
 run_unit_tests
+restore_configs




More information about the svn-commits mailing list