[oe-commits] [bitbake] branch master-next updated: tests/utils.py: add one more test cases for bb.utils.vercmp_string
git at git.openembedded.org
git at git.openembedded.org
Wed Jun 19 19:47:09 UTC 2019
This is an automated email from the git hooks/post-receive script.
rpurdie pushed a commit to branch master-next
in repository bitbake.
The following commit(s) were added to refs/heads/master-next by this push:
new 9767fff tests/utils.py: add one more test cases for bb.utils.vercmp_string
9767fff is described below
commit 9767fffe3115a1f1afa3c6a2b39720fefb8dc4d5
Author: Martin Jansa <martin.jansa at gmail.com>
AuthorDate: Tue Jun 18 16:46:28 2019 +0000
tests/utils.py: add one more test cases for bb.utils.vercmp_string
* this is just another test case for issue already fixed in:
commit fef56d28c3efec4876c379898cbc4d4c65303aee
Author: Alexander Kanavin <alex.kanavin at gmail.com>
Date: Sun Feb 24 21:07:28 2019 +0100
Subject: bitbake: fix version comparison when one of the versions ends in .
* The TypeError is triggered not by '.' at the end, but from the extra
numberic component in one of the versions.
* When one version has fewer elements, it's extended by another (0, None)
element where 0 means numeric component. Then the result cannot be
decided by comparing the types (oa < ob, ob > oa) and it continues
to compare values (ca < cb) which fails when one of them is the None
from (0, None) appended before.
======================================================================
ERROR: test_vercmpstring (bb.tests.utils.VerCmpString)
----------------------------------------------------------------------
Traceback (most recent call last):
File "lib/bb/tests/utils.py", line 32, in test_vercmpstring
result = bb.utils.vercmp_string('1a', '1a1')
File "lib/bb/utils.py", line 131, in vercmp_string
return vercmp(ta, tb)
File "lib/bb/utils.py", line 123, in vercmp
r = vercmp_part(va, vb)
File "lib/bb/utils.py", line 112, in vercmp_part
elif ca < cb:
TypeError: '<' not supported between instances of 'NoneType' and 'int'
----------------------------------------------------------------------
Ran 3 tests in 0.002s
Signed-off-by: Martin Jansa <Martin.Jansa at gmail.com>
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
lib/bb/tests/utils.py | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/lib/bb/tests/utils.py b/lib/bb/tests/utils.py
index 4d78828..f4adf1d 100644
--- a/lib/bb/tests/utils.py
+++ b/lib/bb/tests/utils.py
@@ -29,6 +29,10 @@ class VerCmpString(unittest.TestCase):
self.assertTrue(result < 0)
result = bb.utils.vercmp_string('1.1', '1.0+1.1-beta1')
self.assertTrue(result > 0)
+ result = bb.utils.vercmp_string('1a', '1a1')
+ self.assertTrue(result < 0)
+ result = bb.utils.vercmp_string('1a1', '1a')
+ self.assertTrue(result > 0)
result = bb.utils.vercmp_string('1.', '1.1')
self.assertTrue(result < 0)
result = bb.utils.vercmp_string('1.1', '1.')
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Openembedded-commits
mailing list