summaryrefslogtreecommitdiffstats
path: root/bitbake/lib
diff options
context:
space:
mode:
authorMartin Jansa <martin.jansa@gmail.com>2019-06-18 16:46:28 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-06-21 00:33:32 +0100
commit50d272863d35e0f37df13577cd77f25c84a50c26 (patch)
treee3eb71929afbbff780fadd75998b84f4c4af5ba8 /bitbake/lib
parent9d91ba408e65a11412570511f1ed267867444baf (diff)
downloadpoky-50d272863d35e0f37df13577cd77f25c84a50c26.tar.gz
bitbake: 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@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 (Bitbake rev: 9767fffe3115a1f1afa3c6a2b39720fefb8dc4d5) Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib')
-rw-r--r--bitbake/lib/bb/tests/utils.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/bitbake/lib/bb/tests/utils.py b/bitbake/lib/bb/tests/utils.py
index 4d788281a7..f4adf1d44b 100644
--- a/bitbake/lib/bb/tests/utils.py
+++ b/bitbake/lib/bb/tests/utils.py
@@ -29,6 +29,10 @@ class VerCmpString(unittest.TestCase):
29 self.assertTrue(result < 0) 29 self.assertTrue(result < 0)
30 result = bb.utils.vercmp_string('1.1', '1.0+1.1-beta1') 30 result = bb.utils.vercmp_string('1.1', '1.0+1.1-beta1')
31 self.assertTrue(result > 0) 31 self.assertTrue(result > 0)
32 result = bb.utils.vercmp_string('1a', '1a1')
33 self.assertTrue(result < 0)
34 result = bb.utils.vercmp_string('1a1', '1a')
35 self.assertTrue(result > 0)
32 result = bb.utils.vercmp_string('1.', '1.1') 36 result = bb.utils.vercmp_string('1.', '1.1')
33 self.assertTrue(result < 0) 37 self.assertTrue(result < 0)
34 result = bb.utils.vercmp_string('1.1', '1.') 38 result = bb.utils.vercmp_string('1.1', '1.')