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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Dec 1 18:10:30 CST 2010


Author: pabelanger
Date: Wed Dec  1 18:10:26 2010
New Revision: 1037

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

Modified:
    asterisk/team/pabelanger/default_settings/tests/fastagi/configs/ast1/extensions.conf
    asterisk/team/pabelanger/default_settings/tests/fastagi/database/run-test
    asterisk/team/pabelanger/default_settings/tests/fastagi/execute/run-test
    asterisk/team/pabelanger/default_settings/tests/fastagi/get-data/run-test
    asterisk/team/pabelanger/default_settings/tests/fastagi/hangup/run-test
    asterisk/team/pabelanger/default_settings/tests/fastagi/record-file/run-test
    asterisk/team/pabelanger/default_settings/tests/fastagi/say-alpha/run-test
    asterisk/team/pabelanger/default_settings/tests/fastagi/tests.yaml

Modified: asterisk/team/pabelanger/default_settings/tests/fastagi/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/pabelanger/default_settings/tests/fastagi/configs/ast1/extensions.conf?view=diff&rev=1037&r1=1036&r2=1037
==============================================================================
--- asterisk/team/pabelanger/default_settings/tests/fastagi/configs/ast1/extensions.conf (original)
+++ asterisk/team/pabelanger/default_settings/tests/fastagi/configs/ast1/extensions.conf Wed Dec  1 18:10:26 2010
@@ -63,10 +63,8 @@
 exten => 1,n,WaitExten(10)
 exten => 1,n,Hangup()
 
-exten => _5XX,1,Wait(1)
-exten => _5XX,n,Set(TALK_DETECTED=0)
+exten => _5XX,1,Set(TALK_DETECTED=0)
 exten => _5xx,n,BackgroundDetect(silence/10,100,10,20000)
-exten => _5XX,n,Wait(15)
 exten => _5XX,n,Set(GLOBAL(DEBUG)=FAIL - td_and_agi_notify listening for sounds)
 exten => _5XX,n,GoToIf($[${TALK_DETECTED}=0]?fail:pass)
 exten => _5XX,n(fail),Set(GLOBAL(DEBUG)=FAIL - talk detect failed with result ${TALK_DETECTED})

Modified: asterisk/team/pabelanger/default_settings/tests/fastagi/database/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/pabelanger/default_settings/tests/fastagi/database/run-test?view=diff&rev=1037&r1=1036&r2=1037
==============================================================================
--- asterisk/team/pabelanger/default_settings/tests/fastagi/database/run-test (original)
+++ asterisk/team/pabelanger/default_settings/tests/fastagi/database/run-test Wed Dec  1 18:10:26 2010
@@ -20,10 +20,11 @@
 workingdir = "/tmp/asterisk-testsuite/fastagi/database"
 testdir = "tests/fastagi"
 
+
 class FastAGIDatabaseTest:
     def __init__(self, argv):
         self.passed = {}
-        self.timeout = 45
+        self.timeout = 30
         self.key = "fastagitest"
         self.overall_result = True
         self.agi = ""
@@ -61,7 +62,7 @@
     # We expect this to get called when we try to select
     # the key we've just deleted from the database.
     def on_get3_failure(self, reason):
-        print "Success. %s is no longer a valid key." % self.key
+        print "%s is no longer a valid key." % self.key
         self.passed["Del"] = True
         self.result_changed()
 
@@ -75,9 +76,8 @@
         self.passed["Put"] = True
         # 2. Retrieve that key from the database
         print "Retrieving key from the database."
-        self.agi.databaseGet("secret",self.key).addCallback(
-            self.get_result_from_get
-        ).addErrback(self.on_get_failure)
+        self.agi.databaseGet("secret", self.key).addCallback(
+            self.get_result_from_get).addErrback(self.on_get_failure)
 
     # 2. Retrieve that key from the database
     def get_result_from_get(self, result):
@@ -93,9 +93,8 @@
 
         # 3. Update the value of the key in the database
         print "Updating value of key."
-        self.agi.databaseSet("secret",self.key,"halfwaydone").addCallback(
-            self.get_result_from_set
-        ).addErrback(self.on_set_failure)
+        self.agi.databaseSet("secret", self.key, "halfwaydone").addCallback(
+            self.get_result_from_set).addErrback(self.on_set_failure)
 
     # 3. Update the value of the key in the database
     def get_result_from_set(self, result):
