Author: Jordan Rupprecht
Date: 2020-09-21T16:19:28-07:00
New Revision: 307b7a1d665898d0e980461919996b6a670a4847

URL: 
https://github.com/llvm/llvm-project/commit/307b7a1d665898d0e980461919996b6a670a4847
DIFF: 
https://github.com/llvm/llvm-project/commit/307b7a1d665898d0e980461919996b6a670a4847.diff

LOG: [lldb/test] Clean up version checking.

A few fixes while trying to figure out why tests are being skipped for arsenm:

- We check `$compiler -v`, but `-v` is `--verbose`, not `--version`. Use the 
long flag name.
- We check all lines matching `version ...`, but we should exit early for the 
first version string we see (which should be the main one). I'm not sure if 
this is the issue, but perhaps this is causing some users to skip some tests if 
another "version ..." is showing up later.
- Having `\.` in a python string is triggering pylint warnings, because it 
should be escaped as a regex string, e.g. `r'\.' However, `.` in a character 
class does not need to be escaped, as it matches only a literal `.` in that 
context.

Reviewed By: JDevlieghere

Differential Revision: https://reviews.llvm.org/D88051

Added: 
    

Modified: 
    lldb/packages/Python/lldbsuite/test/lldbtest.py

Removed: 
    


################################################################################
diff  --git a/lldb/packages/Python/lldbsuite/test/lldbtest.py 
b/lldb/packages/Python/lldbsuite/test/lldbtest.py
index 73faa2aef5e4..2ee82295c553 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbtest.py
+++ b/lldb/packages/Python/lldbsuite/test/lldbtest.py
@@ -1364,15 +1364,13 @@ def getCompilerVersion(self):
         """ Returns a string that represents the compiler version.
             Supports: llvm, clang.
         """
-        version = 'unknown'
-
         compiler = self.getCompilerBinary()
-        version_output = system([[compiler, "-v"]])
+        version_output = system([[compiler, "--version"]])
         for line in version_output.split(os.linesep):
-            m = re.search('version ([0-9\.]+)', line)
+            m = re.search('version ([0-9.]+)', line)
             if m:
-                version = m.group(1)
-        return version
+                return m.group(1)
+        return 'unknown'
 
     def getDwarfVersion(self):
         """ Returns the dwarf version generated by clang or '0'. """


        
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to