[svn-commits] mjordan: testsuite/asterisk/trunk r3010 - in /asterisk/trunk: lib/python/aste...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Jan 25 16:04:29 CST 2012


Author: mjordan
Date: Wed Jan 25 16:04:25 2012
New Revision: 3010

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=3010
Log:
Update SIPpTest to inherit from TestCase

Since SIPpTest didn't inherit from TestCase, it didn't get the logger,
twilson's pcap library, the test controller stuff, etc.  Making it inherit
from the common base class gives it all this, and only necessitated minor
changes in the users of the SIPpTest class.

Modified:
    asterisk/trunk/lib/python/asterisk/sipp.py
    asterisk/trunk/tests/channels/SIP/codec_negotiation/run-test
    asterisk/trunk/tests/channels/SIP/message_auth/run-test
    asterisk/trunk/tests/channels/SIP/message_auth_cust_hdr/run-test
    asterisk/trunk/tests/channels/SIP/message_disabled/run-test
    asterisk/trunk/tests/channels/SIP/message_from_call/run-test
    asterisk/trunk/tests/channels/SIP/message_unauth/run-test
    asterisk/trunk/tests/channels/SIP/message_unauth_from/run-test
    asterisk/trunk/tests/channels/SIP/options/run-test

Modified: asterisk/trunk/lib/python/asterisk/sipp.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/lib/python/asterisk/sipp.py?view=diff&rev=3010&r1=3009&r2=3010
==============================================================================
--- asterisk/trunk/lib/python/asterisk/sipp.py (original)
+++ asterisk/trunk/lib/python/asterisk/sipp.py Wed Jan 25 16:04:25 2012
@@ -15,7 +15,9 @@
 import subprocess
 import logging
 
+from twisted.internet import reactor
 from asterisk import Asterisk
+from TestCase import TestCase
 
 logger = logging.getLogger(__name__)
 
@@ -107,7 +109,7 @@
         return passed
 
 
-class SIPpTest:
+class SIPpTest(TestCase):
     """
     A SIPp based test for the Asterisk testsuite.
 
@@ -150,6 +152,7 @@
                                headers, Via headers, etc.
                 -timeout 20s - Set a global test timeout of 20 seconds.
         """
+        TestCase.__init__(self)
         self.working_dir = working_dir
         self.test_dir = test_dir
         self.scenarios = scenarios
@@ -158,8 +161,7 @@
         self.stderr = []
         self.result = []
 