@@ -117,15 +116,14 @@
         print 'Value of %s is "%s"' % (self.key, result)
         if result != "halfwaydone":
             self.passed["Set"] = False
-            print "Call to DATABASE SET succeeded,\
+            print "Call to DATABASE SET succeeded, \
                 but value did not get updated."
             print 'Expected value of "halfwaydone" but got "%s"' % result
 
         # 5. Delete that key from the database
         print "Deleting key from database."
         self.agi.databaseDel("secret",self.key).addCallback(
-            self.get_result_from_del
-        ).addErrback(self.on_del_failure)
+            self.get_result_from_del).addErrback(self.on_del_failure)
 
     # 5. Delete that key from the database
     def get_result_from_del(self, result):
@@ -139,8 +137,7 @@
         # 6. Test that key was deleted.
         print "Checking that key was deleted."
         self.agi.databaseGet("secret",self.key).addCallback(
-            self.get_result_from_get3
-        ).addErrback(self.on_get3_failure)
+            self.get_result_from_get3).addErrback(self.on_get3_failure)
 
     # 6. Test that key was deleted.
     # This should never be called if databaseDel() succeeded.
@@ -164,30 +161,29 @@
     def do_test(self, agi):
         self.agi = agi
         print "Inserting key into database."
-        return agi.databaseSet("secret",self.key,"juststarted").addCallback(
-            self.get_result_from_put
-        ).addErrback(self.on_put_failure)
+        return agi.databaseSet("secret", self.key, "juststarted").addCallback(
+            self.get_result_from_put).addErrback(self.on_put_failure)
 
 	# Read test results and dialplan globals
     def read_result(self):
         self.agi.finish()
+        self.stop_reactor()
 
         for test in self.passed:
-            if self.passed[test] is True:
-                print "database%s worked as expected." % test
-            else:
-                print "database%s FAILED." % test
+            if self.passed[test] is False:
                 self.overall_result = False
 
-        self.stop_asterisk()
-
+        if self.overall_result is True:
+            print "Success"
+	else:
+            print "Failed"
+
+    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/506 at agitest extension echo at agitest")
 
@@ -204,21 +200,22 @@
         # if self.passed["Put"] is None, not one test has completed yet
         # and we should wait for the timeout.
         if self.passed["Put"] is not None:
-            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 = FastAGIDatabaseTest(argv)
+    test = FastAGIDatabaseTest(argv)
+    test.start_asterisk()
     reactor.run()
-
-    if agi_test.overall_result is not True:
+    test.stop_asterisk()
+    if test.overall_result is not True:
         return 1
 
     return 0

Modified: asterisk/team/pabelanger/default_settings/tests/fastagi/execute/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/pabelanger/default_settings/tests/fastagi/execute/run-test?view=diff&rev=1037&r1=1036&r2=1037
==============================================================================
--- asterisk/team/pabelanger/default_settings/tests/fastagi/execute/run-test (original)
+++ asterisk/team/pabelanger/default_settings/tests/fastagi/execute/run-test Wed Dec  1 18:10:26 2010
@@ -28,7 +28,7 @@
             'Set [Global]': False,
             'Set [Channel]': False
         }
-        self.timeout = 45
+        self.timeout = 30
         self.key = "fastagitest"
         self.overall_result = True
         self.agi = ""
@@ -70,15 +70,13 @@
 
     def on_Set2_success(self, result):
         self.agi.getVariable('LAMB').addCallback(
-            self.on_get_variable2
-        ).addErrback(self.on_get_variable2_failure)
+            self.on_get_variable2).addErrback(self.on_get_variable2_failure)
         self.passed['Set [Channel]'] = True
 
     # 4. Set(DEBUG=${VAR})
     def do_Set2(self):
         self.agi.execute("Set", "LAMB=sure to go").addCallback(
-            self.on_Set2_success
-        ).addErrback(self.on_Set2_failure)
+            self.on_Set2_success).addErrback(self.on_Set2_failure)
 
     def on_get_variable_failure(self, reason):
         self.passed['Set [Global]'] = False
