[svn-commits] pabelanger: branch pabelanger/default_settings r1036 - in /asterisk/team/pabe...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Dec 1 16:53:42 CST 2010


Author: pabelanger
Date: Wed Dec  1 16:53:38 2010
New Revision: 1036

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=1036
Log:
First round of optimizations

Modified:
    asterisk/team/pabelanger/default_settings/tests/fastagi/channel-status/run-test
    asterisk/team/pabelanger/default_settings/tests/fastagi/connect/run-test
    asterisk/team/pabelanger/default_settings/tests/fastagi/control-stream-file/run-test
    asterisk/team/pabelanger/default_settings/tests/fastagi/say-time/run-test

Modified: asterisk/team/pabelanger/default_settings/tests/fastagi/channel-status/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/pabelanger/default_settings/tests/fastagi/channel-status/run-test?view=diff&rev=1036&r1=1035&r2=1036
==============================================================================
--- asterisk/team/pabelanger/default_settings/tests/fastagi/channel-status/run-test (original)
+++ asterisk/team/pabelanger/default_settings/tests/fastagi/channel-status/run-test Wed Dec  1 16:53:38 2010
@@ -23,7 +23,7 @@
 class FastAGIChannelStatusTest:
     def __init__(self, argv):
         self.passed = {'4': False, '6':False}
-        self.timeout = 45
+        self.timeout = 30
         self.test = 4
 
         parser = OptionParser()
@@ -44,8 +44,7 @@
         print 'Could not answer the call:', reason.getTraceback()
 
     def on_failure(self, reason):
-        print 'Could not run deferred for', self.test
-        print reason.getTraceback()
+        print 'Could not run deferred:', reason.getTraceback()
 
     def on_answer(self, status):
         self.do_test(self.agi)
@@ -60,8 +59,7 @@
             print "Answering call"
             self.test = 6
             self.agi.answer().addCallback(self.on_answer).addErrback(
-                self.on_answer_failure
-            )
+                self.on_answer_failure)
         elif self.test == 6:
             self.result_changed()
 
@@ -80,26 +78,18 @@
 	# Read test results and dialplan globals
     def read_result(self):
         self.agi.finish()
+        self.stop_reactor()
         if self.passed[4] is True and self.passed[6] is True:
-            print "PASS - FastAGI CHANNEL STATUS works as expected."
+            print "Success"
         else:
-            self.ast1.cli_exec("core show channels")
-            self.ast1.cli_exec("core show globals")
+            print "Failed"
 
-            print "FAIL - View result of 'core show globals' in log for",\
-                "more detailed failure results."
-            if self.passed[4] is not True: print "Test 4 failed (ringing)."
-            if self.passed[6] is not True: print "Test 6 failed (up)."
-
-        self.stop_asterisk()
-
+    def stop_reactor(sekf):
+        print "Stopping Reactor ..."
         if reactor.running:
-            print "Stopping Reactor ..."
             reactor.stop()
 
     def launch_test(self):
-        self.ast1.cli_exec("agi set debug on")
-
         print "Originating call to begin test."
         self.ast1.cli_exec("originate Local/no_answer at agitest extension echo at agitest", blocking=False)
 
@@ -114,11 +104,11 @@
     # Read result before timeout 
     def result_changed(self):
         if self.passed[6] is not None:
-            reactor.callLater(2, self.read_result)
+            self.read_result()
 
     def run(self):
         self.launch_test()
-        reactor.callLater(self.timeout, self.read_result)
+        reactor.callLater(self.timeout, self.stop_reactor)
 
 def main(argv=None):
     if argv is None:
@@ -127,6 +117,7 @@
     test = FastAGIChannelStatusTest(argv)
     test.start_asterisk()
     reactor.run()
+    test.stop_asterisk()
     if test.passed[4] is not True or test.passed[6] is not True:
         return 1
 

Modified: asterisk/team/pabelanger/default_settings/tests/fastagi/connect/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/pabelanger/default_settings/tests/fastagi/connect/run-test?view=diff&rev=1036&r1=1035&r2=1036
==============================================================================
--- asterisk/team/pabelanger/default_settings/tests/fastagi/connect/run-test (original)
+++ asterisk/team/pabelanger/default_settings/tests/fastagi/connect/run-test Wed Dec  1 16:53:38 2010
@@ -19,6 +19,7 @@
 
 workingdir = "/tmp/asterisk-testsuite/fastagi/connect"
 testdir = "tests/fastagi"
+
 
 class FastAGIConnectTest:
     def __init__(self, argv):
@@ -47,23 +48,17 @@
         self.result_changed()
         return agi.finish()
 
-	# Read test results and dialplan globals
     def read_result(self):
+        self.stop_reactor()
 
         if self.passed is True:
-            print "PASS - FastAGI connection works as expected."
+            print "Success"
         else:
-            self.ast1.cli_exec("core show channels")
-            self.ast1.cli_exec("core show globals")
+            print "Failed"
 
