[PATCH] D58219: [dotest] Fix compiler version number comparison

Frederic Riss via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 14 10:51:21 PST 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL354047: [dotest] Fix compiler version number comparison (authored by friss, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D58219?vs=186782&id=186873#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D58219/new/

https://reviews.llvm.org/D58219

Files:
  lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py


Index: lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
===================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
+++ lldb/trunk/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
@@ -1352,13 +1353,13 @@
         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.186873.patch
Type: text/x-patch
Size: 1426 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190214/6eccaa2a/attachment.bin>


More information about the llvm-commits mailing list