[asterisk-commits] pabelanger: testsuite/asterisk/trunk r1112 - /asterisk/trunk/tests/udptl/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Dec 8 15:41:15 CST 2010
Author: pabelanger
Date: Wed Dec 8 15:41:11 2010
New Revision: 1112
URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=1112
Log:
Optimize udptl test
Modified:
asterisk/trunk/tests/udptl/run-test
Modified: asterisk/trunk/tests/udptl/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/udptl/run-test?view=diff&rev=1112&r1=1111&r2=1112
==============================================================================
--- asterisk/trunk/tests/udptl/run-test (original)
+++ asterisk/trunk/tests/udptl/run-test Wed Dec 8 15:41:11 2010
@@ -48,6 +48,10 @@
self.ast2.start()
self.ast2.cli_exec("fax set debug on")
+ def stop_asterisk(self):
+ self.ast1.stop()
+ self.ast2.stop()
+
def ami_on_connect1(self, ami):
self.log_last_step("Connected to AMI 1")
self.ami1 = ami
@@ -59,16 +63,16 @@
self.log_last_step("Checking Userevent")
if event.get("userevent").lower() != "recvstatus":
return
+ self.stop_reactor()
status = event.get("status")
print ("Status of FAX is %s" % (status))
if status == "SUCCESS":
self.passed = True
+ print "UDPTL test passed!"
else:
self.passed = False
-
- if self.shutdowncall.active():
- self.shutdowncall.reset(1)
+ print "UDPTL test failed!"
def ami_on_connect2(self, ami):
self.log_last_step("Connected to AMI 2")
@@ -77,7 +81,7 @@
def ami_login_error(self, ami):
self.log_last_step("AMI login failed")
- reactor.callLater(1, self.shut_down)
+ reactor.callLater(1, self.stop_reactor)
def ami_login(self):
self.log_last_step("Logging in to the AMI")
@@ -90,23 +94,14 @@
print step
self.lastStep = step
- def shut_down(self):
- self.ast1.stop()
- self.ast2.stop()
-
- if self.passed:
- print "UDPTL test passed!"
- else:
- print "UDPTL test failed!"
-
+ def stop_reactor(self):
+ print "Stopping reactor"
if reactor.running:
- print "Stopping reactor"
reactor.stop()
def run(self):
- self.start_asterisk()
self.ami_login()
- self.shutdowncall = reactor.callLater(90, self.shut_down)
+ self.shutdowncall = reactor.callLater(60, self.stop_reactor)
def main(argv=None):
@@ -114,9 +109,11 @@
argv = sys.argv
# Run UDPTL test
- udptl_test = UdptlTest(argv)
+ test = UdptlTest(argv)
+ test.start_asterisk()
reactor.run()
- if not udptl_test.passed:
+ test.stop_asterisk()
+ if not test.passed:
return 1
return 0
More information about the asterisk-commits
mailing list