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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu May 13 15:15:21 CDT 2010


Author: pabelanger
Date: Thu May 13 15:15:17 2010
New Revision: 295

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=295
Log:
Update testcase for all res modules.

Modified:
    asterisk/team/pabelanger/dynamic-modules/lib/python/asterisk/asterisk.py
    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=295&r1=294&r2=295
==============================================================================
--- asterisk/team/pabelanger/dynamic-modules/lib/python/asterisk/asterisk.py (original)
+++ asterisk/team/pabelanger/dynamic-modules/lib/python/asterisk/asterisk.py Thu May 13 15:15:17 2010
@@ -125,6 +125,12 @@
         self.process.wait()
         return self.process.returncode
 
+    def getBase(self):
+	"""Returns base directory for this instance of Asterisk.
+	"""
+
+	return self.base
+
     def install_config(self, cfg_path):
         """Install a custom configuration file for this instance of Asterisk.
 

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=295&r1=294&r2=295
==============================================================================
--- asterisk/team/pabelanger/dynamic-modules/tests/dynamic-modules/run-test (original)
+++ asterisk/team/pabelanger/dynamic-modules/tests/dynamic-modules/run-test Thu May 13 15:15:17 2010
@@ -50,21 +50,22 @@
 		self.last_step = step
 
 	def load_module(self, module):
-		text = "Loaded " + module
-		self.passed = True
+		text = "Loaded " + module[0]
 
-		res = self.asterisk.cli_exec("module load " + module)
-		if (res != text):
-			self.log_last_step("Expected '" + text + "' but received '" + res + "'")
-			self.passed = False
+		res = self.asterisk.cli_exec("module load " + module[0])
+		if (res == text):
+			module[2] = True
 
 	def unload_module(self, module):
-		text = "Unloaded " + module
+		text = "Unloaded " + module[0]
 
-		res = self.asterisk.cli_exec("module unload " + module)
-		if (res != text):
-			self.log_last_step("Expected '" + text + "' but received '" + res + "'")
-			self.passed = False
+		res = self.asterisk.cli_exec("module unload " + module[0])
+		if (res == text):
+			module[3] = True
+
+	def check_file(self, module):
+		module[1] = os.path.isfile(self.asterisk.getBase() + "/usr/lib/asterisk/modules/" + module[0])
+		return module[1]
 	
 	def run(self):
 		self.start_asterisk()
@@ -72,8 +73,87 @@
 		# A timeout in case things hang and fail
 		reactor.callLater(20, self.stop_reactor)
 
-		self.load_module("res_smdi.so")
-		self.unload_module("res_smdi.so")
+		# 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."
+				continue
+
+			self.load_module(res[i])
+			time.sleep(1)
+			self.unload_module(res[i])
+
+		self.passed = True
+		for i, e in enumerate(res):
+			# modules does not exist
+			if not res[i][1]:
+				continue
+
+			# TODO: Fix unloading of res_adsi.so
+			if res[i][0] == "res_adsi.so":
+				if not res[i][3]:
+					continue
+
+			# TODO: Fix unloading of res_calendar.so
+			if res[i][0] == "res_calendar.so":
+				if not res[i][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]:
+					continue
+
+			# TODO: Fix unloading of res_speech.so
+			if res[i][0] == "res_speech.so":
+				if not res[i][3]:
+					continue
+
+			# Any check for failures.	
+			if not res[i][2] or not res[i][3]:
+				self.passed = False
 
 def main():
 	test = moduleLoadUnloadTest()




More information about the asterisk-commits mailing list