[asterisk-commits] pabelanger: branch pabelanger/dynamic-modules r1329 - in /asterisk/team/pabel...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Jan 4 23:36:50 UTC 2011
Author: pabelanger
Date: Tue Jan 4 17:36:46 2011
New Revision: 1329
URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=1329
Log:
Test now passes
Added:
asterisk/team/pabelanger/dynamic-modules/tests/dynamic-modules/configs/ast1/
asterisk/team/pabelanger/dynamic-modules/tests/dynamic-modules/configs/ast1/modules.conf
- copied unchanged from r1325, asterisk/team/pabelanger/dynamic-modules/tests/dynamic-modules/configs/modules.conf
Removed:
asterisk/team/pabelanger/dynamic-modules/tests/dynamic-modules/configs/logger.conf
asterisk/team/pabelanger/dynamic-modules/tests/dynamic-modules/configs/modules.conf
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=1329&r1=1328&r2=1329
==============================================================================
--- asterisk/team/pabelanger/dynamic-modules/lib/python/asterisk/asterisk.py (original)
+++ asterisk/team/pabelanger/dynamic-modules/lib/python/asterisk/asterisk.py Tue Jan 4 17:36:46 2011
@@ -327,7 +327,7 @@
process.wait()
except OSError:
pass
- return output.strip()
+ return output
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/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/pabelanger/dynamic-modules/tests/dynamic-modules/run-test?view=diff&rev=1329&r1=1328&r2=1329
==============================================================================
--- asterisk/team/pabelanger/dynamic-modules/tests/dynamic-modules/run-test (original)
+++ asterisk/team/pabelanger/dynamic-modules/tests/dynamic-modules/run-test Tue Jan 4 17:36:46 2011
@@ -18,161 +18,170 @@
sys.path.append("lib/python")
from asterisk.asterisk import Asterisk
+workingdir = "/tmp/asterisk-testsuite/dynamic-modules"
+testdir = "tests/dynamic-modules"
+
class moduleLoadUnloadTest:
- def __init__(self):
- self.passed = False
- self.last_step = ""
+ def __init__(self):
+ self.passed = False
+ self.last_step = ""
- reactor.callWhenRunning(self.run)
+ reactor.callWhenRunning(self.run)
- print "Creating Asterisk instance ..."
- self.asterisk = Asterisk(base="/tmp/asterisk-testsuite/dynamic-modules")
- self.asterisk.install_configs("tests/dynamic-modules/configs/")
+ print "Creating Asterisk instance ..."
+ self.asterisk = Asterisk(base=workingdir)
+ self.asterisk.install_configs("%s/configs/ast1" % (testdir))
- def stop_reactor(self):
- self.stop_asterisk()
- print "Stopping Reactor ..."
- if reactor.running:
- reactor.stop()
+ def stop_reactor(self):
+ print "Stopping Reactor ..."
+ if reactor.running:
+ reactor.stop()
- def start_asterisk(self):
- self.log_last_step("Starting Asterisk")
- self.asterisk.start()
- self.asterisk.cli_exec("core set verbose 15")
- self.asterisk.cli_exec("core set debug 15")
+ def start_asterisk(self):
+ print "Starting Asterisk ..."
+ self.asterisk.start()
- def stop_asterisk(self):
- self.asterisk.stop()
+ def stop_asterisk(self):
+ self.asterisk.stop()
- def log_last_step(self, step):
- print step
- self.last_step = step
+ def load_module(self, module):
+ if not self.check_file(module):
+ print module[0] + " does not exist! Skipping test."
+ return False
- 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.count(text) > 0:
+ module[2] = True
+ return module[2]
- text = "Loaded " + module[0]
- res = self.asterisk.cli_exec("module load " + module[0])
- 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.count(text) > 0:
+ module[3] = True
- def unload_module(self, module):
- text = "Unloaded " + module[0]
- res = self.asterisk.cli_exec("module unload " + module[0])
- if not cmp(res, text):
- module[3] = True
+ def check_file(self, module):
+ module[1] = os.path.isfile(self.asterisk.base + "/usr/lib/asterisk/modules/" + module[0])
+ return module[1]
- def check_file(self, module):
- 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()
+ def check_failures(self, module):
+ if not module[2]:
+ print "ERROR: Loading " + module[0]
+ self.passed = False
- # A timeout in case things hang and fail
- reactor.callLater(20, self.stop_reactor)
+ if not module[3]:
+ print "ERROR: Unloading " + module[0]
+ self.passed = False
- # TODO: Do not hardcode, read from source code.
- preload_resources = ["res_calendar", "res_curl", "res_fax", "res_odbc"]
+ def run(self):
+ self.passed = True
+ preload_res = []
+ res = []
- for module in preload_resources:
- preload_res.append([module + ".so", False, False, False])
+ # A timeout in case things hang and fail
+ reactor.callLater(20, self.stop_reactor)
- # 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"]
+ # TODO: Do not hardcode, read from source code.
+ preload_resources = ["res_calendar", "res_curl", "res_fax", "res_odbc"]
- for module in resources:
- res.append([module + ".so", False, False, False])
+ for module in preload_resources:
+ preload_res.append([module + ".so", False, False, False])
- for module in preload_res:
- self.load_module(module)
+ # 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 res:
- self.load_module(module)
- time.sleep(1)
- self.unload_module(module)
- time.sleep(1)
+ for module in resources:
+ res.append([module + ".so", False, False, False])
- for module in preload_res:
- self.unload_module(module)
+ for module in preload_res:
+ self.load_module(module)
- for module in preload_res:
- # modules does not exist
- if not module[1]:
- print "WARNING: " + module[0] + " does not exist!"
- continue
+ for module in res:
+ result = self.load_module(module)
+ time.sleep(1)
- # TODO: Fix unloading of res_calendar.so
- if module[0] == "res_calendar.so":
- if not module[3]:
- continue
+ if not result:
+ continue
- # TODO: Fix unloading of res_curl.so
- if module[0] == "res_curl.so":
- if not module[3]:
- continue
+ self.unload_module(module)
+ time.sleep(1)
- # TODO: Fix unloading of res_odbc.so
- if module[0] == "res_odbc.so":
- if not module[3]:
- continue
+ for module in preload_res:
+ self.unload_module(module)
- #And check for failures.
- if not module[2] or not module[3]:
- print "ERROR: " + module[0]
- self.passed = False
+ for module in preload_res:
+ # modules does not exist
+ if not module[1]:
+ print "WARNING: " + module[0] + " does not exist!"
+ continue
- for module in res:
- # modules does not exist
- if not module[1]:
- print "WARNING: " + module[0] + " does not exist!"
- continue
+ # TODO: Fix unloading of res_calendar.so
+ if module[0] == "res_calendar.so":
+ if not module[3]:
+ continue
- # TODO: Fix unloading of res_adsi.so
- if module[0] == "res_adsi.so":
- if not module[3]:
- continue
+ # TODO: Fix unloading of res_curl.so
+ if module[0] == "res_curl.so":
+ if not module[3]:
+ continue
- # 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_odbc.so
+ if module[0] == "res_odbc.so":
+ if not module[3]:
+ continue
- # TODO: Fix unloading of res_crypto.so
- if module[0] == "res_crypto.so":
- if not module[3]:
- continue
+ self.check_failures(module);
- # TODO: Fix loading / unloading of res_smdi.so
- if module[0] == "res_smdi.so":
- if not module[2] and not module[3]:
- continue
+ for module in res:
+ # modules does not exist
+ if not module[1]:
+ print "WARNING: " + module[0] + " does not exist!"
+ continue
- # TODO: Fix unloading of res_speech.so
- if module[0] == "res_speech.so":
- if not module[3]:
- continue
+ # TODO: Fix unloading of res_adsi.so
+ if module[0] == "res_adsi.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
+ # 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 loading / unloading of res_config_sqlite.so
+ if module[0] == "res_config_sqlite.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 module[0] == "res_smdi.so":
+ if not module[2] and not module[3]:
+ continue
+
+ # TODO: Fix unloading of res_speech.so
+ if module[0] == "res_speech.so":
+ if not module[3]:
+ continue
+
+ self.check_failures(module);
def main():
- test = moduleLoadUnloadTest()
- reactor.run()
- test.stop_asterisk()
- if test.passed:
- return 0
- return 1
+ test = moduleLoadUnloadTest()
+ test.start_asterisk()
+ reactor.run()
+ test.stop_asterisk()
+ if test.passed:
+ return 0
+ return 1
if __name__ == "__main__":
- sys.exit(main() or 0)
+ sys.exit(main() or 0)
# vim:sw=4:ts=4:expandtab:textwidth=79
More information about the asterisk-commits
mailing list