@@ -102,15 +100,13 @@
 
     def on_Set_success(self, result):
         self.agi.getVariable('FLEECE').addCallback(
-            self.on_get_variable
-        ).addErrback(self.on_get_variable_failure)
+            self.on_get_variable).addErrback(self.on_get_variable_failure)
         self.passed['Set [Global]'] = True
 
     # 3. Set(GLOBAL(DEBUG)=${VAR})
     def do_Set(self):
         self.agi.execute("Set", "GLOBAL(FLEECE)=white as snow").addCallback(
-            self.on_Set_success
-        ).addErrback(self.on_Set_failure)
+            self.on_Set_success).addErrback(self.on_Set_failure)
 
     def on_System_failure(self, reason):
         self.passed['System'] = False
@@ -124,8 +120,7 @@
     # 2. System(command arg1 arg2 etc)
     def do_System(self):
         self.agi.execute("System", "echo little lamb").addCallback(
-            self.on_System_success
-        ).addErrback(self.on_System_failure)
+            self.on_System_success).addErrback(self.on_System_failure)
 
     def on_SendDTMF_failure(self, reason):
         self.passed['SendDTMF'] = False
@@ -152,27 +147,28 @@
         self.agi = agi
         return agi.execute(
             "SendDTMF", "3212333", 300, comma_delimiter=True
-        ).addCallback(
-            self.on_SendDTMF_success
+        ).addCallback(self.on_SendDTMF_success
         ).addErrback(self.on_SendDTMF_failure)
 
 	# Read test results and dialplan globals
     def read_result(self):
         self.agi.finish()
+        self.stop_reactor()
         for test in self.passed:
-            if self.passed[test] is True:
-                print "EXECUTE (%s) worked as expected." % test
-            else:
-                print "EXECUTE (%s) FAILED." % test
+            if self.passed[test] is False:
                 self.overall_result = False
 
-        self.stop_asterisk()
+        if self.overall_result is True:
+            print "Success"
+	else:
+            print "Failed"
+
+    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/507 at agitest extension echo at agitest")
 
@@ -189,20 +185,21 @@
         # If self.passed["SendDTMF"] is False, not one test has completed yet
         # and we should wait for the timeout.
         if self.passed["SendDTMF"] is not False:
-            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 = FastAGIExecuteTest(argv)
+    test = FastAGIExecuteTest(argv)
+    test.start_asterisk()
     reactor.run()
-    if agi_test.overall_result is not True:
+    test.stop_asterisk()
+    if test.overall_result is not True:
         return 1
 
     return 0

Modified: asterisk/team/pabelanger/default_settings/tests/fastagi/get-data/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/pabelanger/default_settings/tests/fastagi/get-data/run-test?view=diff&rev=1037&r1=1036&r2=1037
==============================================================================
--- asterisk/team/pabelanger/default_settings/tests/fastagi/get-data/run-test (original)
+++ asterisk/team/pabelanger/default_settings/tests/fastagi/get-data/run-test Wed Dec  1 18:10:26 2010
@@ -23,7 +23,7 @@
 class FastAGIGetDataTest:
     def __init__(self, argv):
         self.passed = False
