[svn-commits] pabelanger: branch pabelanger/dynamic-modules r829 - in /asterisk/team/pabela...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri Nov 12 23:23:29 CST 2010


Author: pabelanger
Date: Fri Nov 12 23:23:24 2010
New Revision: 829

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=829
Log:
Address _most_ comments on reviewboard.
Add the ability to preload modules.
Currently loading res_http_post.so causes Asterisk to crash.

Modified:
    asterisk/team/pabelanger/dynamic-modules/lib/python/asterisk/asterisk.py
    asterisk/team/pabelanger/dynamic-modules/tests/dynamic-modules/configs/logger.conf
    asterisk/team/pabelanger/dynamic-modules/tests/dynamic-modules/run-test

Modified: asterisk/team/pabelanger/dynamic-modules/lib/python/asterisk/asterisk.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/pabelanger/dynamic-modules/lib/python/asterisk/asterisk.py?view=diff&rev=829&r1=828&r2=829
==============================================================================
--- asterisk/team/pabelanger/dynamic-modules/lib/python/asterisk/asterisk.py (original)
+++ asterisk/team/pabelanger/dynamic-modules/lib/python/asterisk/asterisk.py Fri Nov 12 23:23:24 2010
@@ -320,7 +320,7 @@
         except IOError:
             pass
         process.wait()
-        return output
+        return output.strip()
 
     def __gen_ast_conf(self, ast_conf, dir_cat, ast_conf_options):
         for (var, val) in dir_cat.options:

Modified: asterisk/team/pabelanger/dynamic-modules/tests/dynamic-modules/configs/logger.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/pabelanger/dynamic-modules/tests/dynamic-modules/configs/logger.conf?view=diff&rev=829&r1=828&r2=829
==============================================================================
--- asterisk/team/pabelanger/dynamic-modules/tests/dynamic-modules/configs/logger.conf (original)
+++ asterisk/team/pabelanger/dynamic-modules/tests/dynamic-modules/configs/logger.conf Fri Nov 12 23:23:24 2010
@@ -1,7 +1,5 @@
 [general]
 
 [logfiles]
-
-console =>
-messages => notice,warning,error
+console => notice,warning,error
 full => notice,warning,error,debug,verbose

