[Lldb-commits] [PATCH] D58219: [dotest] Fix compiler version number comparison
Frederic Riss via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Wed Feb 13 17:42:56 PST 2019
friss updated this revision to Diff 186782.
friss added a comment.
Use LooseVersion as suggested by Zachary
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D58219/new/
https://reviews.llvm.org/D58219
Files:
packages/Python/lldbsuite/test/lldbtest.py
Index: packages/Python/lldbsuite/test/lldbtest.py
===================================================================
--- packages/Python/lldbsuite/test/lldbtest.py
+++ packages/Python/lldbsuite/test/lldbtest.py
@@ -37,6 +37,7 @@
# System modules
import abc
import collections
+from distutils.version import LooseVersion
from functools import wraps
import gc
import glob
@@ -1351,14 +1352,15 @@
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())
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58219.186782.patch
Type: text/x-patch
Size: 1397 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20190214/25bf8de1/attachment.bin>
More information about the lldb-commits
mailing list