-        self.timeout = 45
+        self.timeout = 30
 
         parser = OptionParser()
         parser.add_option("-v", "--version", dest="ast_version",
@@ -68,26 +68,19 @@
 
 	# Read test results and dialplan globals
     def read_result(self):
+        self.stop_reactor()
 
         if self.passed is True:
-            print "PASS - FastAGI GET DATA 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 GET DATA 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):
-        self.ast1.cli_exec("agi set debug on")
-
         print "Originating call to begin test."
         self.ast1.cli_exec("originate Local/502 at agitest extension 1 at get-data")
 
@@ -102,20 +95,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 = FastAGIGetDataTest(argv)
+    test = FastAGIGetDataTest(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/hangup/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/pabelanger/default_settings/tests/fastagi/hangup/run-test?view=diff&rev=1037&r1=1036&r2=1037
==============================================================================
--- asterisk/team/pabelanger/default_settings/tests/fastagi/hangup/run-test (original)
+++ asterisk/team/pabelanger/default_settings/tests/fastagi/hangup/run-test Wed Dec  1 18:10:26 2010
@@ -24,7 +24,7 @@
 class FastAGIHangupTest:
     def __init__(self, argv):
         self.passed = False
-        self.timeout = 45
+        self.timeout = 30
         self.test = 1
 
         parser = OptionParser()
@@ -57,11 +57,8 @@
         print "Channel is still up! Status is", status, "Maybe the channel is still attempting to hangup..."
         print "Testing for closed channel again."
         time.sleep(5)
-        self.agi.channelStatus(
-                agi.variables['agi_channel']
-            ).addCallback(
-                self.finish_test2
-            ).addErrback(self.on_failure)
+        self.agi.channelStatus(agi.variables['agi_channel']
+            ).addCallback(self.finish_test2).addErrback(self.on_failure)
 
     def finish_test2(self, status):
         print "Channel is still up! Status is", status
@@ -75,39 +72,28 @@
         if self.test == 1:
             print "Connection established."
             return agi.hangup().addCallback(self.on_hangup).addErrback(
-                self.on_hangup_failure
-            )
+                self.on_hangup_failure)
         elif self.test == 2:
             print "Testing for closed channel."
             # We expect this call to fail, as channelStatus()
             # cannot query a dead channel
-            return agi.channelStatus(
-                agi.variables['agi_channel']
-            ).addCallback(
-                self.finish_test
-            ).addErrback(self.on_failure)
+            return agi.channelStatus(agi.variables['agi_channel']
+                ).addCallback(self.finish_test).addErrback(self.on_failure)
 
-	# Read test results and dialplan globals
     def read_result(self):
         self.agi.finish()
+        self.stop_reactor()
         if self.passed is True:
-            print "PASS - FastAGI HANGUP 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."
-
-        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/503 at agitest extension echo at agitest")
 
@@ -122,20 +108,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 = FastAGIHangupTest(argv)
+    test = FastAGIHangupTest(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/record-file/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/pabelanger/default_settings/tests/fastagi/record-file/run-test?view=diff&rev=1037&r1=1036&r2=1037
==============================================================================
--- asterisk/team/pabelanger/default_settings/tests/fastagi/record-file/run-test (original)
+++ asterisk/team/pabelanger/default_settings/tests/fastagi/record-file/run-test Wed Dec  1 18:10:26 2010
@@ -20,6 +20,7 @@
 workingdir = "/tmp/asterisk-testsuite/fastagi/execute"
 testdir = "tests/fastagi"
 
+
 class FastAGIRecordFileTest:
     def __init__(self, argv):
         self.passed = {
@@ -27,7 +28,7 @@
             "HANGUP": False
         }
         self.test = "DTMF"
-        self.timeout = 45
+        self.timeout = 30
         self.key = "fastagitest"
         self.overall_result = True
         self.agi = ""
@@ -56,7 +57,7 @@
         print 'Could not record file:', reason.getTraceback()
         if self.test is "DTMF":
             self.test = "HANGUP"
-            reactor.callLater(2, self.launch_test())
+            reactor.callLater(0, self.launch_test())
         else:
             self.result_changed()
 
@@ -66,7 +67,7 @@
         except:
             digit = None
 
-        print "Recording terminated by %s (%s) after %s bytes."\
+        print "Recording terminated by %s (%s) after %s bytes." \
             % (result[1], digit, result[2])
         if os.path.exists(self.audio_file):
             file_size = os.path.getsize(self.audio_file)
@@ -74,11 +75,11 @@
                 print "The file was created, but it is empty."
                 self.passed[self.test] = False
             elif result[2] == file_size:
-                print "Data was recorded, and data length matches what was",\
+                print "Data was recorded, and data length matches what was", \
                     "reported during the %s test." % self.test
                 self.passed[self.test] = True
             else:
-                print "Some data was recorded, but the data length does not",\
+                print "Some data was recorded, but the data length does not", \
                     "match what was reported during the %s test." % self.test
                 self.passed[self.test] = False
         else:
@@ -87,43 +88,34 @@
 
         if self.test is "DTMF":
             self.test = "HANGUP"
-            reactor.callLater(2, self.launch_test)
+            reactor.callLater(0, self.launch_test)
         else:
             self.result_changed()
 
     # This gets invoked by the dialplan when the call is answered
     def do_test(self, agi):
         self.agi = agi
-        return agi.recordFile(
-            "%s/out" % (workingdir), "ulaw", "#", "3"
-        ).addCallback(
-            self.on_record_success
-        ).addErrback(self.on_record_failure)
+        return agi.recordFile("%s/out" % (workingdir), "ulaw", "#", "3"
+            ).addCallback(self.on_record_success).addErrback(self.on_record_failure)
 
-	# Read test results and dialplan globals
     def read_result(self):
         self.agi.finish()
+        self.stop_reactor()
         for t, r in self.passed.iteritems():
             if self.passed[t] is False:
-                print "RECORD FILE did NOT work as expected when",\
-                    "terminated with", t
                 self.overall_result = False
 
-        if self.overall_result is False:
-            self.ast1.cli_exec("core show channels")
-            self.ast1.cli_exec("core show globals")
+	if self.overall_result is True:
+            print "Success"
+	else:
+            print "Failed"
 
-            print "FAIL - FastAGI RECORD FILE 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):
-        self.ast1.cli_exec("agi set debug on")
         print "Originating call to begin test which terminates recording",\
             "with", self.test
         if self.test is "DTMF":
@@ -144,20 +136,21 @@
     # Read result before timeout
     def result_changed(self):
         if self.passed['DTMF'] is True and self.passed['HANGUP'] 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 = FastAGIRecordFileTest(argv)
+    test = FastAGIRecordFileTest(argv)
+    test.start_asterisk()
     reactor.run()
-    if agi_test.overall_result is not True:
+    test.stop_asterisk()
+    if test.overall_result is not True:
         return 1
 
     return 0

Modified: asterisk/team/pabelanger/default_settings/tests/fastagi/say-alpha/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/pabelanger/default_settings/tests/fastagi/say-alpha/run-test?view=diff&rev=1037&r1=1036&r2=1037
==============================================================================
--- asterisk/team/pabelanger/default_settings/tests/fastagi/say-alpha/run-test (original)
+++ asterisk/team/pabelanger/default_settings/tests/fastagi/say-alpha/run-test Wed Dec  1 18:10:26 2010
@@ -20,11 +20,12 @@
 workingdir = "/tmp/asterisk-testsuite/fastagi/say-alpha"
 testdir = "tests/fastagi"
 
+
 class FastAGISayAlphaTest:
     def __init__(self, argv):
         self.passed = False
         self.notified = False
-        self.timeout = 45
+        self.timeout = 30
 
         parser = OptionParser()
         parser.add_option("-v", "--version", dest="ast_version",
@@ -47,9 +48,6 @@
     def listen_result(self, agi):
         print "Got test success confirmation from dialplan."
         self.notified = True
-        agi.finish()
-        self.agi.finish()
-        self.result_changed()
 
     def on_failure(self, reason):
         print 'SAY ALPHA failed: ', reason.getTraceback()
@@ -58,6 +56,7 @@
     def finish_test(self, result):
         print "AGI command reports success."
         self.passed = True
+        self.result_changed()
 
     # This gets invoked by the dialplan when the call is answered
     # send SAY ALPHA command and wait for results
@@ -65,31 +64,22 @@
         self.agi = agi
         print "Connection established."
         return agi.sayAlpha("respect").addCallback(
-            self.finish_test
-        ).addErrback(self.on_failure)
+            self.finish_test).addErrback(self.on_failure)
 
-	# Read test results and dialplan globals
     def read_result(self):
         self.agi.finish()
+        self.stop_reactor()
         if self.passed is True and self.notified is True:
-            print "PASS - FastAGI SAY ALPHA 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 SAY ALPHA 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):
-        self.ast1.cli_exec("agi set debug on")
-
         print "Originating call to begin test."
         self.ast1.cli_exec("originate Local/510 at agitest extension 1 at td_and_agi_notify")
 
@@ -104,20 +94,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 = FastAGISayAlphaTest(argv)
+    test = FastAGISayAlphaTest(argv)
+    test.start_asterisk()
     reactor.run()
-    if agi_test.passed is not True or agi_test.notified is not True:
+    test.stop_asterisk()
+    if test.passed is not True or test.notified is not True:
         return 1
 
     return 0

Modified: asterisk/team/pabelanger/default_settings/tests/fastagi/tests.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/pabelanger/default_settings/tests/fastagi/tests.yaml?view=diff&rev=1037&r1=1036&r2=1037
==============================================================================
--- asterisk/team/pabelanger/default_settings/tests/fastagi/tests.yaml (original)
+++ asterisk/team/pabelanger/default_settings/tests/fastagi/tests.yaml Wed Dec  1 18:10:26 2010
@@ -9,7 +9,7 @@
     - test: 'execute'
     - test: 'get-data'
     # Temporarily disabled while failures are debugged
-    #- test: 'record-file'
+    - test: 'record-file'
     - test: 'say-alpha'
     - test: 'say-date'
     - test: 'say-datetime'




More information about the asterisk-commits mailing list