Modified: asterisk/team/pabelanger/dynamic-modules/tests/dynamic-modules/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/pabelanger/dynamic-modules/tests/dynamic-modules/run-test?view=diff&rev=829&r1=828&r2=829
==============================================================================
--- asterisk/team/pabelanger/dynamic-modules/tests/dynamic-modules/run-test (original)
+++ asterisk/team/pabelanger/dynamic-modules/tests/dynamic-modules/run-test Fri Nov 12 23:23:24 2010
@@ -1,7 +1,7 @@
 #!/usr/bin/env python
 '''
-Copyright (C) 2010, Polybeacon
-Paul Belanger <paul.belanger at polybeacon.com>
+Copyright (C) 2010, Digium, Inc.
+Paul Belanger <pabelanger at digium.com>
 
 This program is free software, distributed under the terms of
 the GNU General Public License Version 2.
@@ -27,8 +27,7 @@
 
 		print "Creating Asterisk instance ..."
 		self.asterisk = Asterisk(base="/tmp/asterisk-testsuite/dynamic-modules")
-		self.asterisk.install_config("tests/dynamic-modules/configs/logger.conf")
-		self.asterisk.install_config("tests/dynamic-modules/configs/modules.conf")
+		self.asterisk.install_configs("tests/dynamic-modules/configs/")
 
 	def stop_reactor(self):
 		self.stop_asterisk()
@@ -39,8 +38,8 @@
 	def start_asterisk(self):
 		self.log_last_step("Starting Asterisk")
 		self.asterisk.start()
-		self.asterisk.cli_exec("core set verbose 10")
-		self.asterisk.cli_exec("core set debug 3")
+		self.asterisk.cli_exec("core set verbose 15")
+		self.asterisk.cli_exec("core set debug 15")
 
 	def stop_asterisk(self):
 		self.asterisk.stop()
@@ -50,109 +49,119 @@
 		self.last_step = step
 
 	def load_module(self, module):
+		if not self.check_file(module):
+			print module[0] + " does not exist! Skipping test."
+			return
+
 		text = "Loaded " + module[0]
-
 		res = self.asterisk.cli_exec("module load " + module[0])
-		if (res == text):
+		if not cmp(res, text):
 			module[2] = True
 
 	def unload_module(self, module):
 		text = "Unloaded " + module[0]
-
 		res = self.asterisk.cli_exec("module unload " + module[0])
-		if (res == text):
+		if not cmp(res, text):
 			module[3] = True
 
 	def check_file(self, module):
-		module[1] = os.path.isfile(self.asterisk.getBase() + "/usr/lib/asterisk/modules/" + module[0])
+		module[1] = os.path.isfile(self.asterisk.base + "/usr/lib/asterisk/modules/" + module[0])
 		return module[1]
 	
 	def run(self):
+		self.passed = True
+		preload_res = []
+		res = []
 		self.start_asterisk()
 
 		# A timeout in case things hang and fail
 		reactor.callLater(20, self.stop_reactor)
 
-		# Format [filename, exists, load, unload]
-		res = [
-			["res_adsi.so", False, False, False],
-			["res_ael_share.so", False, False, False],
-			["res_agi.so", False, False, False],
-			["res_ais.so", False, False, False],
-			["res_calendar.so", False, False, False],
-			["res_calendar_caldav.so", False, False, False],
-			["res_calendar_exchange.so", False, False, False],
-			["res_calendar_icalendar.so", False, False, False],
-			["res_clialiases.so", False, False, False],
-			["res_clioriginate.so", False, False, False],
-			["res_res_config_curl.so", False, False, False],
-			["res_res_config_ldap.so", False, False, False],
-			["res_res_config_odbc.so", False, False, False],
-			["res_res_config_pgsql.so", False, False, False],
-			["res_res_config_sqlite.so", False, False, False],
-			["res_convert.so", False, False, False],
-			["res_crypto.so", False, False, False],
-			["res_curl.so", False, False, False],
-			["res_fax.so", False, False, False],
-			["res_fax_spandsp.so", False, False, False],
-			["res_http_post", False, False, False],
-			["res_jabber", False, False, False],
-			["res_limit.so", False, False, False],
-			["res_monitor.so", False, False, False],
-			["res_musiconhold.so", False, False, False],
-			["res_mutestream.so", False, False, False],
-			["res_odbc.so", False, False, False],
-			["res_phoneprov.so", False, False, False],
-			["res_pktccops.so", False, False, False],
-			["res_realtime.so", False, False, False],
-			["res_rtp_asterisk.so", False, False, False],
-			["res_rtp_multicast.so", False, False, False],
-			["res_security_log.so", False, False, False],
-			["res_smdi.so", False, False, False],
-			["res_snmp.so", False, False, False],
-			["res_speech.so", False, False, False],
-			["res_timing_dahdi.so", False, False, False],
-			["res_timing_kqueue.so", False, False, False],
-			["res_timing_pthread.so", False, False, False],
-			["res_timing_timerfd.so", False, False, False],
-		]
-		for i, e in enumerate(res):
-			if not self.check_file(res[i]):
-				print res[i][0] + " does not exist! Skipping test."
+		# TODO: Do not hardcode, read from source code. 
+		preload_resources = ["res_calendar", "res_curl", "res_fax", "res_odbc"]
+
+		for module in preload_resources:
+			preload_res.append([module + ".so", False, False, False])
+
+		# TODO: Do not hardcode, read from source code. 
+		# TODO: Fixed res_http_post crash
+		resources = ["res_adsi", "res_ael_share", "res_agi", "res_ais", "res_calendar_caldav", "res_calendar_exchange", "res_calendar_icalendar", "res_clialiases", "res_clioriginate", "res_config_curl", "res_config_ldap", "res_config_odbc", "res_config_pgsql", "res_config_sqlite", "res_convert", "res_crypto", "res_fax_spandsp", "res_jabber", "res_limit", "res_monitor", "res_musiconhold", "res_mutestream", "res_phoneprov", "res_pktccops", "res_realtime", "res_rtp_asterisk", "res_rtp_multicast", "res_security_log", "res_smdi", "res_snmp", "res_speech", "res_timing_dahdi", "res_timing_kqueue", "res_timing_pthread", "res_timing_timerfd"]
+
+		for module in resources:
+			res.append([module + ".so", False, False, False])
+
+		for module in preload_res:
+			self.load_module(module)
+
+		for module in res:
+			self.load_module(module)
+			time.sleep(1)
+			self.unload_module(module)
+			time.sleep(1)
+
+		for module in preload_res:
+			self.unload_module(module)
+
+		for module in preload_res:
+			# modules does not exist
+			if not module[1]:
+				print "WARNING: " + module[0] + " does not exist!"
 				continue
 
-			self.load_module(res[i])
-			time.sleep(1)
-			self.unload_module(res[i])
+			# TODO: Fix unloading of res_calendar.so
+			if module[0] == "res_calendar.so":
+				if not module[3]:
+					continue
 
-		self.passed = True
-		for i, e in enumerate(res):
+			# TODO: Fix unloading of res_curl.so
+			if module[0] == "res_curl.so":
+				if not module[3]:
+					continue
+
+			# TODO: Fix unloading of res_odbc.so
+			if module[0] == "res_odbc.so":
+				if not module[3]:
+					continue
+
+			#And check for failures.	
+			if not module[2] or not module[3]:
+				print "ERROR: " + module[0]
+				self.passed = False
+
+		for module in res:
 			# modules does not exist
-			if not res[i][1]:
+			if not module[1]:
+				print "WARNING: " + module[0] + " does not exist!"
 				continue
 
 			# TODO: Fix unloading of res_adsi.so
-			if res[i][0] == "res_adsi.so":
-				if not res[i][3]:
+			if module[0] == "res_adsi.so":
+				if not module[3]:
 					continue
 
-			# TODO: Fix unloading of res_calendar.so
-			if res[i][0] == "res_calendar.so":
-				if not res[i][3]:
+			# TODO: Fix loading / unloading of res_ais.so
+			if module[0] == "res_ais.so":
+				if not module[2] and not module[3]:
+					continue
+
+			# TODO: Fix unloading of res_crypto.so
+			if module[0] == "res_crypto.so":
+				if not module[3]:
 					continue
 
 			# TODO: Fix loading / unloading of res_smdi.so
-			if res[i][0] == "res_smdi.so":
-				if not res[i][2] and res[i][3]:
+			if module[0] == "res_smdi.so":
+				if not module[2] and not module[3]:
 					continue
 
 			# TODO: Fix unloading of res_speech.so
-			if res[i][0] == "res_speech.so":
-				if not res[i][3]:
+			if module[0] == "res_speech.so":
+				if not module[3]:
 					continue
 
-			# Any check for failures.	
-			if not res[i][2] or not res[i][3]:
+			# And check for failures.	
+			if not module[2] or not module[3]:
+				print "ERROR: " + module[0]
 				self.passed = False
 
 def main():




More information about the svn-commits mailing list