-        self.ast1 = Asterisk(base=self.working_dir)
-        self.ast1.install_configs('%s/configs/ast1' % self.test_dir)
+        self.create_asterisk()
 
     def __run_sipp(self, scenario, default_port):
         sipp_args = [
@@ -193,7 +195,9 @@
 
         Returns 0 for success, 1 for failure.
         """
-        self.ast1.start()
+        self.start_asterisk()
+
+        TestCase.run(self)
 
         for s in self.scenarios:
             default_port = 5060 + len(self.sipp) + 1
@@ -205,17 +209,16 @@
             self.stdout.append(out)
             self.stderr.append(err)
             self.result.append(self.sipp[i].wait())
+            logger.debug(self.stdout[i])
             if self.result[i]:
                 logger.warn("SIPp scenario #%d FAILED" % i)
+                logger.warn(self.stderr[i])
+                passed = False
             else:
                 logger.info("SIPp scenario #%d PASSED" % i)
-            if self.result[i]:
-                passed = False
-                #print self.stdout[i]
-                logger.warn(self.stderr[i])
-
-        self.ast1.stop()
-
+
+        self.stop_reactor()
+        self.stop_asterisk()
         if passed:
             return 0
         else:

Modified: asterisk/trunk/tests/channels/SIP/codec_negotiation/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/codec_negotiation/run-test?view=diff&rev=3010&r1=3009&r2=3010
==============================================================================
--- asterisk/trunk/tests/channels/SIP/codec_negotiation/run-test (original)
+++ asterisk/trunk/tests/channels/SIP/codec_negotiation/run-test Wed Jan 25 16:04:25 2012
@@ -11,6 +11,8 @@
 import os
 
 sys.path.append("lib/python")
+
+from twisted.internet import reactor
 from asterisk.sipp import SIPpTest
 
 
@@ -46,7 +48,8 @@
 def main():
     [update_entry(i) for i in SIPP_SCENARIOS]
     test = SIPpTest(WORKING_DIR, TEST_DIR, SIPP_SCENARIOS)
-    return test.run()
+    reactor.run()
+    return not test.passed
 
 
 if __name__ == "__main__":

Modified: asterisk/trunk/tests/channels/SIP/message_auth/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/message_auth/run-test?view=diff&rev=3010&r1=3009&r2=3010
==============================================================================
--- asterisk/trunk/tests/channels/SIP/message_auth/run-test (original)
+++ asterisk/trunk/tests/channels/SIP/message_auth/run-test Wed Jan 25 16:04:25 2012
@@ -11,6 +11,8 @@
 import os
 
 sys.path.append("lib/python")
+
+from twisted.internet import reactor
 from asterisk.sipp import SIPpTest
 
 
@@ -31,7 +33,8 @@
 
 def main():
     test = SIPpTest(WORKING_DIR, TEST_DIR, SIPP_SCENARIOS)
-    return test.run()
+    reactor.run()
+    return not test.passed
 
 
 if __name__ == "__main__":

Modified: asterisk/trunk/tests/channels/SIP/message_auth_cust_hdr/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/message_auth_cust_hdr/run-test?view=diff&rev=3010&r1=3009&r2=3010
==============================================================================
--- asterisk/trunk/tests/channels/SIP/message_auth_cust_hdr/run-test (original)
+++ asterisk/trunk/tests/channels/SIP/message_auth_cust_hdr/run-test Wed Jan 25 16:04:25 2012
@@ -11,6 +11,8 @@
 import os
 
 sys.path.append("lib/python")
+
+from twisted.internet import reactor
 from asterisk.sipp import SIPpTest
 
 
@@ -31,7 +33,8 @@
 
 def main():
     test = SIPpTest(WORKING_DIR, TEST_DIR, SIPP_SCENARIOS)
-    return test.run()
+    reactor.run()
+    return not test.passed
 
 
 if __name__ == "__main__":

Modified: asterisk/trunk/tests/channels/SIP/message_disabled/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/message_disabled/run-test?view=diff&rev=3010&r1=3009&r2=3010
==============================================================================
--- asterisk/trunk/tests/channels/SIP/message_disabled/run-test (original)
+++ asterisk/trunk/tests/channels/SIP/message_disabled/run-test Wed Jan 25 16:04:25 2012
@@ -11,6 +11,8 @@
 import os
 
 sys.path.append("lib/python")
+
+from twisted.internet import reactor
 from asterisk.sipp import SIPpTest
 
 
@@ -26,7 +28,8 @@
 
 def main():
     test = SIPpTest(WORKING_DIR, TEST_DIR, SIPP_SCENARIOS)
-    return test.run()
+    reactor.run()
+    return not test.passed
 
 
 if __name__ == "__main__":

Modified: asterisk/trunk/tests/channels/SIP/message_from_call/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/message_from_call/run-test?view=diff&rev=3010&r1=3009&r2=3010
==============================================================================
--- asterisk/trunk/tests/channels/SIP/message_from_call/run-test (original)
+++ asterisk/trunk/tests/channels/SIP/message_from_call/run-test Wed Jan 25 16:04:25 2012
@@ -11,6 +11,8 @@
 import os
 
 sys.path.append("lib/python")
+
+from twisted.internet import reactor
 from asterisk.sipp import SIPpTest
 
 
@@ -31,7 +33,8 @@
 
 def main():
     test = SIPpTest(WORKING_DIR, TEST_DIR, SIPP_SCENARIOS)
-    return test.run()
+    reactor.run()
+    return not test.passed
 
 
 if __name__ == "__main__":

Modified: asterisk/trunk/tests/channels/SIP/message_unauth/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/message_unauth/run-test?view=diff&rev=3010&r1=3009&r2=3010
==============================================================================
--- asterisk/trunk/tests/channels/SIP/message_unauth/run-test (original)
+++ asterisk/trunk/tests/channels/SIP/message_unauth/run-test Wed Jan 25 16:04:25 2012
@@ -11,6 +11,8 @@
 import os
 
 sys.path.append("lib/python")
+
+from twisted.internet import reactor
 from asterisk.sipp import SIPpTest
 
 
@@ -31,7 +33,8 @@
 
 def main():
     test = SIPpTest(WORKING_DIR, TEST_DIR, SIPP_SCENARIOS)
-    return test.run()
+    reactor.run()
+    return not test.passed
 
 
 if __name__ == "__main__":

Modified: asterisk/trunk/tests/channels/SIP/message_unauth_from/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/message_unauth_from/run-test?view=diff&rev=3010&r1=3009&r2=3010
==============================================================================
--- asterisk/trunk/tests/channels/SIP/message_unauth_from/run-test (original)
+++ asterisk/trunk/tests/channels/SIP/message_unauth_from/run-test Wed Jan 25 16:04:25 2012
@@ -11,6 +11,8 @@
 import os
 
 sys.path.append("lib/python")
+
+from twisted.internet import reactor
 from asterisk.sipp import SIPpTest
 
 
@@ -62,7 +64,8 @@
 
 def main():
     test = SIPpTest(WORKING_DIR, TEST_DIR, SIPP_SCENARIOS)
-    return test.run()
+    reactor.run()
+    return not test.passed
 
 
 if __name__ == "__main__":

Modified: asterisk/trunk/tests/channels/SIP/options/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/options/run-test?view=diff&rev=3010&r1=3009&r2=3010
==============================================================================
--- asterisk/trunk/tests/channels/SIP/options/run-test (original)
+++ asterisk/trunk/tests/channels/SIP/options/run-test Wed Jan 25 16:04:25 2012
@@ -11,6 +11,8 @@
 import os
 
 sys.path.append("lib/python")
+
+from twisted.internet import reactor
 from asterisk.sipp import SIPpTest
 
 WORKING_DIR = "sip/options"
@@ -28,7 +30,8 @@
 
 def main():
     test = SIPpTest(WORKING_DIR, TEST_DIR, SIPP_SCENARIOS)
-    return test.run()
+    reactor.run()
+    return not test.passed
 
 
 if __name__ == "__main__":




More information about the svn-commits mailing list