summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite/test/lldbtest.py
diff options
context:
space:
mode:
authorFrederic Riss <friss@apple.com>2019-02-14 18:48:05 +0000
committerFrederic Riss <friss@apple.com>2019-02-14 18:48:05 +0000
commitb3a4649a6a27aa4b70b360445f6d2c600db8dff7 (patch)
tree83e065a23b91add1831619b04156c5699a38a8bb /lldb/packages/Python/lldbsuite/test/lldbtest.py
parent97067d3c7321ff8a3dcb0b0f41ae06b1602787c3 (diff)
downloadbcm5719-llvm-b3a4649a6a27aa4b70b360445f6d2c600db8dff7.tar.gz
bcm5719-llvm-b3a4649a6a27aa4b70b360445f6d2c600db8dff7.zip
[dotest] Fix compiler version number comparison
dotest's version comparision function is just a lexicographical compare of the version strings. This is obviously wrong. This patch implements the comparison using distutils.version.LooseVersion as suggested by Zachary. Reviewers: zturner, labath, serge-sans-paille Subscribers: jdoerfert, lldb-commits Differential Revision: https://reviews.llvm.org/D58219 llvm-svn: 354047
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/lldbtest.py')
-rw-r--r--lldb/packages/Python/lldbsuite/test/lldbtest.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/lldbtest.py b/lldb/packages/Python/lldbsuite/test/lldbtest.py
index 6844ae02ec1..f1b0d9a1d57 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbtest.py
+++ b/lldb/packages/Python/lldbsuite/test/lldbtest.py
@@ -37,6 +37,7 @@ from __future__ import print_function
# System modules
import abc
import collections
+from distutils.version import LooseVersion
from functools import wraps
import gc
import glob
@@ -1352,13 +1353,13 @@ class Base(unittest2.TestCase):
if (version is None):
return True
if (operator == '>'):
- return self.getCompilerVersion() > version
+ return LooseVersion(self.getCompilerVersion()) > LooseVersion(version)
if (operator == '>=' or operator == '=>'):
- return self.getCompilerVersion() >= version
+ return LooseVersion(self.getCompilerVersion()) >= LooseVersion(version)
if (operator == '<'):
- return self.getCompilerVersion() < version
+ return LooseVersion(self.getCompilerVersion()) < LooseVersion(version)
if (operator == '<=' or operator == '=<'):
- return self.getCompilerVersion() <= version
+ return LooseVersion(self.getCompilerVersion()) <= LooseVersion(version)
if (operator == '!=' or operator == '!' or operator == 'not'):
return str(version) not in str(self.getCompilerVersion())
return str(version) in str(self.getCompilerVersion())
OpenPOWER on IntegriCloud