[asterisk-commits] pabelanger: testsuite/asterisk/trunk r1023 - in /asterisk/trunk/tests/directe...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Nov 30 22:26:37 CST 2010
Author: pabelanger
Date: Tue Nov 30 22:26:34 2010
New Revision: 1023
URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=1023
Log:
Remove unneeded sleep and wait functions
Modified:
asterisk/trunk/tests/directed_pickup/configs/ast1/extensions.conf
asterisk/trunk/tests/directed_pickup/run-test
Modified: asterisk/trunk/tests/directed_pickup/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/directed_pickup/configs/ast1/extensions.conf?view=diff&rev=1023&r1=1022&r2=1023
==============================================================================
--- asterisk/trunk/tests/directed_pickup/configs/ast1/extensions.conf (original)
+++ asterisk/trunk/tests/directed_pickup/configs/ast1/extensions.conf Tue Nov 30 22:26:34 2010
@@ -3,29 +3,22 @@
[globals]
[pickuptest]
-
exten => h,1,GoToIf($[${RINGING_EXTEN}=1]?is_ringing:bye)
-
; this is the ringing channel, see if it got picked up correctly or not.
exten => h,n(is_ringing),GoToIf($[${RINGING_EXTEN_PASS}=1]?is_ringing_passed:is_ringing_failed)
-
exten => h,n(is_ringing_failed),AGI(agi://127.0.0.1:4574) ;Tell the test script pickup failed
exten => h,n,GoTo(pickuptest,h,bye) ; finish
-
exten => h,n(is_ringing_passed),AGI(agi://127.0.0.1:4573) ;Tell the test script pickup passed
exten => h,n(bye),NoOp(Bye ${CHANNEL})
-
exten => 1001,1,Dial(IAX2/iax_pickup_b at 127.0.0.1/ringing_exten)
;test 1 with no options
exten => 1002,1,PickupChan(IAX2/iax_pickup_b)
-exten => 1002,n,Wait(1)
exten => 1002,n,Hangup()
;test 2 with 'p' option
exten => 1003,1,PickupChan(IAX2/iax_pickup,p)
-exten => 1003,n,Wait(1)
exten => 1003,n,Hangup()
; this exten Answers and waits for the other side to answer
@@ -36,9 +29,7 @@
exten => ringing_exten,1,Set(RINGING_EXTEN=1)
exten => ringing_exten,n,Set(RINGING_EXTEN_PASS=1)
exten => ringing_exten,n,Wait(10)
-exten => ringing_exten,n,NoOp(This should not get called)
-
+exten => ringing_exten,n,Verbose(This should not get called)
; this exten should be hungup on before reaching this
exten => ringing_exten,n,Set(RINGING_EXTEN_PASS=0)
exten => ringing_exten,n,Hangup()
-
Modified: asterisk/trunk/tests/directed_pickup/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/directed_pickup/run-test?view=diff&rev=1023&r1=1022&r2=1023
==============================================================================
--- asterisk/trunk/tests/directed_pickup/run-test (original)
+++ asterisk/trunk/tests/directed_pickup/run-test Tue Nov 30 22:26:34 2010
@@ -53,19 +53,13 @@
reactor.callWhenRunning(self.run)
- print self.ast_version
self.ast1 = Asterisk(base=workingdir)
self.ast1.install_configs("%s/configs/ast1" % (testdir))
def shut_down(self):
self.log_last_step("Reading results")
- self.ast1.cli_exec("core show channels")# if channels are still up for some reason, we want to know that as well
- self.stop_asterisk()
-
- if reactor.running:
- print "Stopping Reactor ..."
- reactor.stop()
+ self.stop_reactor()
if self.test1_res != FAIL and self.test2_res != FAIL:
self.passed = True
@@ -96,10 +90,10 @@
if self.test1_res == FAIL or self.test2_res == FAIL:
# schedule early shutdown, a test failed
- reactor.callLater(2, self.shut_down)
+ self.shut_down()
elif self.test1_res != NOT_RUN and self.test2_res != NOT_RUN:
# schedule early shutdown, all tests ran
- reactor.callLater(2, self.shut_down)
+ self.shut_down()
elif self.test2_res == NOT_RUN:
# schedule test2 if test1 passed
reactor.callLater(2, self.launch_test2)
@@ -115,7 +109,6 @@
return self.handle_agi_result(agi)
def test1_pickup(self):
- self.ast1.cli_exec("core show channels")
self.log_last_step("Issuing the pickup")
self.ast1.cli_exec("console dial 1002 at pickuptest")
@@ -125,10 +118,9 @@
self.ast1.cli_exec("originate IAX2/iax_pickup_b at 127.0.0.1/waiting_exten extension 1001 at pickuptest")
else:
self.ast1.cli_exec("channel originate IAX2/iax_pickup_b at 127.0.0.1/waiting_exten extension 1001 at pickuptest")
- reactor.callLater(2, self.test1_pickup)
+ self.test1_pickup()
def test2_pickup(self):
- self.ast1.cli_exec("core show channels")
self.log_last_step("Issuing the pickup")
self.ast1.cli_exec("console dial 1003 at pickuptest")
@@ -137,10 +129,10 @@
if self.ast_version < AsteriskVersion("1.8"):
# this part requires version 1.8 or greater.
self.test2 = SKIP
- reactor.callLater(2, self.shut_down)
+ self.shut_down()
else:
self.ast1.cli_exec("channel originate IAX2/iax_pickup_b at 127.0.0.1/waiting_exten extension 1001 at pickuptest")
- reactor.callLater(2, self.test2_pickup)
+ self.test2_pickup()
def start_asterisk(self):
self.log_last_step("Starting Asterisk")
@@ -153,23 +145,27 @@
print step
self.last_step = step
+ def stop_reactor(self):
+ print "Stopping Reactor ..."
+ if reactor.running:
+ reactor.stop()
+
def run(self):
- self.start_asterisk()
+ self.launch_test1()
- # call test1 extension now
- reactor.callLater(1, self.launch_test1)
+ # stop reactor after timeout
+ reactor.callLater(self.test_to, self.stop_reactor)
- # stop and read results after timeout
- reactor.callLater(self.test_to, self.shut_down)
def main(argv=None):
if argv is None:
argv = sys.argv
- pickup_test = PickupTest(argv)
+ test = PickupTest(argv)
+ test.start_asterisk()
reactor.run()
- pickup_test.stop_asterisk()
- if pickup_test.passed != PASS:
+ test.stop_asterisk()
+ if test.passed != PASS:
return 1
return 0
More information about the asterisk-commits
mailing list