[asterisk-commits] mjordan: testsuite/asterisk/trunk r3528 - in /asterisk/trunk: ./ lib/python/a...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Nov 23 14:54:39 CST 2012


Author: mjordan
Date: Fri Nov 23 14:54:32 2012
New Revision: 3528

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=3528
Log:
Add capability to override the version of Asterisk under test

This patch adds an option to the global config that specifies the version of
Asterisk under test.  This is useful for circumstances where the version
cannot be determined directly from Asterisk itself, such as team branches.

Review: https://reviewboard.asterisk.org/r/2202


Modified:
    asterisk/trunk/lib/python/asterisk/TestConfig.py
    asterisk/trunk/runtests.py
    asterisk/trunk/test-config.yaml

Modified: asterisk/trunk/lib/python/asterisk/TestConfig.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/lib/python/asterisk/TestConfig.py?view=diff&rev=3528&r1=3527&r2=3528
==============================================================================
--- asterisk/trunk/lib/python/asterisk/TestConfig.py (original)
+++ asterisk/trunk/lib/python/asterisk/TestConfig.py Fri Nov 23 14:54:32 2012
@@ -243,6 +243,7 @@
         self.maxversion_check = False
         self.minversion = None
         self.minversion_check = False
+        self.forced_version = None
         self.deps = []
         self.tags = []
         self.expectPass = True
@@ -261,6 +262,7 @@
         """
         if self.global_test_config != None:
             self.condition_definitions = self.global_test_config.condition_definitions
+            self.forced_version = self.global_test_config.forced_version
             return
 
         if "global-settings" in self.config:
@@ -330,6 +332,13 @@
             self.features.extend(properties["features"])
             for f in self.features:
                 self.feature_check[f] = False
+        if "forced-version" in properties:
+            try:
+                self.forced_version = AsteriskVersion(properties["forced-version"])
+            except:
+                self.can_run = False
+                print "ERROR: '%s' is not a valid Asterisk version" % \
+                    properties["forced-version"]
 
     def __parse_config(self):
         test_config = "%s/test-config.yaml" % self.test_name
@@ -401,6 +410,9 @@
             Dependency(d)
                 for d in self.config["properties"].get("dependencies") or []
         ]
+
+        if self.forced_version is not None:
+            ast_version = self.forced_version
 
         self.minversion_check = True
         if ast_version < self.minversion:

Modified: asterisk/trunk/runtests.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/runtests.py?view=diff&rev=3528&r1=3527&r2=3528
==============================================================================
--- asterisk/trunk/runtests.py (original)
+++ asterisk/trunk/runtests.py Fri Nov 23 14:54:32 2012
@@ -31,14 +31,15 @@
 TEST_RESULTS = "asterisk-test-suite-report.xml"
 
 class TestRun:
-    def __init__(self, test_name, ast_version, options):
+
+    def __init__(self, test_name, ast_version, options, global_config=None):
         self.can_run = False
         self.did_run = False
         self.time = 0.0
         self.test_name = test_name
         self.ast_version = ast_version
         self.options = options
-        self.test_config = TestConfig(test_name)
+        self.test_config = TestConfig(test_name, global_config)
         self.failure_message = ""
         self.__check_can_run(ast_version)
         self.stdout = ""
@@ -171,8 +172,8 @@
         self.options = options
 
         self.tests = []
+        self.global_config = self._parse_global_config()
         self.tests = self._parse_test_yaml("tests", ast_version)
-        self.global_config = self._parse_global_config()
         self.total_time = 0.0
         self.total_count = 0
         self.total_failures = 0
@@ -202,7 +203,7 @@
                     if self.options.test and not (path + '/').startswith(self.options.test):
                         continue
 
-                    tests.append(TestRun(path, ast_version, self.options))
+                    tests.append(TestRun(path, ast_version, self.options, self.global_config))
                 elif val == "dir":
                     tests += self._parse_test_yaml(path, ast_version)
 
@@ -266,6 +267,9 @@
                     print "--> %s ... skipped '%s'" % (t.test_name, t.test_config.skip)
                     continue
                 print "--> Cannot run test '%s'" % t.test_name
+                if t.test_config.forced_version is not None:
+                    print "--- --> Forced Asterisk Version: %s" % \
+                        (str(t.test_config.forced_version))
                 print "--- --> Minimum Version: %s (%s)" % \
                     (str(t.test_config.minversion), str(t.test_config.minversion_check))
                 if t.test_config.maxversion is not None:

Modified: asterisk/trunk/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/test-config.yaml?view=diff&rev=3528&r1=3527&r2=3528
==============================================================================
--- asterisk/trunk/test-config.yaml (original)
+++ asterisk/trunk/test-config.yaml Fri Nov 23 14:54:32 2012
@@ -90,4 +90,10 @@
             - name: 'file-descriptors'
             - name: 'channels'
 
+config-specific-version:
+    properties:
+        # Override the version of Asterisk under test to the specified version.
+        # This is particularly useful if the version under test is from a team
+        # branch not based on Asterisk trunk.
+        forced-version: 1.8.0.0
 




More information about the asterisk-commits mailing list