[asterisk-commits] pabelanger: testsuite/asterisk/trunk r1313 - in /asterisk/trunk/tests/chanspy...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Jan 3 16:47:07 UTC 2011


Author: pabelanger
Date: Mon Jan  3 10:47:04 2011
New Revision: 1313

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=1313
Log:
Rework chanspy_w_mixmonitor tests

Modified:
    asterisk/trunk/tests/chanspy/chanspy_w_mixmonitor/configs/ast1/extensions.conf
    asterisk/trunk/tests/chanspy/chanspy_w_mixmonitor/run-test
    asterisk/trunk/tests/chanspy/chanspy_w_mixmonitor/test-config.yaml

Modified: asterisk/trunk/tests/chanspy/chanspy_w_mixmonitor/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/chanspy/chanspy_w_mixmonitor/configs/ast1/extensions.conf?view=diff&rev=1313&r1=1312&r2=1313
==============================================================================
--- asterisk/trunk/tests/chanspy/chanspy_w_mixmonitor/configs/ast1/extensions.conf (original)
+++ asterisk/trunk/tests/chanspy/chanspy_w_mixmonitor/configs/ast1/extensions.conf Mon Jan  3 10:47:04 2011
@@ -14,7 +14,6 @@
 exten => chanspytest,n,ChanSpy(SIP,q)
 exten => chanspytest,n,StopMixMonitor()
 
-
 exten => detect_audio,1,Answer()
 exten => detect_audio,n,Set(TALK_DETECTED=0) ; initialize TALK_DETECT var
 exten => detect_audio,n,BackgroundDetect(${TESTAUDIO1},1,20,,20000)

Modified: asterisk/trunk/tests/chanspy/chanspy_w_mixmonitor/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/chanspy/chanspy_w_mixmonitor/run-test?view=diff&rev=1313&r1=1312&r2=1313
==============================================================================
--- asterisk/trunk/tests/chanspy/chanspy_w_mixmonitor/run-test (original)
+++ asterisk/trunk/tests/chanspy/chanspy_w_mixmonitor/run-test Mon Jan  3 10:47:04 2011
@@ -61,25 +61,15 @@
         return sequence()
 
     def readResult(self):
-        self.logLastStep("Reading results")
-        self.ast1.cli_exec("core show locks")   # get lock output in case of deadlock before tearing down.
-        self.ast1.cli_exec("core show channels")# if channels are still up for some reason, we want to know that as well
-
-        if self.ast_version < AsteriskVersion("1.6.1"):
-            self.ast1.cli_exec("core show globals") # The global variables here hold failure conditions
-        else:
-            self.ast1.cli_exec("dialplan show globals") # The global variables here hold failure conditions
-
+        self.stop_reactor()
         if self.passed == True:
             print 'SIP ChanSpy test PASSED!'
         else:
             print 'SIP ChanSpy Test FAILED'
 
-
-        self.stopProcesses()
-
+    def stop_reactor(self):
+        print "Stopping Reactor ..."
         if reactor.running:
-            print "Stopping Reactor ..."
             reactor.stop()
 
     def chanspyEvent(self, ami, event):
@@ -94,33 +84,42 @@
             reactor.callLater(2, self.cHangup)
             reactor.callLater(3, self.hangupChanSpy)
         print event
+
     def amiOnConnect(self, ami):
         self.logLastStep("Connected to the AMI")
         self.ami = ami
         self.ami.registerEvent('ChanSpyStart', self.chanspyEvent)
+
     def amiLoginError(self, ami):
         self.logLastStep("AMI login failed")
         reactor.callLater(1, self.readResult)
+
     def amiLogin(self):
         self.logLastStep("Logging in to the AMI")
         self.ami_factory = manager.AMIFactory("user", "mysecret")
         self.ami_factory.login('127.0.0.1', 5038).addCallbacks(self.amiOnConnect, self.amiLoginError)
+
     def aCall(self):
         self.logLastStep("A Calling into Playback")
         self.pja.stdin.write("m\n")
         self.pja.stdin.write("sip:play_exten at 127.0.0.1:5060\n")
+
     def bCall(self):
         self.logLastStep("B Calling into Playback")
         self.pjb.stdin.write("m\n")
         self.pjb.stdin.write("sip:play_exten at 127.0.0.1:5060\n")
+
     def cCall(self):
         self.logLastStep("C Calling into Playback")
         self.pjc.stdin.write("m\n")
         self.pjc.stdin.write("sip:play_exten at 127.0.0.1:5060\n")
+
     def aHangup(self):
         self.pja.stdin.write("h\n")
+
     def bHangup(self):
         self.pjb.stdin.write("h\n")
+
     def cHangup(self):
         self.pjc.stdin.write("h\n")
 
@@ -159,23 +158,16 @@
         reactor.callLater(2, self.verifyAudio)
 
     def verifyAudio(self):
-        if self.ast_version < AsteriskVersion("1.6.2"):
-            self.ast1.cli_exec("originate Local/play_recording at test extension detect_audio at test")
-        else:
-            self.ast1.cli_exec("channel originate Local/play_recording at test extension detect_audio at test")
+        self.ast1.cli_originate("Local/play_recording at test extension detect_audio at test")
 
     def run(self):
-
-        # start up the processes
-        self.startProcesses()
-
         # call extensions
         self.amiLogin()
         reactor.callLater(1, self.callChanSpy)
         reactor.callLater(2, self.aCall)
 
         # stop and read results after timeout
-        reactor.callLater(self.test_to, self.readResult)
+        reactor.callLater(self.test_to, self.stop_reactor)
 
 def main(argv=None):
     if argv is None:
@@ -183,6 +175,7 @@
 
     # Run Test
     test = ChanSpyMixMonitorTest(argv)
+    test.startProcesses()
     reactor.run()
     test.stopProcesses()
     if test.passed != True:
@@ -192,3 +185,4 @@
 if __name__ == "__main__":
     sys.exit(main() or 0)
 
+# vim:sw=4:ts=4:expandtab:textwidth=79

Modified: asterisk/trunk/tests/chanspy/chanspy_w_mixmonitor/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/chanspy/chanspy_w_mixmonitor/test-config.yaml?view=diff&rev=1313&r1=1312&r2=1313
==============================================================================
--- asterisk/trunk/tests/chanspy/chanspy_w_mixmonitor/test-config.yaml (original)
+++ asterisk/trunk/tests/chanspy/chanspy_w_mixmonitor/test-config.yaml Mon Jan  3 10:47:04 2011
@@ -1,5 +1,4 @@
 testinfo:
-    skip: 'Skip while failures are debugged'
     summary:     'Test Chanspy with MixMonitor'
     description: |
         'This test verifies basic functionality of using both ChanSpy




More information about the asterisk-commits mailing list