[svn-commits] russell: testsuite/asterisk/trunk r483 - /asterisk/trunk/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Jul 12 17:48:27 CDT 2010


Author: russell
Date: Mon Jul 12 17:48:24 2010
New Revision: 483

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=483
Log:
Add the ability to define custom dependency types.  Also add IPv6 as a custom dependency.

Modified:
    asterisk/trunk/README.txt
    asterisk/trunk/runtests.py

Modified: asterisk/trunk/README.txt
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/README.txt?view=diff&rev=483&r1=482&r2=483
==============================================================================
--- asterisk/trunk/README.txt (original)
+++ asterisk/trunk/README.txt Mon Jul 12 17:48:24 2010
@@ -253,11 +253,18 @@
         # Checking for an 'app' dependency behaves like the 'which' command
         - app : 'bash'
         - app : 'sipp'
+
         # A 'python' dependency is a python module.  An attempt will be made to
         # import a module by this name to determine whether the dependency is
         # met.
         - python : 'yaml'
 
+        # 'custom' dependency can be anything.  Checking for this dependency is
+        # done by calling a corresponding method in the Dependency class in
+        # runtests.py.  For example, if the dependency is 'ipv6', then the
+        # depend_ipv6() method is called to determine if the dependency is met.
+        - custom : 'ipv6'
+
 
 
 --------------------------------------------------------------------------------

Modified: asterisk/trunk/runtests.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/runtests.py?view=diff&rev=483&r1=482&r2=483
==============================================================================
--- asterisk/trunk/runtests.py (original)
+++ asterisk/trunk/runtests.py Mon Jul 12 17:48:24 2010
@@ -13,6 +13,7 @@
 import optparse
 import time
 import yaml
+import socket
 
 sys.path.append("lib/python")
 
@@ -46,6 +47,16 @@
                 self.met = True
             except ImportError:
                 pass
+        elif "custom" in dep:
+            self.name = dep["custom"]
+            method = "depend_%s" % self.name
+            found = False
+            for m in dir(self):
+                if m == method:
+                    self.met = getattr(self, m)()
+                    found = True
+            if not found:
+                print "Unknown custom dependency - '%s'" % self.name
         else:
             print "Unknown dependency type specified."
 
@@ -67,6 +78,14 @@
                     return exe_file
 
         return None
+
+    def depend_ipv6(self):
+        try:
+            s = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
+            s.close()
+            return True
+        except:
+            return False
 
 
 class TestConfig:




More information about the svn-commits mailing list