[asterisk-commits] mjordan: testsuite/asterisk/trunk r6127 - in /asterisk/trunk: ./ lib/python/a...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Sun Dec 21 20:25:21 CST 2014
Author: mjordan
Date: Sun Dec 21 20:25:10 2014
New Revision: 6127
URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=6127
Log:
testsuite: Allow tests to specify multiple minimum versions
Prior to this patch, a test could only provide a single required minimum
version of Asterisk. This didn't bode well for tests that have been added due
to bugs, which typically require a minimum version for each active branch of
Asterisk. Not allowing multiple minimum versions to be specified would result
in the test being erroneously executed for higher branches of Asterisk,
resulting in false test failures.
Take, for example, tests/channels/SIP/no_ack_dialog_cleanup. This test was
added for ASTERISK-20784, the fix of which was released in 1.8.32.0, 11.14.0,
12.7.0, and 13.0.0-beta3. Because only a single version could be specified,
however, the best the test writer could do was provide the 1.8 version:
properties:
minversion: '1.8.32.0'
This would prevent 1.8.31.0 from running against the test, but 11.13.0 would
execute the test, as it is greater than the supplied minversion of 1.8.32.0.
However, if we specify a list of minversions:
minversion: ['1.8.32.0', '11.14.0', '12.7.0', '13.0.0-beta3']
Then we can determine that 11.13.0 is less than 11.14.0, and prevent the test
from running.
With this patch, that is now possible. Failed Bamboo runs rejoiced everywhere.
Review: https://reviewboard.asterisk.org/r/4270/
Modified:
asterisk/trunk/lib/python/asterisk/test_config.py
asterisk/trunk/runtests.py
asterisk/trunk/tests/channels/SIP/invite_retransmit/test-config.yaml
asterisk/trunk/tests/channels/SIP/no_ack_dialog_cleanup/test-config.yaml
Modified: asterisk/trunk/lib/python/asterisk/test_config.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/lib/python/asterisk/test_config.py?view=diff&rev=6127&r1=6126&r2=6127
==============================================================================
--- asterisk/trunk/lib/python/asterisk/test_config.py (original)
+++ asterisk/trunk/lib/python/asterisk/test_config.py Sun Dec 21 20:25:10 2014
@@ -252,16 +252,16 @@
self.config = None
self.summary = None
self.description = None
- self.maxversion = None
+ self.maxversion = []
self.maxversion_check = False
- self.minversion = None
+ self.minversion = []
self.minversion_check = False
self.forced_version = None
self.deps = []
self.tags = []
self.expect_pass = True
self.excluded_tests = []
- self.features = []
+ self.features = set()
self.feature_check = {}
self.test_configuration = "(none)"
self.condition_definitions = []
@@ -322,30 +322,37 @@
def _process_properties(self):
"""Process test properties block"""
- self.minversion = AsteriskVersion("1.4")
- if self.config == None:
+ if self.config is None:
return
if "properties" not in self.config:
return
properties = self.config["properties"]
- if "minversion" in properties:
- self.minversion = AsteriskVersion(properties["minversion"])
- if self.minversion.feature:
- self.features.append(self.minversion.feature)
- self.feature_check[self.minversion.feature] = False
- if "maxversion" in properties:
- self.maxversion = AsteriskVersion(properties["maxversion"])
- self.expect_pass = (
- properties.get("expectedResult", self.expect_pass) and
- properties.get("expected-result", self.expect_pass))
+ minversion = properties.get("minversion", ["1.4"])
+
+ if not isinstance(minversion, list):
+ minversion = [minversion]
+ self.minversion = [AsteriskVersion(ver) for ver in minversion]
+
+ maxversion = properties.get("maxversion", [])
+ if not isinstance(maxversion, list):
+ maxversion = [maxversion]
+ self.maxversion = [AsteriskVersion(ver) for ver in maxversion]
+
+ self.expect_pass = (properties.get("expectedResult", self.expect_pass) and
+ properties.get("expected-result", self.expect_pass))
if "tags" in properties:
self.tags = properties["tags"]
if "features" in properties:
- self.features.extend(properties["features"])
- for feature in self.features:
- self.feature_check[feature] = False
+ self.features = set(properties["features"])
if "forced-version" in properties:
self.forced_version = AsteriskVersion(properties["forced-version"])
+
+ for ver in self.minversion:
+ if ver.feature:
+ self.features.add(ver.feature)
+
+ for feature in self.features:
+ self.feature_check[feature] = False
def _parse_config(self):
"""Parse the test-config YAML file."""
@@ -420,7 +427,6 @@
]
return self.deps
-
def check_deps(self, ast_version):
"""Check whether or not a test should execute based on its dependencies
@@ -437,17 +443,22 @@
if self.forced_version is not None:
ast_version = self.forced_version
- self.minversion_check = True
- if ast_version < self.minversion:
+ # If we have a minimum version for our branch; use that. Otherwise,
+ # compare against all listed minimum versions.
+ min_candidates = [ver for ver in self.minversion
+ if ver.major == ast_version.major]
+ if not len(min_candidates):
+ min_candidates = self.minversion
+ self.minversion_check = all([ast_version >= ver
+ for ver in min_candidates])
+ # Max version is a bit different: generally, it is a hard cut-off
+ # (as what the test covers has been removed). We should always be less
+ # than any provided max version.
+ self.maxversion_check = all([ast_version < ver
+ for ver in self.maxversion])
+
+ if not self.minversion_check or not self.maxversion_check:
self.can_run = False
- self.minversion_check = False
- return self.can_run
-
- self.maxversion_check = True
- if self.maxversion is not None and ast_version > self.maxversion:
- self.can_run = False
- self.maxversion_check = False
- return self.can_run
for feature in self.features:
self.feature_check[feature] = ast_version.has_feature(feature)
@@ -457,7 +468,6 @@
for dep in self.get_deps():
if dep.met is False:
self.can_run = False
- break
return self.can_run
def check_tags(self, requested_tags):
Modified: asterisk/trunk/runtests.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/runtests.py?view=diff&rev=6127&r1=6126&r2=6127
==============================================================================
--- asterisk/trunk/runtests.py (original)
+++ asterisk/trunk/runtests.py Sun Dec 21 20:25:10 2014
@@ -352,10 +352,12 @@
print "%.3d) %s" % (i, t.test_config.test_name)
print " --> Summary: %s" % t.test_config.summary
print (" --> Minimum Version: %s (%s)" %
- (t.test_config.minversion, t.test_config.minversion_check))
+ (", ".join([str(v) for v in t.test_config.minversion]),
+ t.test_config.minversion_check))
if t.test_config.maxversion is not None:
print (" --> Maximum Version: %s (%s)" %
- (t.test_config.maxversion, t.test_config.maxversion_check))
+ (", ".join([str(v) for v in t.test_config.maxversion]),
+ t.test_config.maxversion_check))
if t.test_config.features:
print " --> Features:"
for feature_name in t.test_config.features:
Modified: asterisk/trunk/tests/channels/SIP/invite_retransmit/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/invite_retransmit/test-config.yaml?view=diff&rev=6127&r1=6126&r2=6127
==============================================================================
--- asterisk/trunk/tests/channels/SIP/invite_retransmit/test-config.yaml (original)
+++ asterisk/trunk/tests/channels/SIP/invite_retransmit/test-config.yaml Sun Dec 21 20:25:10 2014
@@ -6,7 +6,7 @@
'ASTERISK-24335.'
properties:
- minversion: '1.8.32.0'
+ minversion: ['1.8.32.0', '11.14.0', '12.7.0', '13.0.0-beta3']
dependencies:
- asterisk: 'chan_sip'
- python: 'twisted'
Modified: asterisk/trunk/tests/channels/SIP/no_ack_dialog_cleanup/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/no_ack_dialog_cleanup/test-config.yaml?view=diff&rev=6127&r1=6126&r2=6127
==============================================================================
--- asterisk/trunk/tests/channels/SIP/no_ack_dialog_cleanup/test-config.yaml (original)
+++ asterisk/trunk/tests/channels/SIP/no_ack_dialog_cleanup/test-config.yaml Sun Dec 21 20:25:10 2014
@@ -7,7 +7,7 @@
If the bug is not fixed, this will leak a sip dialog object.'
properties:
- minversion: '1.8.32.0'
+ minversion: ['1.8.32.0', '11.14.0', '12.7.0', '13.0.0-beta3']
dependencies:
- python: 'starpy'
- sipp:
More information about the asterisk-commits
mailing list