[asterisk-commits] pabelanger: branch pabelanger/dynamic-modules r293 - in /asterisk/team/pabela...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed May 12 15:41:09 CDT 2010
Author: pabelanger
Date: Wed May 12 15:41:06 2010
New Revision: 293
URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=293
Log:
Import dynamic-modules test.
Added:
asterisk/team/pabelanger/dynamic-modules/tests/dynamic-modules/
asterisk/team/pabelanger/dynamic-modules/tests/dynamic-modules/configs/
asterisk/team/pabelanger/dynamic-modules/tests/dynamic-modules/configs/logger.conf (with props)
asterisk/team/pabelanger/dynamic-modules/tests/dynamic-modules/configs/modules.conf (with props)
asterisk/team/pabelanger/dynamic-modules/tests/dynamic-modules/run-test (with props)
asterisk/team/pabelanger/dynamic-modules/tests/dynamic-modules/test-config.yaml (with props)
Modified:
asterisk/team/pabelanger/dynamic-modules/lib/python/asterisk/asterisk.py
asterisk/team/pabelanger/dynamic-modules/tests/tests.yaml
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=293&r1=292&r2=293
==============================================================================
--- asterisk/team/pabelanger/dynamic-modules/lib/python/asterisk/asterisk.py (original)
+++ asterisk/team/pabelanger/dynamic-modules/lib/python/asterisk/asterisk.py Wed May 12 15:41:06 2010
@@ -167,8 +167,10 @@
"-rx", "%s" % cli_cmd
]
print "Executing %s ..." % cmd
- process = subprocess.Popen(cmd)
+ process = subprocess.Popen(cmd, stdout=subprocess.PIPE)
+ output = process.p.communicate()[0].rstrip()
process.wait()
+ return output
def __gen_ast_conf(self, ast_conf, dir_cat):
for (var, val) in dir_cat.options:
Added: 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=auto&rev=293
==============================================================================
--- asterisk/team/pabelanger/dynamic-modules/tests/dynamic-modules/configs/logger.conf (added)
+++ asterisk/team/pabelanger/dynamic-modules/tests/dynamic-modules/configs/logger.conf Wed May 12 15:41:06 2010
@@ -1,0 +1,7 @@
+[general]
+
+[logfiles]
+
+console =>
+messages => notice,warning,error
+full => notice,warning,error,debug,verbose
Propchange: asterisk/team/pabelanger/dynamic-modules/tests/dynamic-modules/configs/logger.conf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/team/pabelanger/dynamic-modules/tests/dynamic-modules/configs/logger.conf
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/team/pabelanger/dynamic-modules/tests/dynamic-modules/configs/logger.conf
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/team/pabelanger/dynamic-modules/tests/dynamic-modules/configs/modules.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/pabelanger/dynamic-modules/tests/dynamic-modules/configs/modules.conf?view=auto&rev=293
==============================================================================
--- asterisk/team/pabelanger/dynamic-modules/tests/dynamic-modules/configs/modules.conf (added)
+++ asterisk/team/pabelanger/dynamic-modules/tests/dynamic-modules/configs/modules.conf Wed May 12 15:41:06 2010
@@ -1,0 +1,2 @@
+[modules]
+autoload=no
Propchange: asterisk/team/pabelanger/dynamic-modules/tests/dynamic-modules/configs/modules.conf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/team/pabelanger/dynamic-modules/tests/dynamic-modules/configs/modules.conf
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/team/pabelanger/dynamic-modules/tests/dynamic-modules/configs/modules.conf
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: 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=auto&rev=293
==============================================================================
--- asterisk/team/pabelanger/dynamic-modules/tests/dynamic-modules/run-test (added)
+++ asterisk/team/pabelanger/dynamic-modules/tests/dynamic-modules/run-test Wed May 12 15:41:06 2010
@@ -1,0 +1,89 @@
+#!/usr/bin/env python
+'''
+Copyright (C) 2010, Polybeacon
+Paul Belanger <paul.belanger at polybeacon.com>
+
+This program is free software, distributed under the terms of
+the GNU General Public License Version 2.
+'''
+
+import sys
+import os
+import shutil
+import time
+from twisted.application import service, internet
+from twisted.internet import reactor, defer
+from starpy import manager
+
+sys.path.append("lib/python")
+from asterisk.asterisk import Asterisk
+
+class moduleLoadUnloadTest:
+ def __init__(self):
+ self.passed = False
+ self.last_step = ""
+
+ reactor.callWhenRunning(self.run)
+
+ 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")
+
+ def stop_reactor(self):
+ self.stop_asterisk()
+ 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 10")
+ self.asterisk.cli_exec("core set debug 3")
+
+ def stop_asterisk(self):
+ self.asterisk.stop()
+
+ def log_last_step(self, step):
+ print step
+ self.last_step = step
+
+ def load_module(self, module):
+ text = "Loaded " + module
+ self.passed = True
+
+ res = self.asterisk.cli_exec("module load " + module)
+ if (res != text):
+ self.log_last_step("Expected '" + text + "' but received '" + res + "'")
+ self.passed = False
+
+ def unload_module(self, module):
+ text = "Unloaded " + module
+
+ res = self.asterisk.cli_exec("module unload " + module)
+ if (res != text):
+ self.log_last_step("Expected '" + text + "' but received '" + res + "'")
+ self.passed = False
+
+ def run(self):
+ self.start_asterisk()
+
+ # 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")
+
+def main():
+ test = moduleLoadUnloadTest()
+ reactor.run()
+ test.stop_asterisk()
+ if test.passed:
+ return 0
+ return 1
+
+if __name__ == "__main__":
+ sys.exit(main() or 0)
+
+# vim:sw=4:ts=4:expandtab:textwidth=79
Propchange: asterisk/team/pabelanger/dynamic-modules/tests/dynamic-modules/run-test
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/team/pabelanger/dynamic-modules/tests/dynamic-modules/run-test
------------------------------------------------------------------------------
svn:executable = *
Propchange: asterisk/team/pabelanger/dynamic-modules/tests/dynamic-modules/run-test
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/team/pabelanger/dynamic-modules/tests/dynamic-modules/run-test
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/team/pabelanger/dynamic-modules/tests/dynamic-modules/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/pabelanger/dynamic-modules/tests/dynamic-modules/test-config.yaml?view=auto&rev=293
==============================================================================
--- asterisk/team/pabelanger/dynamic-modules/tests/dynamic-modules/test-config.yaml (added)
+++ asterisk/team/pabelanger/dynamic-modules/tests/dynamic-modules/test-config.yaml Wed May 12 15:41:06 2010
@@ -1,0 +1,11 @@
+testinfo:
+ summary: 'Test dynamicly loading and unloading modules'
+ description: |
+ 'This test provides a basic sanity check on Asterisk
+ modules.'
+
+properties:
+ minversion: '1.8'
+ dependencies:
+ - python : 'twisted'
+ - python : 'starpy'
Propchange: asterisk/team/pabelanger/dynamic-modules/tests/dynamic-modules/test-config.yaml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/team/pabelanger/dynamic-modules/tests/dynamic-modules/test-config.yaml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/team/pabelanger/dynamic-modules/tests/dynamic-modules/test-config.yaml
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: asterisk/team/pabelanger/dynamic-modules/tests/tests.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/pabelanger/dynamic-modules/tests/tests.yaml?view=diff&rev=293&r1=292&r2=293
==============================================================================
--- asterisk/team/pabelanger/dynamic-modules/tests/tests.yaml (original)
+++ asterisk/team/pabelanger/dynamic-modules/tests/tests.yaml Wed May 12 15:41:06 2010
@@ -6,6 +6,7 @@
- test: 'rfc2833_dtmf_detect'
- test: 'sip_channel_params'
- test: 'iax-call-basic'
+ - test: 'dynamic-modules'
- test: 'manager-action-events-response'
- test: 'cdr/console_dial_sip_answer'
- test: 'cdr/console_dial_sip_busy'
More information about the asterisk-commits
mailing list