-            print "FAIL - FastAGI Connection test failed. View result of\
-                    'core show globals' in log for more detailed failure\
-                    results."
-
-        self.stop_asterisk()
-
+    def stop_reactor(self):
+        print "Stopping Reactor ..."
         if reactor.running:
-            print "Stopping Reactor ..."
             reactor.stop()
 
     def launch_test(self):
@@ -81,20 +76,22 @@
     # Read result before timeout 
     def result_changed(self):
         if self.passed is True:
-            reactor.callLater(2, self.read_result)
+            self.read_result()
 
     def run(self):
-        self.start_asterisk()
-        reactor.callLater(2, self.launch_test)
-        reactor.callLater(self.timeout, self.read_result)
+        self.launch_test()
+        reactor.callLater(self.timeout, self.stop_reactor)
+
 
 def main(argv=None):
     if argv is None:
         argv = sys.argv
 
-    agi_test = FastAGIConnectTest(argv)
+    test = FastAGIConnectTest(argv)
+    test.start_asterisk()
     reactor.run()
-    if agi_test.passed is not True:
+    test.stop_asterisk()
+    if test.passed is not True:
         return 1
 
     return 0

Modified: asterisk/team/pabelanger/default_settings/tests/fastagi/control-stream-file/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/pabelanger/default_settings/tests/fastagi/control-stream-file/run-test?view=diff&rev=1036&r1=1035&r2=1036
==============================================================================
--- asterisk/team/pabelanger/default_settings/tests/fastagi/control-stream-file/run-test (original)
+++ asterisk/team/pabelanger/default_settings/tests/fastagi/control-stream-file/run-test Wed Dec  1 16:53:38 2010
@@ -20,10 +20,11 @@
 workingdir = "/tmp/asterisk-testsuite/fastagi/control-stream-file"
 testdir = "tests/fastagi"
 
+
 class FastAGIControlStreamFileTest:
     def __init__(self, argv):
         self.passed = False
-        self.timeout = 45
+        self.timeout = 30
 
         parser = OptionParser()
         parser.add_option("-v", "--version", dest="ast_version",
@@ -58,30 +59,19 @@
         return agi.controlStreamFile("beep", "").addCallback(
             self.finish_test).addErrback(self.on_failure)
 
-	# Read test results and dialplan globals
     def read_result(self):
+        self.stop_reactor()
+        if self.passed is True:
+            print "Success"
+        else:
+            print "Failure"
 
-        if self.passed is True:
-            print "PASS - FastAGI CONTROL STREAM FILE works as expected."
-        else:
-            self.ast1.cli_exec("core show channels")
-            self.ast1.cli_exec("core show globals")
-
-            print "FAIL - FastAGI CONTROL STREAM FILE test failed. You",\
-                    "may need to update StarPy. Starpy 1.0.0a13 and older",\
-                    "will always fail this test."
-            print "View result of 'core show globals' in log for more\
-                    detailed failure results."
-
-        self.stop_asterisk()
-
+    def stop_reactor(self):
+        print "Stopping Reactor ..."
         if reactor.running:
-            print "Stopping Reactor ..."
             reactor.stop()
 
     def launch_test(self):
-        self.ast1.cli_exec("agi set debug on")
-
         print "Originating call to begin test."
         self.ast1.cli_exec("originate Local/504 at agitest extension echo at agitest")
 
@@ -96,20 +86,21 @@
     # Read result before timeout
     def result_changed(self):
         if self.passed is True:
-            reactor.callLater(2, self.read_result)
+            self.read_result()
 
     def run(self):
-        self.start_asterisk()
-        reactor.callLater(2, self.launch_test)
-        reactor.callLater(self.timeout, self.read_result)
+        self.launch_test()
+        reactor.callLater(self.timeout, self.stop_reactor)
 
 def main(argv=None):
     if argv is None:
         argv = sys.argv
 
-    agi_test = FastAGIControlStreamFileTest(argv)
+    test = FastAGIControlStreamFileTest(argv)
+    test.start_asterisk()
     reactor.run()
-    if agi_test.passed is not True:
+    test.stop_asterisk()
+    if test.passed is not True:
         return 1
 
     return 0

Modified: asterisk/team/pabelanger/default_settings/tests/fastagi/say-time/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/pabelanger/default_settings/tests/fastagi/say-time/run-test?view=diff&rev=1036&r1=1035&r2=1036
==============================================================================
--- asterisk/team/pabelanger/default_settings/tests/fastagi/say-time/run-test (original)
+++ asterisk/team/pabelanger/default_settings/tests/fastagi/say-time/run-test Wed Dec  1 16:53:38 2010
@@ -92,7 +92,7 @@
         self.ast1.cli_exec("agi set debug on")
 
         print "Originating call to begin test."
-        self.ast1.cli_exec("Local/513 at agitest extension 1 at td_and_agi_notify")
+        self.ast1.cli_exec("originate Local/513 at agitest extension 1 at td_and_agi_notify")
 
     def start_asterisk(self):
         print "Starting Asterisk"




More information about the svn-commits mailing list