<p>Jenkins2 <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/6638">View Change</a></p><div style="white-space:pre-wrap">Approvals:
Joshua Colp: Looks good to me, but someone else must approve
Kevin Harwell: Looks good to me, approved
Jenkins2: Approved for Submit
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">testsuite: Add min/max version lists to test-object and modules.<br><br>Make testsuite accept the minversion/maxversion syntax for "test-object"<br>and "modules". Before it only accepted a single version string. Now it<br>will accept a single version string or a list of version strings.<br><br>test-modules:<br> test-object:<br> -<br> maxversion: ['13.18.0', '14.7.0', '15.1.0']<br> config-section: test-object-config-v12<br> typename: 'sipp.SIPpTestCase'<br> -<br> minversion: ['13.18.0', '14.7.0', '15.1.0']<br> config-section: test-object-config-v13.18.0<br> typename: 'sipp.SIPpTestCase'<br> modules:<br> -<br> maxversion: ['13.18.0', '14.7.0', '15.1.0']<br> config-section: 'ami-config-v12'<br> typename: 'ami.AMIEventModule'<br> -<br> minversion: ['13.18.0', '14.7.0', '15.1.0']<br> config-section: 'ami-config-v13.18.0'<br> typename: 'ami.AMIEventModule'<br><br>Also fixed a bug in the "properties: maxversion" handling of version<br>lists. We were cutting off running the test only if the Asterisk version<br>was greater than or equal to all listed versions. It is now handled<br>similarly to minversion.<br><br>Change-Id: Ibd896104af60bdab720e14e3b5bd03aafc8f2167<br>---<br>M lib/python/asterisk/test_config.py<br>M lib/python/asterisk/test_runner.py<br>2 files changed, 42 insertions(+), 9 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/lib/python/asterisk/test_config.py b/lib/python/asterisk/test_config.py<br>index b44ffb9..7775a62 100644<br>--- a/lib/python/asterisk/test_config.py<br>+++ b/lib/python/asterisk/test_config.py<br>@@ -484,11 +484,17 @@<br> min_candidates = self.minversion<br> self.minversion_check = all([ast_version >= ver<br> for ver in min_candidates])<br>+<br> # Max version is a bit different: generally, it is a hard cut-off<br>- # (as what the test covers has been removed). We should always be less<br>- # than any provided max version.<br>+ # (as what the test covers has been removed). If we have a maximum<br>+ # version for our branch; use that. Otherwise, compare against all<br>+ # listed maximum versions.<br>+ max_candidates = [ver for ver in self.maxversion<br>+ if ver.major == ast_version.major]<br>+ if not len(max_candidates):<br>+ max_candidates = self.maxversion<br> self.maxversion_check = all([ast_version < ver<br>- for ver in self.maxversion])<br>+ for ver in max_candidates])<br> <br> if not self.minversion_check or not self.maxversion_check:<br> self.can_run = False<br>diff --git a/lib/python/asterisk/test_runner.py b/lib/python/asterisk/test_runner.py<br>index a097d02..a31c8ca 100755<br>--- a/lib/python/asterisk/test_runner.py<br>+++ b/lib/python/asterisk/test_runner.py<br>@@ -145,13 +145,40 @@<br> version, True otherwise<br> """<br> <br>- modminversion = module_spec.get('minversion')<br>- modmaxversion = module_spec.get('maxversion')<br>- if (modminversion is not None and<br>- AsteriskVersion(ast_version) < AsteriskVersion(modminversion)):<br>+ running_version = AsteriskVersion(ast_version)<br>+<br>+ minversion = module_spec.get("minversion", [])<br>+ if not isinstance(minversion, list):<br>+ minversion = [minversion]<br>+ min_versions = [AsteriskVersion(ver) for ver in minversion]<br>+<br>+ # If we have a minimum version for our branch; use that. Otherwise,<br>+ # compare against all listed minimum versions.<br>+ min_candidates = [ver for ver in min_versions<br>+ if ver.major == running_version.major]<br>+ if not len(min_candidates):<br>+ min_candidates = min_versions<br>+ min_version_check = all([running_version >= ver for ver in min_candidates])<br>+<br>+ if not min_version_check:<br> return False<br>- if (modmaxversion is not None and<br>- AsteriskVersion(ast_version) >= AsteriskVersion(modmaxversion)):<br>+<br>+ maxversion = module_spec.get("maxversion", [])<br>+ if not isinstance(maxversion, list):<br>+ maxversion = [maxversion]<br>+ max_versions = [AsteriskVersion(ver) for ver in maxversion]<br>+<br>+ # Max version is a bit different: generally, it is a hard cut-off<br>+ # (as what the test covers has been removed). If we have a maximum<br>+ # version for our branch; use that. Otherwise, compare against all<br>+ # listed maximum versions.<br>+ max_candidates = [ver for ver in max_versions<br>+ if ver.major == running_version.major]<br>+ if not len(max_candidates):<br>+ max_candidates = max_versions<br>+ max_version_check = all([running_version < ver for ver in max_candidates])<br>+<br>+ if not max_version_check:<br> return False<br> <br> return True<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/6638">change 6638</a>. To unsubscribe, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/6638"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: testsuite </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: Ibd896104af60bdab720e14e3b5bd03aafc8f2167 </div>
<div style="display:none"> Gerrit-Change-Number: 6638 </div>
<div style="display:none"> Gerrit-PatchSet: 2 </div>
<div style="display:none"> Gerrit-Owner: Richard Mudgett <rmudgett@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins2 </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Kevin Harwell <kharwell@digium.com> </div>